Class VarBinaryChunkInputStreamGenerator.ByteStorage
java.lang.Object
java.io.OutputStream
io.deephaven.extensions.barrage.chunk.VarBinaryChunkInputStreamGenerator.ByteStorage
- All Implemented Interfaces:
SafeCloseable
,Closeable
,Flushable
,AutoCloseable
- Enclosing class:
- VarBinaryChunkInputStreamGenerator<T>
public static class VarBinaryChunkInputStreamGenerator.ByteStorage
extends OutputStream
implements SafeCloseable
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
long
getPayloadSize
(int sPos, int ePos) computes the size of the payload from sPos to ePos (inclusive)boolean
isEmpty()
long
size()
void
write
(@org.jetbrains.annotations.NotNull byte[] b, int off, int len) Writeslen
bytes from the specified byte array starting at offsetoff
to the underlyingByteChunk
.void
write
(int b) Writes the specified byte to the underlyingByteChunk
.long
writePayload
(com.google.common.io.LittleEndianDataOutputStream dos, int sPos, int ePos) write payload from sPos to ePos (inclusive) to the output streamMethods inherited from class java.io.OutputStream
flush, nullOutputStream, write
-
Constructor Details
-
ByteStorage
public ByteStorage(int size)
-
-
Method Details
-
isEmpty
public boolean isEmpty() -
write
Writes the specified byte to the underlyingByteChunk
.- Specified by:
write
in classOutputStream
- Parameters:
b
- the byte to be written.- Throws:
IOException
-
write
public void write(@NotNull @org.jetbrains.annotations.NotNull byte[] b, int off, int len) throws IOException Writeslen
bytes from the specified byte array starting at offsetoff
to the underlyingByteChunk
.- Overrides:
write
in classOutputStream
- Parameters:
b
- the data.off
- the start offset in the data.len
- the number of bytes to write.- Throws:
IndexOutOfBoundsException
- ifoff
is negative,len
is negative, orlen
is greater thanb.length - off
IOException
-
size
public long size() -
getPayloadSize
public long getPayloadSize(int sPos, int ePos) computes the size of the payload from sPos to ePos (inclusive)- Parameters:
sPos
- the first data item to include in this payloadePos
- the last data item to include in this payload- Returns:
- number of bytes in the payload
-
writePayload
public long writePayload(com.google.common.io.LittleEndianDataOutputStream dos, int sPos, int ePos) throws IOException write payload from sPos to ePos (inclusive) to the output stream- Parameters:
dos
- the data output stream to populate with datasPos
- the first data item to include in this payloadePos
- the last data item to include in this payload- Returns:
- number of bytes written to the outputstream
- Throws:
IOException
- if there is a problem writing to the output stream
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceSafeCloseable
- Overrides:
close
in classOutputStream
-