- java.lang.Object
-
- java.io.OutputStream
-
- org.hsqldb.lib.HsqlByteArrayOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.DataOutput
,java.io.Flushable
,java.lang.AutoCloseable
public class HsqlByteArrayOutputStream extends java.io.OutputStream implements java.io.DataOutput
This class is a replacement for both java.io.ByteArrayOuputStream (without synchronization) and java.io.DataOutputStream- Since:
- 1.7.0
- Author:
- Fred Toussi (fredt@users dot sourceforge.net)
-
-
Constructor Summary
Constructors Constructor Description HsqlByteArrayOutputStream()
HsqlByteArrayOutputStream(byte[] buffer)
HsqlByteArrayOutputStream(int size)
HsqlByteArrayOutputStream(java.io.InputStream input)
HsqlByteArrayOutputStream(java.io.InputStream input, int length)
Constructor from an InputStream limits size to the length argument.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
ensureRoom(int extra)
void
fill(int b, int len)
void
flush()
does nothingbyte[]
getBuffer()
void
reset()
void
reset(byte[] buffer)
void
reset(int newSize)
void
setPosition(int newPos)
void
setSize(int size)
size must fit in bufferint
size()
byte[]
toByteArray()
java.lang.String
toString()
java.lang.String
toString(java.lang.String enc)
void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(char[] c, int off, int len)
void
write(int b)
int
write(java.io.InputStream input, int countLimit)
int
write(java.io.Reader input, int countLimit)
void
writeBoolean(boolean v)
void
writeByte(int v)
void
writeBytes(java.lang.String s)
void
writeChar(int v)
void
writeChars(char[] charArray)
void
writeChars(java.lang.String s)
void
writeDouble(double v)
void
writeFloat(float v)
void
writeInt(int v)
void
writeLong(long v)
void
writeNoCheck(int b)
void
writeShort(int v)
void
writeTo(java.io.OutputStream out)
void
writeUTF(java.lang.String str)
-
-
-
Constructor Detail
-
HsqlByteArrayOutputStream
public HsqlByteArrayOutputStream()
-
HsqlByteArrayOutputStream
public HsqlByteArrayOutputStream(int size)
-
HsqlByteArrayOutputStream
public HsqlByteArrayOutputStream(byte[] buffer)
-
HsqlByteArrayOutputStream
public HsqlByteArrayOutputStream(java.io.InputStream input, int length) throws java.io.IOException
Constructor from an InputStream limits size to the length argument. Throws if the actual length of the InputStream is smaller than length value.- Parameters:
input
- InputStreamlength
- int- Throws:
java.io.IOException
- if an error occurs
-
HsqlByteArrayOutputStream
public HsqlByteArrayOutputStream(java.io.InputStream input) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
writeShort
public void writeShort(int v)
- Specified by:
writeShort
in interfacejava.io.DataOutput
-
writeInt
public void writeInt(int v)
- Specified by:
writeInt
in interfacejava.io.DataOutput
-
writeLong
public void writeLong(long v)
- Specified by:
writeLong
in interfacejava.io.DataOutput
-
writeBytes
public void writeBytes(java.lang.String s)
- Specified by:
writeBytes
in interfacejava.io.DataOutput
-
writeFloat
public final void writeFloat(float v)
- Specified by:
writeFloat
in interfacejava.io.DataOutput
-
writeDouble
public final void writeDouble(double v)
- Specified by:
writeDouble
in interfacejava.io.DataOutput
-
writeBoolean
public void writeBoolean(boolean v)
- Specified by:
writeBoolean
in interfacejava.io.DataOutput
-
writeByte
public void writeByte(int v)
- Specified by:
writeByte
in interfacejava.io.DataOutput
-
writeChar
public void writeChar(int v)
- Specified by:
writeChar
in interfacejava.io.DataOutput
-
writeChars
public void writeChars(java.lang.String s)
- Specified by:
writeChars
in interfacejava.io.DataOutput
-
writeUTF
public void writeUTF(java.lang.String str) throws java.io.IOException
- Specified by:
writeUTF
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
flush
public void flush()
does nothing- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in classjava.io.OutputStream
-
write
public void write(int b)
- Specified by:
write
in interfacejava.io.DataOutput
- Specified by:
write
in classjava.io.OutputStream
-
write
public void write(byte[] b)
- Specified by:
write
in interfacejava.io.DataOutput
- Overrides:
write
in classjava.io.OutputStream
-
write
public void write(byte[] b, int off, int len)
- Specified by:
write
in interfacejava.io.DataOutput
- Overrides:
write
in classjava.io.OutputStream
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.OutputStream
-
writeNoCheck
public void writeNoCheck(int b)
-
writeChars
public void writeChars(char[] charArray)
-
write
public int write(java.io.InputStream input, int countLimit) throws java.io.IOException
- Throws:
java.io.IOException
-
write
public int write(java.io.Reader input, int countLimit) throws java.io.IOException
- Throws:
java.io.IOException
-
writeTo
public void writeTo(java.io.OutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
reset
public void reset()
-
toByteArray
public byte[] toByteArray()
-
size
public final int size()
-
setPosition
public void setPosition(int newPos)
-
toString
public java.lang.String toString(java.lang.String enc) throws java.io.UnsupportedEncodingException
- Throws:
java.io.UnsupportedEncodingException
-
write
public void write(char[] c, int off, int len)
-
fill
public void fill(int b, int len)
-
getBuffer
public byte[] getBuffer()
-
ensureRoom
public void ensureRoom(int extra)
-
reset
public void reset(int newSize)
-
reset
public void reset(byte[] buffer)
-
setSize
public void setSize(int size)
size must fit in buffer- Parameters:
size
- int
-
-