|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.mmm.util.io.impl.AbstractByteArrayBufferBuffer
net.sf.mmm.util.io.impl.LookaheadByteArrayBufferBuffer
public class LookaheadByteArrayBufferBuffer
This class is a byte
-Buffer that represents the concatenation of
multiple ByteArrayBufferImpl
s. The resulting
LookaheadByteArrayBufferBuffer
has its own state and does NOT modify
a contained ByteArrayBufferImpl
.
ATTENTION:
This class is NOT intended to be exposed. It should only be used internally
by some class or component.
Field Summary | |
---|---|
private AbstractByteArrayBufferBuffer |
master
The master buffer adapted by this buffer. |
Constructor Summary | |
---|---|
LookaheadByteArrayBufferBuffer(AbstractByteArrayBufferBuffer master)
The constructor. |
Method Summary | |
---|---|
protected boolean |
fill(InputStream inputStream)
This method fills this buffer using the given inputStream . |
boolean |
hasNext()
This method determines if there is a next byte available. |
byte |
next()
This method gets the current byte in the iteration. |
long |
process(ByteProcessor processor,
long byteCount)
This method processes the number of bytes given by length (as
far as available) using the given processor . |
long |
skip(long byteCount)
This method skips the number of bytes given by byteCount . |
Methods inherited from class net.sf.mmm.util.io.impl.AbstractByteArrayBufferBuffer |
---|
fill, getByteArray, getByteArrayCount, getBytesAvailable, getCurrentBuffer, getCurrentBufferIndex, nextBuffer, peek, sync |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final AbstractByteArrayBufferBuffer master
Constructor Detail |
---|
public LookaheadByteArrayBufferBuffer(AbstractByteArrayBufferBuffer master)
master
- is the master-buffer to copy for lookahead reads.Method Detail |
---|
public byte next() throws NoSuchElementException
ByteIterator
points to the next byte in the iteration
or to the end if there is no such byte available
.ByteIterator.hasNext()
returns
true
.
next
in interface ByteIterator
next
in class AbstractByteArrayBufferBuffer
NoSuchElementException
- if there is no such byte available
.Iterator.next()
public boolean hasNext()
next byte
available.
hasNext
in interface ByteIterator
hasNext
in class AbstractByteArrayBufferBuffer
true
if there is a next byte
available, false
otherwise (if the end of this buffer
has been reached).public long skip(long byteCount)
byteCount
.
skip
in interface ByteIterator
skip
in class AbstractByteArrayBufferBuffer
byteCount
- is the expected number of bytes to skip.
byteCount
. However the value may
be less if the end of this iterator has been reached before the
according number of bytes have been skipped. The value will always
be greater or equal to 0
.InputStream.skip(long)
public long process(ByteProcessor processor, long byteCount)
length
(as
far as available) using the given processor
.
process
in interface ByteProcessable
process
in class AbstractByteArrayBufferBuffer
processor
- is the ByteProcessor
called to process the bytes.
It may be called multiple types if the data is sliced into multiple
byte-arrays.byteCount
- is the desired number of bytes to process. The value has to
be greater or equal to 0
. A value of 0
will have no effect. If you want to process all available data to
the end of stream or buffer you may use Long.MAX_VALUE
.
length
this will typically be equal to
length
. However if the end of the data has been
reached, a smaller value is returned. The value will always be
greater or equal to 0
.protected boolean fill(InputStream inputStream) throws IOException
inputStream
. If
the buffer is already filled, this method will have no effect and return
false
.
fill
in class AbstractByteArrayBufferBuffer
inputStream
- is the InputStream
providing the data to fill
this buffer with.
true
if the end of the stream was encountered while
(re)filling this buffer, false
otherwise.
IOException
- if caused by the inputStream
whilst
reading.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |