|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.rim.device.api.io.LineReader
Utility class for reading out CRLF delimited lines from a SharedInputStream.
| Field Summary | ||
protected byte[] |
_buffer
|
|
protected int |
_bufferLength
|
|
protected int |
_bufferOffset
|
|
protected InputStream |
_stream
|
|
protected static int |
BUFFER_LENGTH
|
|
| Constructor Summary | ||
LineReader(InputStream stream)
Creates a new LineReader instance. |
||
| Method Summary | ||
byte[] |
getBuffer()
Deprecated. Only subclasses should access the underlying buffer, and they may directly access the protected _buffer field instead of using this method. |
|
int |
getBufferLength()
Deprecated. Only subclasses should access the buffer length, and they may directly access the protected _bufferLength field instead of using this method. |
|
int |
getBufferOffset()
Deprecated. Only subclasses should access the buffer offset, and they may directly access the protected _bufferOffset field instead of using this method. |
|
InputStream |
getStream()
Deprecated. Only subclasses should access the underlying stream, and they may directly access the protected _stream field instead of using this method. |
|
int |
lengthUnreadData()
Returns the number of bytes currently remaining in the underlying line buffer. |
|
byte[] |
readLine()
Read CRLF-delimited line from the stream. |
|
void |
setBufferLength(int bufferLength)
Deprecated. Only subclasses should access the buffer length, and they may directly access the protected _bufferLength field instead of using this method. |
|
void |
setBufferOffset(int bufferOffset)
Deprecated. Only subclasses should access the buffer offset, and they may directly access the protected _bufferOffset field instead of using this method. |
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
| Constructor Detail |
public LineReader(InputStream stream)
stream - input stream from which to read the lines.| Method Detail |
public byte[] getBuffer()
public int getBufferLength()
public int getBufferOffset()
public InputStream getStream()
public int lengthUnreadData()
0 before the first
invocation of readLine().
0 if
readLine() has not yet been invoked.readLine()
public byte[] readLine()
throws IOException
Invoke this method to read bytes from the input stream until encountering a carriage-return line-feed pair marking the end of a line. The CRLF pair is stripped out of the stream, and not returned.
Note: This method will also attempt to properly build the stream even if it only streams a LF or a CR. For example, if the inputStream only provides an LF instead of CRLF for line endings this will not crash the method. Again, it will not return the LF or CR characters.
IOException - If an I/O error occurs.EOFException - If the end of the stream has been reached.public void setBufferLength(int bufferLength)
bufferLength - New length for the underlying line buffer.public void setBufferOffset(int bufferOffset)
bufferOffset - New read/write position.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2008 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.