net.sf.mmm.util.io.api
Interface ByteIterator

All Known Subinterfaces:
ByteArrayBuffer, ByteBuffer, ComposedByteBuffer, DetectorStreamBuffer, ProcessableByteArrayBuffer
All Known Implementing Classes:
AbstractByteArrayBufferBuffer, ByteArrayBufferBuffer, ByteArrayBufferImpl, DetectorStreamBufferImpl, LookaheadByteArrayBufferBuffer

public interface ByteIterator

This is the interface for an Iterator of byte -values.

Since:
1.0.1
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Method Summary
 boolean hasNext()
          This method determines if there is a next byte available.
 byte next()
          This method gets the current byte in the iteration.
 byte peek()
          This method gets the current byte in the iteration.
 long skip(long byteCount)
          This method skips the number of bytes given by byteCount.
 

Method Detail

hasNext

boolean hasNext()
This method determines if there is a next byte available.

Returns:
true if there is a next byte available, false otherwise (if the end of this buffer has been reached).

next

byte next()
          throws NoSuchElementException
This method gets the current byte in the iteration. After the call of this method this ByteIterator points to the next byte in the iteration or to the end if there is no such byte available.
ATTENTION:
You should only call this method if hasNext() returns true.

Returns:
the current byte in the iteration.
Throws:
NoSuchElementException - if there is no such byte available.
See Also:
Iterator.next()

peek

byte peek()
          throws NoSuchElementException
This method gets the current byte in the iteration. Unlike next() this method does NOT modify the state of this ByteIterator. Therefore the peeked byte does NOT get consumed and repetitive calls will return the same value.
ATTENTION:
You should only call this method if hasNext() returns true.

Returns:
the current byte in the iteration.
Throws:
NoSuchElementException - if there is no such byte available.
See Also:
next()

skip

long skip(long byteCount)
This method skips the number of bytes given by byteCount.

Parameters:
byteCount - is the expected number of bytes to skip.
Returns:
the number of bytes that have actually been skipped. This will typically be equal to 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.
See Also:
InputStream.skip(long)


Copyright © 2001-2010 mmm-Team. All Rights Reserved.