|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
com.devexperts.io.BufferedOutput
public abstract class BufferedOutput
An efficient buffered implementation of data output API. It is attributed with underlying byte buffer, position and limit:
null
.
Field Summary | |
---|---|
protected byte[] |
buffer
|
protected static byte[] |
EMPTY_BYTE_ARRAY
|
protected int |
limit
|
protected int |
position
|
Constructor Summary | |
---|---|
protected |
BufferedOutput()
Creates new instance with empty buffer. |
Method Summary | |
---|---|
protected abstract void |
needSpace()
This method is invoked when output methods need more space to write data. |
void |
write(byte[] b)
|
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
void |
writeBoolean(boolean v)
|
void |
writeByte(int v)
|
void |
writeByteArray(byte[] bytes)
Writes an array of bytes in a compact encapsulation format. |
void |
writeBytes(String str)
|
void |
writeChar(int v)
|
void |
writeChars(String str)
|
void |
writeCompactInt(int v)
Writes an int value in a compact format (see IOUtil ). |
void |
writeCompactLong(long v)
Writes a long value in a compact format (see IOUtil ). |
void |
writeDouble(double v)
|
void |
writeFloat(float v)
|
void |
writeInt(int v)
|
void |
writeLong(long v)
|
void |
writeObject(Object obj)
|
void |
writeShort(int v)
|
void |
writeUTF(String str)
|
void |
writeUTFChar(int codePoint)
Writes a Unicode code point in a UTF-8 format. |
void |
writeUTFString(String str)
Writes a string in a UTF-8 format with compact encapsulation (see IOUtil ). |
Methods inherited from class java.io.OutputStream |
---|
close, flush |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.io.ObjectOutput |
---|
close, flush |
Field Detail |
---|
protected static final byte[] EMPTY_BYTE_ARRAY
protected byte[] buffer
protected int position
protected int limit
Constructor Detail |
---|
protected BufferedOutput()
Method Detail |
---|
protected abstract void needSpace() throws IOException
(position < limit)
is true or throw an exception. This method may block if needed.
This method is allowed to update buffer, position and limit fields as needed.
IOException
- if an I/O error occurspublic final void write(int b) throws IOException
write
in interface DataOutput
write
in interface ObjectOutput
write
in class OutputStream
IOException
public final void write(byte[] b) throws IOException
write
in interface DataOutput
write
in interface ObjectOutput
write
in class OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in interface DataOutput
write
in interface ObjectOutput
write
in class OutputStream
IOException
public final void writeBoolean(boolean v) throws IOException
writeBoolean
in interface DataOutput
IOException
public final void writeByte(int v) throws IOException
writeByte
in interface DataOutput
IOException
public final void writeShort(int v) throws IOException
writeShort
in interface DataOutput
IOException
public final void writeChar(int v) throws IOException
writeChar
in interface DataOutput
IOException
public final void writeInt(int v) throws IOException
writeInt
in interface DataOutput
IOException
public final void writeLong(long v) throws IOException
writeLong
in interface DataOutput
IOException
public final void writeFloat(float v) throws IOException
writeFloat
in interface DataOutput
IOException
public final void writeDouble(double v) throws IOException
writeDouble
in interface DataOutput
IOException
public final void writeBytes(String str) throws IOException
writeBytes
in interface DataOutput
IOException
public final void writeChars(String str) throws IOException
writeChars
in interface DataOutput
IOException
public final void writeUTF(String str) throws IOException
writeUTF
in interface DataOutput
IOException
public final void writeObject(Object obj) throws IOException
writeObject
in interface ObjectOutput
IOException
public final void writeCompactInt(int v) throws IOException
int
value in a compact format (see IOUtil
).
Equivalent to IOUtil.writeCompactInt(java.io.DataOutput, int)
method.
v
- the int
value to be written
IOException
- if an I/O error occurspublic final void writeCompactLong(long v) throws IOException
long
value in a compact format (see IOUtil
).
Equivalent to IOUtil.writeCompactLong(java.io.DataOutput, long)
method.
v
- the long
value to be written
IOException
- if an I/O error occurspublic final void writeByteArray(byte[] bytes) throws IOException
IOUtil.writeByteArray(java.io.DataOutput, byte[])
method.
bytes
- the byte array to be written
IOException
- if an I/O error occurspublic final void writeUTFChar(int codePoint) throws IOException
IOUtil.writeUTFChar(java.io.DataOutput, int)
method.
codePoint
- the code point to be written
UTFDataFormatException
- if codePoint is not a valid Unicode character
IOException
- if an I/O error occurspublic final void writeUTFString(String str) throws IOException
IOUtil
).
Unpaired surrogate code points are accepted and written in a CESU-8 format.
This method defines length as a number of bytes.
Equivalent to IOUtil.writeUTFString(java.io.DataOutput, java.lang.String)
method.
str
- the string to be written
UTFDataFormatException
- if str is too long
IOException
- if an I/O error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |