Class ByteArrayOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.github.shyiko.mysql.binlog.io.ByteArrayOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class ByteArrayOutputStream extends OutputStream
- Author:
- Stanley Shyiko
-
-
Constructor Summary
Constructors Constructor Description ByteArrayOutputStream()ByteArrayOutputStream(OutputStream outputStream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()byte[]toByteArray()voidwrite(byte[] bytes)voidwrite(int b)voidwriteInteger(int value, int length)Write int in little-endian format.voidwriteLong(long value, int length)Write long in little-endian format.voidwriteString(String value)voidwriteZeroTerminatedString(String value)-
Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
-
-
-
Constructor Detail
-
ByteArrayOutputStream
public ByteArrayOutputStream()
-
ByteArrayOutputStream
public ByteArrayOutputStream(OutputStream outputStream)
-
-
Method Detail
-
writeInteger
public void writeInteger(int value, int length) throws IOExceptionWrite int in little-endian format.- Parameters:
value- integer to writelength- length in bytes of the integer- Throws:
IOException- on underlying stream error
-
writeLong
public void writeLong(long value, int length) throws IOExceptionWrite long in little-endian format.- Parameters:
value- long to writelength- length in bytes of the long- Throws:
IOException- on underlying stream error
-
writeString
public void writeString(String value) throws IOException
- Throws:
IOException
-
writeZeroTerminatedString
public void writeZeroTerminatedString(String value) throws IOException
- Parameters:
value- string to write- Throws:
IOException- on underlying stream error- See Also:
ByteArrayInputStream.readZeroTerminatedString()
-
write
public void write(int b) throws IOException- Specified by:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] bytes) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
toByteArray
public byte[] toByteArray()
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
-