Secure iNet Factory

com.jscape.util
Class LineReader

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by com.jscape.util.LineReader
All Implemented Interfaces:
java.io.Closeable

public class LineReader
extends java.io.FilterInputStream

Author:
vglass

Constructor Summary
LineReader(java.io.InputStream in)
          Constructs a new LineReader instance.
LineReader(java.io.InputStream in, char[] delim)
          Constructs a new LineReader instance.
 
Method Summary
 boolean hasDelimiter()
          Checks if last line reading was terminated with delimiter.
 java.lang.String readLine()
          Reads line from InputStream
 java.lang.String readLine(java.lang.String encoding)
          Reads line from InputStream.
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, read, read, reset, skip
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineReader

public LineReader(java.io.InputStream in)
Constructs a new LineReader instance.

Parameters:
in - the InputStream this LineReader is to reading from.

LineReader

public LineReader(java.io.InputStream in,
                  char[] delim)
Constructs a new LineReader instance. Default line terminator is CRLF (carriage return followed by a line feed).

Parameters:
in - the InputStream this LineReader is to reading from.
delim - a char[] representing the line terminator
Method Detail

hasDelimiter

public boolean hasDelimiter()
Checks if last line reading was terminated with delimiter.

Returns:
true if terminated with delimiter, false otherwise.

readLine

public java.lang.String readLine(java.lang.String encoding)
                          throws java.io.IOException
Reads line from InputStream.

Parameters:
encoding - the character encoding to use when reading converting data to a String
Returns:
returns line reading or null if end of InputStream reached
Throws:
java.io.IOException - if an I/O related error occurs

readLine

public java.lang.String readLine()
                          throws java.io.IOException
Reads line from InputStream

Returns:
returns line reading or a String of zero length if end of InputStream reached
Throws:
java.io.IOException - if an I/O related error occurs

Secure iNet Factory

Copyright © JSCAPE LLC. 1999-2011. All Rights Reserved