Interface DataUtil.IteratorWithNumBytes<T>
-
- Type Parameters:
T
- the type of decoded object
- All Superinterfaces:
java.util.Iterator<T>
- All Known Implementing Classes:
DataUtil.InputStreamIterator
- Enclosing class:
- DataUtil
public static interface DataUtil.IteratorWithNumBytes<T> extends java.util.Iterator<T>
Iterator
with interface to access to the number of bytes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
DataUtil.IteratorWithNumBytes.NumBytesNotSupportedException
Exception indicatesgetNumSerializedBytes()
orgetNumEncodedBytes()
is not supported.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description long
getCurrNumEncodedBytes()
This method can be called before the every actual data completely taken from iterator, When the every actual data completely taken from iterator, its return value must be same with a return value of getNumSerializedBytes().long
getCurrNumSerializedBytes()
This method can be called before the every actual data completely taken from iterator, When the every actual data completely taken from iterator, its return value must be same with a return value of getNumSerializedBytes().long
getNumEncodedBytes()
This method should be called after the actual data is taken out of iterator, since the existence of an iterator does not guarantee that data inside it is ready.long
getNumSerializedBytes()
This method should be called after the actual data is taken out of iterator, since the existence of an iterator does not guarantee that data inside it is ready.boolean
isReadNotSerializedData()
static <E> DataUtil.IteratorWithNumBytes<E>
of(java.util.Iterator<E> innerIterator)
Create anDataUtil.IteratorWithNumBytes
, with no information about the number of bytes.static <E> DataUtil.IteratorWithNumBytes<E>
of(java.util.Iterator<E> innerIterator, long numSerializedBytes, long numEncodedBytes)
Create anDataUtil.IteratorWithNumBytes
, with the number of bytes in decoded and serialized form.
-
-
-
Method Detail
-
of
static <E> DataUtil.IteratorWithNumBytes<E> of(java.util.Iterator<E> innerIterator)
Create anDataUtil.IteratorWithNumBytes
, with no information about the number of bytes.- Type Parameters:
E
- the type of decoded object- Parameters:
innerIterator
-Iterator
to wrap- Returns:
- an
DataUtil.IteratorWithNumBytes
, with no information about the number of bytes
-
of
static <E> DataUtil.IteratorWithNumBytes<E> of(java.util.Iterator<E> innerIterator, long numSerializedBytes, long numEncodedBytes)
Create anDataUtil.IteratorWithNumBytes
, with the number of bytes in decoded and serialized form.- Type Parameters:
E
- the type of decoded object- Parameters:
innerIterator
-Iterator
to wrapnumSerializedBytes
- the number of bytes in serialized formnumEncodedBytes
- the number of bytes in encoded form- Returns:
- an
DataUtil.IteratorWithNumBytes
, with the information about the number of bytes
-
getNumSerializedBytes
long getNumSerializedBytes() throws DataUtil.IteratorWithNumBytes.NumBytesNotSupportedException
This method should be called after the actual data is taken out of iterator, since the existence of an iterator does not guarantee that data inside it is ready.- Returns:
- the number of bytes in serialized form (which is, for example, encoded and compressed)
- Throws:
DataUtil.IteratorWithNumBytes.NumBytesNotSupportedException
- when the operation is not supportedjava.lang.IllegalStateException
- when the information is not ready
-
getCurrNumSerializedBytes
long getCurrNumSerializedBytes() throws DataUtil.IteratorWithNumBytes.NumBytesNotSupportedException
This method can be called before the every actual data completely taken from iterator, When the every actual data completely taken from iterator, its return value must be same with a return value of getNumSerializedBytes().- Returns:
- the number of currently read bytes in serialized form (which is, for example, encoded and compressed)
- Throws:
DataUtil.IteratorWithNumBytes.NumBytesNotSupportedException
- when the operation is not supportedjava.lang.IllegalStateException
- when the information is not ready
-
getNumEncodedBytes
long getNumEncodedBytes() throws DataUtil.IteratorWithNumBytes.NumBytesNotSupportedException
This method should be called after the actual data is taken out of iterator, since the existence of an iterator does not guarantee that data inside it is ready.- Returns:
- the number of bytes in encoded form (which is ready to be decoded)
- Throws:
DataUtil.IteratorWithNumBytes.NumBytesNotSupportedException
- when the operation is not supportedjava.lang.IllegalStateException
- when the information is not ready
-
getCurrNumEncodedBytes
long getCurrNumEncodedBytes() throws DataUtil.IteratorWithNumBytes.NumBytesNotSupportedException
This method can be called before the every actual data completely taken from iterator, When the every actual data completely taken from iterator, its return value must be same with a return value of getNumSerializedBytes().- Returns:
- the number of bytes in encoded form (which is ready to be decoded)
- Throws:
DataUtil.IteratorWithNumBytes.NumBytesNotSupportedException
- when the operation is not supportedjava.lang.IllegalStateException
- when the information is not ready
-
isReadNotSerializedData
boolean isReadNotSerializedData()
-
-