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.