public abstract class BufferedOutput extends OutputStream implements ObjectOutput
null
.
Modifier and Type | Field and Description |
---|---|
protected byte[] |
buffer |
protected static byte[] |
EMPTY_BYTE_ARRAY |
protected int |
limit |
protected int |
position |
Modifier | Constructor and Description |
---|---|
protected |
BufferedOutput()
Creates new instance with empty buffer.
|
Modifier and Type | Method and Description |
---|---|
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 ). |
close, flush
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, flush
protected static final byte[] EMPTY_BYTE_ARRAY
protected byte[] buffer
protected int position
protected int limit
protected BufferedOutput()
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 writtenIOException
- 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 writtenIOException
- 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 writtenIOException
- 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 writtenUTFDataFormatException
- if codePoint is not a valid Unicode characterIOException
- 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 writtenUTFDataFormatException
- if str is too longIOException
- if an I/O error occursCopyright © 2014 Devexperts. All Rights Reserved.