← 返回首页
ByteArrayOutputStream (Java SE 26 & JDK 26)
JavaScript is disabled on your browser.
Contents  
  1. Description
  2. Field Summary
  3. Constructor Summary
  4. Method Summary
    1. Methods declared in class OutputStream
    2. Methods declared in class Object
  5. Field Details
    1. buf
    2. count
  6. Constructor Details
    1. ByteArrayOutputStream()
    2. ByteArrayOutputStream(int)
  7. Method Details
    1. write(int)
    2. write(byte[], int, int)
    3. writeBytes(byte[])
    4. writeTo(OutputStream)
    5. reset()
    6. toByteArray()
    7. size()
    8. toString()
    9. toString(String)
    10. toString(Charset)
    11. toString(int)
    12. close()
Hide sidebar  Show sidebar

Class ByteArrayOutputStream

java.lang.Object
java.io.OutputStream
java.io.ByteArrayOutputStream
All Implemented Interfaces: Closeable, Flushable, AutoCloseable
public class ByteArrayOutputStream extends OutputStream
This class implements an output stream in which the data is written into a byte array. The buffer automatically grows as data is written to it. The data can be retrieved using toByteArray() and toString().

Closing a ByteArrayOutputStream has no effect. The methods in this class can be called after the stream has been closed without generating an IOException.

Since: 1.0

Scripting on this page tracks web page traffic, but does not change the content in any way.