All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

  • Field Summary

    Fields

    protected byte[]

    The buffer where data is stored.

    protected int

    The number of valid bytes in the buffer.

  • Constructor Summary

    Constructors

    Creates a new ByteArrayOutputStream.

    ByteArrayOutputStream(int size)

    Creates a new ByteArrayOutputStream, with a buffer capacity of the specified size, in bytes.

  • Method Summary

    void

    close()

    Closing a ByteArrayOutputStream has no effect.

    void

    reset()

    Resets the count field of this ByteArrayOutputStream to zero, so that all currently accumulated output in the output stream is discarded.

    int

    size()

    Returns the current size of the buffer.

    byte[]

    Creates a newly allocated byte array.

    toString()

    Converts the buffer's contents into a string decoding bytes using the default charset.

    toString(int hibyte)

    Converts the buffer's contents into a string by decoding the bytes using the named charset.

    Converts the buffer's contents into a string by decoding the bytes using the specified charset.

    void

    write(byte[] b, int off, int len)

    Writes len bytes from the specified byte array starting at offset off to this ByteArrayOutputStream.

    void

    write(int b)

    Writes the specified byte to this ByteArrayOutputStream.

    void

    writeBytes(byte[] b)

    Writes the complete contents of the specified byte array to this ByteArrayOutputStream.

    void

    Writes the complete contents of this ByteArrayOutputStream to the specified output stream argument, as if by calling the output stream's write method using out.write(buf, 0, count).

  • Field Details

    • buf

    • count

  • Constructor Details

    • ByteArrayOutputStream

    • ByteArrayOutputStream

  • Method Details

    • write

    • write

    • writeBytes

    • writeTo

    • reset

    • toByteArray

    • size

    • toString

    • toString

    • toString

    • toString

    • close