Class ByteBufferWriteOutBytes
java.lang.Object
java.io.OutputStream
org.apache.druid.segment.writeout.WriteOutBytes
org.apache.druid.segment.writeout.ByteBufferWriteOutBytes
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,Channel,WritableByteChannel
- Direct Known Subclasses:
HeapByteBufferWriteOutBytes
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ByteBufferCreates a finiteInputStreamwith the bytes that are written to this WriteOutBytes so far.voidfree()booleanisOpen()voidreadFully(long pos, ByteBuffer buffer) Reads bytes from the byte sequences, represented by this WriteOutBytes, at the random position, into the given buffer.longsize()Returns the number of bytes written to this WriteOutBytes so far.voidwrite(byte[] b) voidwrite(byte[] b, int off, int len) voidwrite(int b) intwrite(ByteBuffer src) voidwriteInt(int v) Writes 4 bytes of the given value in big-endian order, i.voidwriteTo(ByteBuffer out) Takes all bytes that are written to this WriteOutBytes so far and writes them into the given ByteBuffer.voidwriteTo(WritableByteChannel channel) Takes all bytes that are written to this WriteOutBytes so far and writes them into the given channel.Methods inherited from class org.apache.druid.segment.writeout.WriteOutBytes
closeMethods inherited from class java.io.OutputStream
flush, nullOutputStream
-
Method Details
-
size
public long size()Description copied from class:WriteOutBytesReturns the number of bytes written to this WriteOutBytes so far.- Specified by:
sizein classWriteOutBytes
-
allocateBuffer
-
write
public void write(int b) - Specified by:
writein classOutputStream
-
writeInt
public void writeInt(int v) Description copied from class:WriteOutBytesWrites 4 bytes of the given value in big-endian order, i. e. similar toDataOutput.writeInt(int).- Specified by:
writeIntin classWriteOutBytes
-
write
public void write(byte[] b) - Overrides:
writein classOutputStream
-
write
public void write(byte[] b, int off, int len) - Overrides:
writein classWriteOutBytes
-
write
-
writeTo
Description copied from class:WriteOutBytesTakes all bytes that are written to this WriteOutBytes so far and writes them into the given channel.- Specified by:
writeToin classWriteOutBytes- Throws:
IOException
-
writeTo
Takes all bytes that are written to this WriteOutBytes so far and writes them into the given ByteBuffer. This method changes the position of the out buffer by thesize()of this WriteOutBytes.- Throws:
BufferOverflowException- if theBuffer.remaining()capacity of the given buffer is smaller than the size of this WriteOutBytes
-
readFully
Description copied from class:WriteOutBytesReads bytes from the byte sequences, represented by this WriteOutBytes, at the random position, into the given buffer.- Specified by:
readFullyin classWriteOutBytes
-
asInputStream
Description copied from class:WriteOutBytesCreates a finiteInputStreamwith the bytes that are written to this WriteOutBytes so far. The returned InputStream must be closed properly after it's used up.- Specified by:
asInputStreamin classWriteOutBytes- Throws:
IOException
-
isOpen
public boolean isOpen() -
free
public void free()
-