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

    Constructors
    Constructor
    Description
    ByteStorage(int size)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    long
    getPayloadSize(int sPos, int ePos)
    computes the size of the payload from sPos to ePos (inclusive)
    boolean
     
    long
     
    void
    write(@org.jetbrains.annotations.NotNull byte[] b, int off, int len)
    Writes len bytes from the specified byte array starting at offset off to the underlying ByteChunk.
    void
    write(int b)
    Writes the specified byte to the underlying ByteChunk.
    long
    writePayload(com.google.common.io.LittleEndianDataOutputStream dos, int sPos, int ePos)
    write payload from sPos to ePos (inclusive) to the output stream

    Methods inherited from class java.io.OutputStream

    flush, nullOutputStream, write

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ByteStorage

      public ByteStorage(int size)
  • Method Details

    • isEmpty

      public boolean isEmpty()
    • write

      public void write(int b) throws IOException
      Writes the specified byte to the underlying ByteChunk.
      Specified by:
      write in class OutputStream
      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
      Writes len bytes from the specified byte array starting at offset off to the underlying ByteChunk.
      Overrides:
      write in class OutputStream
      Parameters:
      b - the data.
      off - the start offset in the data.
      len - the number of bytes to write.
      Throws:
      IndexOutOfBoundsException - if off is negative, len is negative, or len is greater than b.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 payload
      ePos - 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 data
      sPos - the first data item to include in this payload
      ePos - 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 interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface SafeCloseable
      Overrides:
      close in class OutputStream