Closeable, Flushable, AutoCloseablepublic final class ByteOutputStream extends OutputStream
BufferedOutputStream.
Compared to BufferedOutputStream,
this class:
| Modifier and Type | Field | Description |
|---|---|---|
protected byte[] |
buf |
The buffer where data is stored.
|
protected int |
count |
The number of valid bytes in the buffer.
|
| Constructor | Description |
|---|---|
ByteOutputStream() |
|
ByteOutputStream(int size) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
|
byte[] |
getBytes() |
|
int |
getCount() |
|
ByteInputStream |
newInputStream() |
|
void |
reset() |
|
int |
size() |
|
byte[] |
toByteArray() |
Deprecated.
because this is evil!
|
String |
toString() |
Converts the buffer's contents into a string, translating bytes into
characters according to the platform's default character encoding.
|
void |
write(byte[] b) |
|
void |
write(byte[] b,
int off,
int len) |
|
void |
write(int b) |
|
void |
write(InputStream in) |
Copies all the bytes from this input into this buffer.
|
void |
writeAsAscii(String s) |
Writes a string as ASCII string.
|
void |
writeTo(OutputStream out) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitflushprotected byte[] buf
protected int count
public ByteOutputStream()
public ByteOutputStream(int size)
public void write(InputStream in) throws IOException
in - input stream.IOException - in case of an I/O error.public void write(int b)
write in class OutputStreampublic void write(byte[] b,
int off,
int len)
write in class OutputStreampublic void write(byte[] b)
write in class OutputStreampublic void writeAsAscii(String s)
s - string to write.public void writeTo(OutputStream out) throws IOException
IOExceptionpublic void reset()
@Deprecated public byte[] toByteArray()
public int size()
public ByteInputStream newInputStream()
public String toString()
public void close()
close in interface AutoCloseableclose in interface Closeableclose in class OutputStreampublic byte[] getBytes()
public int getCount()
Copyright © 2018 Oracle. All rights reserved.