public class StringOutputStream
extends java.io.OutputStream
String
Modifier and Type | Field and Description |
---|---|
private java.io.ByteArrayOutputStream |
byteArrayOutputStream
Stream where write bytes
|
Constructor and Description |
---|
StringOutputStream()
Create a new instance of StringOutputStream
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the stream
Parent documentation: |
void |
flush()
Flush the last bytes
Parent documentation: |
java.lang.String |
getString()
The written read string
|
void |
write(byte[] b)
Write a byte array.
|
void |
write(byte[] b,
int off,
int len)
Write a part of byte array
Parent documentation: |
void |
write(int b)
Write one byte
Parent documentation: |
private final java.io.ByteArrayOutputStream byteArrayOutputStream
public StringOutputStream()
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException
- On closing issueOutputStream.close()
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
- On flushing issueOutputStream.flush()
public java.lang.String getString()
public void write(byte[] b) throws java.io.IOException
write
in class java.io.OutputStream
b
- Array to writejava.io.IOException
- On writing issueOutputStream.write(byte[])
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
b
- Array to writeoff
- Offset to start reading the arraylen
- Number of bytes to writejava.io.IOException
- On writing issueOutputStream.write(byte[], int, int)
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
b
- Byte to writejava.io.IOException
- On writing issueOutputStream.write(int)