net.sourceforge.guacamole.io
Class ReaderGuacamoleReader

java.lang.Object
  extended by net.sourceforge.guacamole.io.ReaderGuacamoleReader
All Implemented Interfaces:
GuacamoleReader

public class ReaderGuacamoleReader
extends Object
implements GuacamoleReader

A GuacamoleReader which wraps a standard Java Reader, using that Reader as the Guacamole instruction stream.

Author:
Michael Jumper

Constructor Summary
ReaderGuacamoleReader(Reader input)
          Creates a new ReaderGuacamoleReader which will use the given Reader as the Guacamole instruction stream.
 
Method Summary
 boolean available()
          Returns whether instruction data is available for reading.
 char[] read()
          Reads at least one complete Guacamole instruction, returning a buffer containing one or more complete Guacamole instructions and no incomplete Guacamole instructions.
 GuacamoleInstruction readInstruction()
          Reads exactly one complete Guacamole instruction and returns the fully parsed instruction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReaderGuacamoleReader

public ReaderGuacamoleReader(Reader input)
Creates a new ReaderGuacamoleReader which will use the given Reader as the Guacamole instruction stream.

Parameters:
input - The Reader to use as the Guacamole instruction stream.
Method Detail

available

public boolean available()
                  throws GuacamoleException
Description copied from interface: GuacamoleReader
Returns whether instruction data is available for reading. Note that this does not guarantee an entire instruction is available. If a full instruction is not available, this function can return true, and a call to read() will still block.

Specified by:
available in interface GuacamoleReader
Returns:
true if instruction data is available for reading, false otherwise.
Throws:
GuacamoleException - If an error occurs while checking for available data.

read

public char[] read()
            throws GuacamoleException
Description copied from interface: GuacamoleReader
Reads at least one complete Guacamole instruction, returning a buffer containing one or more complete Guacamole instructions and no incomplete Guacamole instructions. This function will block until at least one complete instruction is available.

Specified by:
read in interface GuacamoleReader
Returns:
A buffer containing at least one complete Guacamole instruction, or null if no more instructions are available for reading.
Throws:
GuacamoleException - If an error occurs while reading from the stream.

readInstruction

public GuacamoleInstruction readInstruction()
                                     throws GuacamoleException
Description copied from interface: GuacamoleReader
Reads exactly one complete Guacamole instruction and returns the fully parsed instruction.

Specified by:
readInstruction in interface GuacamoleReader
Returns:
The next complete instruction from the stream, fully parsed, or null if no more instructions are available for reading.
Throws:
GuacamoleException - If an error occurs while reading from the stream, or if the instruction cannot be parsed.


Copyright © 2012. All Rights Reserved.