Package io.minio

Class ByteBuffer

All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class ByteBuffer extends OutputStream
OutputStream compatible byte buffer to store bytes to maximum 5GiB in size.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ByteBuffer(long size)
    Creates ByteBuffer for given size.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes this buffer and releases any system resources associated with the buffer.
    Returns this buffer as InputStream.
    long
    Returns the current length of bytes written to this buffer.
    void
    Resets this buffer to freshen up for reuse.
    long
    Returns the size of this buffer.
    void
    write(byte[] b)
    Writes b.length bytes from the specified byte array to this buffer.
    void
    write(byte[] b, int off, int len)
    Writes len bytes from the specified byte array starting at offset off to this buffer.
    void
    write(int b)
    Writes the specified byte to this buffer.

    Methods inherited from class java.io.OutputStream

    flush, nullOutputStream

    Methods inherited from class java.lang.Object

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

    • ByteBuffer

      public ByteBuffer(long size)
      Creates ByteBuffer for given size.
  • Method Details

    • write

      public void write(int b) throws IOException
      Writes the specified byte to this buffer.
      Specified by:
      write in class OutputStream
      Throws:
      IOException
    • write

      public void write(byte[] b, int off, int len) throws IOException
      Writes len bytes from the specified byte array starting at offset off to this buffer.
      Overrides:
      write in class OutputStream
      Throws:
      IOException
    • write

      public void write(byte[] b) throws IOException
      Writes b.length bytes from the specified byte array to this buffer.
      Overrides:
      write in class OutputStream
      Throws:
      IOException
    • length

      public long length()
      Returns the current length of bytes written to this buffer.
    • size

      public long size()
      Returns the size of this buffer.
    • reset

      public void reset() throws MinioException
      Resets this buffer to freshen up for reuse.
      Throws:
      MinioException
    • close

      public void close() throws IOException
      Closes this buffer and releases any system resources associated with the buffer.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class OutputStream
      Throws:
      IOException
    • inputStream

      public InputStream inputStream()
      Returns this buffer as InputStream.