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.
    • Method Detail

      • of

        static <E> DataUtil.IteratorWithNumBytes<E> of​(java.util.Iterator<E> innerIterator,
                                                       long numSerializedBytes,
                                                       long numEncodedBytes)
        Create an DataUtil.IteratorWithNumBytes, with the number of bytes in decoded and serialized form.
        Type Parameters:
        E - the type of decoded object
        Parameters:
        innerIterator - Iterator to wrap
        numSerializedBytes - the number of bytes in serialized form
        numEncodedBytes - the number of bytes in encoded form
        Returns:
        an DataUtil.IteratorWithNumBytes, with the information about the number of bytes
      • 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 supported
        java.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 supported
        java.lang.IllegalStateException - when the information is not ready
      • isReadNotSerializedData

        boolean isReadNotSerializedData()