@InterfaceAudience.Private public class ByteArrayOutputStream extends OutputStream
| Constructor and Description |
|---|
ByteArrayOutputStream() |
ByteArrayOutputStream(int capacity) |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getBuffer() |
void |
reset()
Resets the
pos field of this byte array output stream to zero. |
int |
size() |
byte[] |
toByteArray()
Copies the content of this Stream into a new byte array.
|
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
void |
writeInt(int i)
Writes an
int to the underlying output stream as four
bytes, high byte first. |
close, flush, writepublic ByteArrayOutputStream()
public ByteArrayOutputStream(int capacity)
public void writeInt(int i)
throws IOException
int to the underlying output stream as four
bytes, high byte first.i - the int to writeIOException - if an I/O error occurs.public void write(int b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
write in class OutputStreamIOExceptionpublic void reset()
pos field of this byte array output stream to zero.
The output stream can be used again.public byte[] toByteArray()
public byte[] getBuffer()
public int size()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.