Fix for read() vs. readInstruction() issue. Consistency with placement of import vs. license

This commit is contained in:
Michael Jumper
2011-06-04 22:22:58 -07:00
parent 8b49b22a0d
commit 6959b74d76
9 changed files with 44 additions and 33 deletions

View File

@@ -1,9 +1,6 @@
package net.sourceforge.guacamole.io;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.protocol.GuacamoleInstruction;
/*
* Guacamole - Clientless Remote Desktop
* Copyright (C) 2010 Michael Jumper
@@ -22,6 +19,9 @@ import net.sourceforge.guacamole.protocol.GuacamoleInstruction;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.protocol.GuacamoleInstruction;
/**
* Provides abstract and raw character read access to a stream of Guacamole
* instructions.

View File

@@ -1,9 +1,6 @@
package net.sourceforge.guacamole.io;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.protocol.GuacamoleInstruction;
/*
* Guacamole - Clientless Remote Desktop
* Copyright (C) 2010 Michael Jumper
@@ -22,6 +19,9 @@ import net.sourceforge.guacamole.protocol.GuacamoleInstruction;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.protocol.GuacamoleInstruction;
/**
* Provides abstract and raw character write access to a stream of Guacamole
* instructions.

View File

@@ -1,12 +1,6 @@
package net.sourceforge.guacamole.io;
import java.io.IOException;
import java.io.Reader;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.protocol.GuacamoleInstruction;
import net.sourceforge.guacamole.protocol.GuacamoleInstruction.Operation;
/*
* Guacamole - Clientless Remote Desktop
* Copyright (C) 2010 Michael Jumper
@@ -25,6 +19,12 @@ import net.sourceforge.guacamole.protocol.GuacamoleInstruction.Operation;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import java.io.IOException;
import java.io.Reader;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.protocol.GuacamoleInstruction;
import net.sourceforge.guacamole.protocol.GuacamoleInstruction.Operation;
/**
* A GuacamoleReader which wraps a standard Java Reader, using that Reader as
* the Guacamole instruction stream.
@@ -54,6 +54,17 @@ public class ReaderGuacamoleReader implements GuacamoleReader {
@Override
public char[] read() throws GuacamoleException {
// If data was previously read via readInstruction(), return remaining
// data instead of reading more.
if (instructionBuffer != null) {
char[] chunk = new char[instructionBuffer.length - instructionStart];
System.arraycopy(instructionBuffer, instructionStart, chunk, 0, chunk.length);
instructionBuffer = null;
return chunk;
}
try {
// While we're blocking, or input is available

View File

@@ -1,11 +1,6 @@
package net.sourceforge.guacamole.io;
import java.io.IOException;
import java.io.Writer;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.protocol.GuacamoleInstruction;
/*
* Guacamole - Clientless Remote Desktop
* Copyright (C) 2010 Michael Jumper
@@ -24,6 +19,11 @@ import net.sourceforge.guacamole.protocol.GuacamoleInstruction;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import java.io.IOException;
import java.io.Writer;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.protocol.GuacamoleInstruction;
/**
* A GuacamoleWriter which wraps a standard Java Writer, using that Writer as
* the Guacamole instruction stream.

View File

@@ -1,10 +1,6 @@
package net.sourceforge.guacamole.net;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.io.GuacamoleReader;
import net.sourceforge.guacamole.io.GuacamoleWriter;
/*
* Guacamole - Clientless Remote Desktop
* Copyright (C) 2010 Michael Jumper
@@ -23,6 +19,10 @@ import net.sourceforge.guacamole.io.GuacamoleWriter;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.io.GuacamoleReader;
import net.sourceforge.guacamole.io.GuacamoleWriter;
/**
* Provides abstract socket-like access to a Guacamole connection.
*

View File

@@ -1,8 +1,6 @@
package net.sourceforge.guacamole.properties;
import net.sourceforge.guacamole.GuacamoleException;
/*
* Guacamole - Clientless Remote Desktop
* Copyright (C) 2010 Michael Jumper
@@ -21,6 +19,8 @@ import net.sourceforge.guacamole.GuacamoleException;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import net.sourceforge.guacamole.GuacamoleException;
/**
* An abstract representation of a property in the guacamole.properties file,
* which parses into a specific type.

View File

@@ -1,12 +1,6 @@
package net.sourceforge.guacamole.protocol;
import net.sourceforge.guacamole.io.GuacamoleReader;
import net.sourceforge.guacamole.io.GuacamoleWriter;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.net.GuacamoleSocket;
import net.sourceforge.guacamole.protocol.GuacamoleInstruction.Operation;
/*
* Guacamole - Clientless Remote Desktop
* Copyright (C) 2010 Michael Jumper
@@ -25,6 +19,12 @@ import net.sourceforge.guacamole.protocol.GuacamoleInstruction.Operation;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import net.sourceforge.guacamole.io.GuacamoleReader;
import net.sourceforge.guacamole.io.GuacamoleWriter;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.net.GuacamoleSocket;
import net.sourceforge.guacamole.protocol.GuacamoleInstruction.Operation;
/**
* A GuacamoleSocket which pre-configures the connection based on a given
* GuacamoleConfiguration, completing the initial protocol handshake before

View File

@@ -1,8 +1,6 @@
package net.sourceforge.guacamole.protocol;
import java.util.HashMap;
/*
* Guacamole - Clientless Remote Desktop
* Copyright (C) 2010 Michael Jumper
@@ -21,6 +19,8 @@ import java.util.HashMap;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import java.util.HashMap;
/**
* All information necessary to complete the initial protocol handshake of a
* Guacamole session.

View File

@@ -1,8 +1,6 @@
package net.sourceforge.guacamole.protocol;
import java.util.HashMap;
/*
* Guacamole - Clientless Remote Desktop
* Copyright (C) 2010 Michael Jumper
@@ -21,6 +19,8 @@ import java.util.HashMap;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import java.util.HashMap;
/**
* An abstract representation of a Guacamole instruction, as defined by the
* Guacamole protocol.