superwaba.ext.xplat.util.xml
Class StreamBuffer
java.lang.Object
|
+--superwaba.ext.xplat.util.xml.StreamBuffer
- Direct Known Subclasses:
- RecordsStreamBuffer
- public class StreamBuffer
- extends Object
A buffer that can be filled by a Stream.
This class is used by the LiteParser derivations for handling the
buffering from from a stream. Eventually it should be merged with the
superwaba.ext.xplat.io.BufferStream.
The buffer maintains a size, pos and mark indexes where
mark<=pos<=size<=buffer.length and 0<=pos.
Data in the buffer after the pos or after mark (if set) is preserved in
during a fill and moved to the start of the buffer.
Field Summary |
byte[] |
buffer
The data buffer for bytes read from the stream |
int |
mark
Starting position of unconsumed data in the buffer |
int |
pos
Current parsing position within the buffer |
int |
size
Current length of the content in the buffer |
Stream |
stream
The stream to be buffered |
Method Summary |
int |
fill()
Save unconsumed data and fill the remainder of the buffer. |
stream
public Stream stream
- The stream to be buffered
buffer
public byte[] buffer
- The data buffer for bytes read from the stream
size
public int size
- Current length of the content in the buffer
pos
public int pos
- Current parsing position within the buffer
mark
public int mark
- Starting position of unconsumed data in the buffer
StreamBuffer
public StreamBuffer(Stream stream,
int size)
fill
public int fill()
- Save unconsumed data and fill the remainder of the buffer.
- Returns:
- The number of bytes written.