Package io.airlift.slice
Class ChunkedSliceInput
java.lang.Object
java.io.InputStream
io.airlift.slice.SliceInput
io.airlift.slice.FixedLengthSliceInput
io.airlift.slice.ChunkedSliceInput
- All Implemented Interfaces:
Closeable,DataInput,AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interface -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of bytes that can be read without blocking.voidclose()voidensureAvailable(int size) longApproximate number of bytes retained by this instance.booleanReturnstrueif and only ifavailable()is greater than0.longlength()Gets the total size of this input stream.longposition()Returns thepositionof this buffer.intread()intread(byte[] destination, int destinationIndex, int length) booleanReturns true if the byte at the currentpositionis not0and increases thepositionby1in this buffer.bytereadByte()Gets a byte at the currentpositionand increases thepositionby1in this buffer.voidreadBytes(byte[] destination, int destinationIndex, int length) Transfers this buffer's data to the specified destination starting at the currentpositionand increases thepositionby the number of the transferred bytes (=length).voidTransfers this buffer's data to the specified destination starting at the currentpositionand increases thepositionby the number of the transferred bytes (=length).voidreadBytes(OutputStream out, int length) Transfers this buffer's data to the specified stream starting at the currentposition.doubleGets a 64-bit double at the currentpositionand increases thepositionby8in this buffer.voidreadDoubles(double[] destination, int destinationIndex, int length) Transfers this buffer's data to the specified destination starting at the currentpositionand increases thepositionby the number of the transferred doubles (=length).floatGets a 32-bit float at the currentpositionand increases thepositionby4in this buffer.voidreadFloats(float[] destination, int destinationIndex, int length) Transfers this buffer's data to the specified destination starting at the currentpositionand increases thepositionby the number of the transferred floats (=length).intreadInt()Gets a 32-bit integer at the currentpositionand increases thepositionby4in this buffer.voidreadInts(int[] destination, int destinationIndex, int length) Transfers this buffer's data to the specified destination starting at the currentpositionand increases thepositionby the number of the transferred ints (=length).longreadLong()Gets a 64-bit long at the currentpositionand increases thepositionby8in this buffer.voidreadLongs(long[] destination, int destinationIndex, int length) Transfers this buffer's data to the specified destination starting at the currentpositionand increases thepositionby the number of the transferred longs (=length).shortGets a 16-bit short integer at the currentpositionand increases thepositionby2in this buffer.voidreadShorts(short[] destination, int destinationIndex, int length) Transfers this buffer's data to the specified destination starting at the currentpositionand increases thepositionby the number of the transferred shorts (=length).readSlice(int length) Returns a new slice of this buffer's sub-region starting at the currentpositionand increases thepositionby the size of the new slice (=length).intGets an unsigned byte at the currentpositionand increases thepositionby1in this buffer.intGets an unsigned 16-bit short integer at the currentpositionand increases thepositionby2in this buffer.voidsetPosition(long position) Sets thepositionof this buffer.longskip(long length) intskipBytes(int length) toString()Methods inherited from class io.airlift.slice.FixedLengthSliceInput
remainingMethods inherited from class io.airlift.slice.SliceInput
mark, markSupported, read, readBytes, readBytes, readBytes, readChar, readDoubles, readFloats, readFully, readFully, readInts, readLine, readLongs, readShorts, readUnsignedInt, readUTF, resetMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
ChunkedSliceInput
-
-
Method Details
-
length
public long length()Description copied from class:FixedLengthSliceInputGets the total size of this input stream.- Specified by:
lengthin classFixedLengthSliceInput
-
position
public long position()Description copied from class:SliceInputReturns thepositionof this buffer.- Specified by:
positionin classSliceInput
-
setPosition
public void setPosition(long position) Description copied from class:SliceInputSets thepositionof this buffer.- Specified by:
setPositionin classSliceInput
-
isReadable
public boolean isReadable()Description copied from class:SliceInputReturnstrueif and only ifavailable()is greater than0.- Specified by:
isReadablein classSliceInput
-
available
public int available()Description copied from class:SliceInputReturns the number of bytes that can be read without blocking.- Specified by:
availablein classSliceInput
-
ensureAvailable
public void ensureAvailable(int size) -
readBoolean
public boolean readBoolean()Description copied from class:SliceInputReturns true if the byte at the currentpositionis not0and increases thepositionby1in this buffer.- Specified by:
readBooleanin interfaceDataInput- Specified by:
readBooleanin classSliceInput
-
read
public int read()- Specified by:
readin classSliceInput
-
readByte
public byte readByte()Description copied from class:SliceInputGets a byte at the currentpositionand increases thepositionby1in this buffer.- Specified by:
readBytein interfaceDataInput- Specified by:
readBytein classSliceInput
-
readUnsignedByte
public int readUnsignedByte()Description copied from class:SliceInputGets an unsigned byte at the currentpositionand increases thepositionby1in this buffer.- Specified by:
readUnsignedBytein interfaceDataInput- Specified by:
readUnsignedBytein classSliceInput
-
readShort
public short readShort()Description copied from class:SliceInputGets a 16-bit short integer at the currentpositionand increases thepositionby2in this buffer.- Specified by:
readShortin interfaceDataInput- Specified by:
readShortin classSliceInput
-
readUnsignedShort
public int readUnsignedShort()Description copied from class:SliceInputGets an unsigned 16-bit short integer at the currentpositionand increases thepositionby2in this buffer.- Specified by:
readUnsignedShortin interfaceDataInput- Specified by:
readUnsignedShortin classSliceInput
-
readInt
public int readInt()Description copied from class:SliceInputGets a 32-bit integer at the currentpositionand increases thepositionby4in this buffer.- Specified by:
readIntin interfaceDataInput- Specified by:
readIntin classSliceInput
-
readLong
public long readLong()Description copied from class:SliceInputGets a 64-bit long at the currentpositionand increases thepositionby8in this buffer.- Specified by:
readLongin interfaceDataInput- Specified by:
readLongin classSliceInput
-
readFloat
public float readFloat()Description copied from class:SliceInputGets a 32-bit float at the currentpositionand increases thepositionby4in this buffer.- Specified by:
readFloatin interfaceDataInput- Specified by:
readFloatin classSliceInput
-
readDouble
public double readDouble()Description copied from class:SliceInputGets a 64-bit double at the currentpositionand increases thepositionby8in this buffer.- Specified by:
readDoublein interfaceDataInput- Specified by:
readDoublein classSliceInput
-
readSlice
Description copied from class:SliceInputReturns a new slice of this buffer's sub-region starting at the currentpositionand increases thepositionby the size of the new slice (=length). The new slice could be either COMPACT or NOT_COMPACT.- Specified by:
readSlicein classSliceInput- Parameters:
length- the size of the new slice- Returns:
- the newly created slice
-
readBytes
Description copied from class:SliceInputTransfers this buffer's data to the specified destination starting at the currentpositionand increases thepositionby the number of the transferred bytes (=length).- Specified by:
readBytesin classSliceInputdestinationIndex- the first index of the destinationlength- the number of bytes to transfer
-
read
public int read(byte[] destination, int destinationIndex, int length) - Specified by:
readin classSliceInput
-
readBytes
public void readBytes(byte[] destination, int destinationIndex, int length) Description copied from class:SliceInputTransfers this buffer's data to the specified destination starting at the currentpositionand increases thepositionby the number of the transferred bytes (=length).- Specified by:
readBytesin classSliceInputdestinationIndex- the first index of the destinationlength- the number of bytes to transfer
-
readBytes
Description copied from class:SliceInputTransfers this buffer's data to the specified stream starting at the currentposition.- Specified by:
readBytesin classSliceInputlength- the number of bytes to transfer- Throws:
IOException- if the specified stream threw an exception during I/O
-
readShorts
public void readShorts(short[] destination, int destinationIndex, int length) Description copied from class:SliceInputTransfers this buffer's data to the specified destination starting at the currentpositionand increases thepositionby the number of the transferred shorts (=length).- Specified by:
readShortsin classSliceInputdestinationIndex- the first index of the destinationlength- the number of shorts to transfer
-
readInts
public void readInts(int[] destination, int destinationIndex, int length) Description copied from class:SliceInputTransfers this buffer's data to the specified destination starting at the currentpositionand increases thepositionby the number of the transferred ints (=length).- Specified by:
readIntsin classSliceInputdestinationIndex- the first index of the destinationlength- the number of ints to transfer
-
readLongs
public void readLongs(long[] destination, int destinationIndex, int length) Description copied from class:SliceInputTransfers this buffer's data to the specified destination starting at the currentpositionand increases thepositionby the number of the transferred longs (=length).- Specified by:
readLongsin classSliceInputdestinationIndex- the first index of the destinationlength- the number of longs to transfer
-
readFloats
public void readFloats(float[] destination, int destinationIndex, int length) Description copied from class:SliceInputTransfers this buffer's data to the specified destination starting at the currentpositionand increases thepositionby the number of the transferred floats (=length).- Specified by:
readFloatsin classSliceInputdestinationIndex- the first index of the destinationlength- the number of floats to transfer
-
readDoubles
public void readDoubles(double[] destination, int destinationIndex, int length) Description copied from class:SliceInputTransfers this buffer's data to the specified destination starting at the currentpositionand increases thepositionby the number of the transferred doubles (=length).- Specified by:
readDoublesin classSliceInputdestinationIndex- the first index of the destinationlength- the number of doubles to transfer
-
skip
public long skip(long length) - Specified by:
skipin classSliceInput
-
skipBytes
public int skipBytes(int length) - Specified by:
skipBytesin interfaceDataInput- Specified by:
skipBytesin classSliceInput
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classSliceInput
-
getRetainedSize
public long getRetainedSize()Description copied from class:SliceInputApproximate number of bytes retained by this instance.- Specified by:
getRetainedSizein classSliceInput
-
toString
-