Interface DataItem

  • All Superinterfaces:
    java.lang.AutoCloseable, java.nio.channels.ByteChannel, java.nio.channels.Channel, java.io.Closeable, java.io.Externalizable, Item, java.nio.channels.ReadableByteChannel, java.nio.channels.SeekableByteChannel, java.io.Serializable, java.nio.channels.WritableByteChannel
    All Known Implementing Classes:
    DataItemImpl

    public interface DataItem
    extends Item, java.nio.channels.SeekableByteChannel
    Created by kurila on 11.07.16.
    • Field Detail

      • LOG2

        static final double LOG2
    • Method Detail

      • dataInput

        void dataInput​(DataInput dataInput)
      • reset

        void reset()
        Specified by:
        reset in interface Item
      • layer

        int layer()
      • layer

        void layer​(int layerNum)
      • size

        void size​(long size)
      • offset

        long offset()
      • offset

        void offset​(long offset)
      • position

        long position()
        Specified by:
        position in interface java.nio.channels.SeekableByteChannel
      • position

        DataItem position​(long position)
        Specified by:
        position in interface java.nio.channels.SeekableByteChannel
      • slice

        <D extends DataItem> D slice​(long from,
                                     long size)
      • writeToSocketChannel

        long writeToSocketChannel​(java.nio.channels.WritableByteChannel chanDst,
                                  long maxCount)
                           throws java.io.IOException
        Returns:
        The number of bytes written, possibly zero
        Throws:
        java.nio.channels.NonWritableChannelException - If this channel was not opened for writing
        java.nio.channels.ClosedChannelException - If this channel is closed
        java.nio.channels.AsynchronousCloseException - If another thread closes this channel while the write operation is in progress
        java.nio.channels.ClosedByInterruptException - If another thread interrupts the current thread while the write operation is in progress, thereby closing the channel and setting the current thread's interrupt status
        java.io.IOException - If some other I/O error occurs
      • writeToFileChannel

        long writeToFileChannel​(java.nio.channels.FileChannel chanDst,
                                long maxCount)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • writeToAsyncChannel

        <A> void writeToAsyncChannel​(AsyncChannel dstChan,
                                     long dstPos,
                                     long maxCount,
                                     A attach,
                                     java.nio.channels.CompletionHandler<java.lang.Integer,​? super A> handler)
        Warning: the data item's position should be updated by the handler
        Type Parameters:
        A -
        Parameters:
        dstChan -
        dstPos -
        maxCount -
        attach -
        handler - note that the handler should invoke {@link DataItem#position(long))} to set the new position for this
      • rangeCount

        static int rangeCount​(long size)
      • rangeOffset

        static long rangeOffset​(int i)
      • rangeSize

        long rangeSize​(int rangeIdx)
      • isUpdated

        boolean isUpdated()
      • isRangeUpdated

        boolean isRangeUpdated​(int rangeIdx)
      • updatedRangesCount

        int updatedRangesCount()
      • commitUpdatedRanges

        void commitUpdatedRanges​(java.util.BitSet[] updatingRangesMask)