naga.packetreader
Class AsciiLinePacketReader

java.lang.Object
  extended by naga.packetreader.DelimiterPacketReader
      extended by naga.packetreader.AsciiLinePacketReader
All Implemented Interfaces:
PacketReader

public class AsciiLinePacketReader
extends DelimiterPacketReader

Reads a bytestream delimited by '\n'.

This can be used for reading lines of ASCII characters.

Author:
Christoffer Lerno

Field Summary
 
Fields inherited from class naga.packetreader.DelimiterPacketReader
DEFAULT_READ_BUFFER_SIZE
 
Constructor Summary
AsciiLinePacketReader()
          Creates a '\n' delimited reader with default min buffer size and unlimited max buffer size.
AsciiLinePacketReader(int maxLineLength)
          Creates a '\n' delimited reader with the given max line length and default read buffer size.
AsciiLinePacketReader(int readBufferSize, int maxLineLength)
          Creates a '\n' delimited reader with the given max line length and read buffer size.
 
Method Summary
 
Methods inherited from class naga.packetreader.DelimiterPacketReader
getBuffer, getMaxPacketSize, getNextPacket, setMaxPacketSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsciiLinePacketReader

public AsciiLinePacketReader()
Creates a '\n' delimited reader with default min buffer size and unlimited max buffer size.


AsciiLinePacketReader

public AsciiLinePacketReader(int readBufferSize,
                             int maxLineLength)
Creates a '\n' delimited reader with the given max line length and read buffer size.

Exceeding the line length will throw a ProtocolViolationException.

Parameters:
readBufferSize - the size of the read buffer (i.e. how many bytes are read in a single pass) - this only has effect on read efficiency and memory requirements.
maxLineLength - maximum line length.

AsciiLinePacketReader

public AsciiLinePacketReader(int maxLineLength)
Creates a '\n' delimited reader with the given max line length and default read buffer size.

Exceeding the line length will throw a ProtocolViolationException.

Parameters:
maxLineLength - maximum line length.