Package com.emc.mongoose.base.item
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 Summary
Fields Modifier and Type Field Description static doubleLOG2
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcommitUpdatedRanges(java.util.BitSet[] updatingRangesMask)DataInputdataInput()voiddataInput(DataInput dataInput)booleanisRangeUpdated(int rangeIdx)booleanisUpdated()intlayer()voidlayer(int layerNum)longoffset()voidoffset(long offset)longposition()DataItemposition(long position)static intrangeCount(long size)static longrangeOffset(int i)longrangeSize(int rangeIdx)voidreset()voidsize(long size)<D extends DataItem>
Dslice(long from, long size)intupdatedRangesCount()voidverify(java.nio.ByteBuffer inBuff)<A> voidwriteToAsyncChannel(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 handlerlongwriteToFileChannel(java.nio.channels.FileChannel chanDst, long maxCount)longwriteToSocketChannel(java.nio.channels.WritableByteChannel chanDst, long maxCount)
-
-
-
Method Detail
-
dataInput
DataInput dataInput()
-
dataInput
void dataInput(DataInput dataInput)
-
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:
positionin interfacejava.nio.channels.SeekableByteChannel
-
position
DataItem position(long position)
- Specified by:
positionin interfacejava.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 writingjava.nio.channels.ClosedChannelException- If this channel is closedjava.nio.channels.AsynchronousCloseException- If another thread closes this channel while the write operation is in progressjava.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 statusjava.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
-
verify
void verify(java.nio.ByteBuffer inBuff) throws DataCorruptionException- Throws:
DataCorruptionException
-
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)
-
-