public abstract class StreamOutput extends OutputStream
This class's methods are optimized so you can put the methods that read and write a class next to each other and you can scan them
visually for differences. That means that most variables should be read and written in a single line so even large objects fit both
reading and writing on the screen. It also means that the methods on this class are named very similarly to StreamInput. Finally
it means that the "barrier to entry" for adding new methods to this class is relatively low even though it is a shared class with code
everywhere. That being said, this class deals primarily with Lists rather than Arrays. For the most part calls should adapt to
lists, either by storing Lists internally or just converting to and from a List when calling. This comment is repeated
on StreamInput.
| 构造器和说明 |
|---|
StreamOutput() |
| 限定符和类型 | 方法和说明 |
|---|---|
abstract void |
close()
Closes this stream to further operations.
|
abstract void |
flush()
Forces any buffered output to be written.
|
abstract void |
reset() |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
void |
writeBoolean(boolean b) |
abstract void |
writeByte(byte b)
Writes a single byte.
|
void |
writeBytes(byte[] b)
Writes an array of bytes.
|
void |
writeBytes(byte[] b,
int length)
Writes an array of bytes.
|
abstract void |
writeBytes(byte[] b,
int offset,
int length)
Writes an array of bytes.
|
void |
writeDouble(double v) |
void |
writeFloat(float v) |
void |
writeGenericValue(Object value)
Notice: when serialization a map, the stream out map with the stream in map maybe have the
different key-value orders, they will maybe have different stream order.
|
void |
writeInt(int i)
Writes an int as four bytes.
|
void |
writeLong(long i)
Writes a long as eight bytes.
|
void |
writeOptionalBoolean(Boolean b) |
void |
writeOptionalDouble(Double v) |
void |
writeOptionalFloat(Float floatValue) |
void |
writeOptionalInt(Integer integer)
Writes an optional
Integer. |
void |
writeOptionalLong(Long l) |
void |
writeOptionalVInt(Integer integer) |
void |
writeOptionalVLong(Long l) |
void |
writeShort(short v) |
void |
writeVInt(int i)
Writes an int in a variable-length format.
|
void |
writeVLong(long i)
Writes a non-negative long in a variable-length format.
|
void |
writeZLong(long i)
Writes a long in a variable-length format.
|
writepublic abstract void close()
throws IOException
close 在接口中 Closeableclose 在接口中 AutoCloseableclose 在类中 OutputStreamIOExceptionpublic abstract void flush()
throws IOException
flush 在接口中 Flushableflush 在类中 OutputStreamIOExceptionpublic abstract void reset()
throws IOException
IOExceptionpublic abstract void writeByte(byte b)
throws IOException
IOExceptionpublic void writeBytes(byte[] b)
throws IOException
b - the bytes to writeIOExceptionpublic void writeBytes(byte[] b,
int length)
throws IOException
b - the bytes to writelength - the number of bytes to writeIOExceptionpublic abstract void writeBytes(byte[] b,
int offset,
int length)
throws IOException
b - the bytes to writeoffset - the offset in the byte arraylength - the number of bytes to writeIOExceptionpublic final void writeShort(short v)
throws IOException
IOExceptionpublic void writeInt(int i)
throws IOException
IOExceptionpublic void writeOptionalInt(Integer integer) throws IOException
Integer.IOExceptionpublic void writeVInt(int i)
throws IOException
writeInt(int)IOExceptionpublic void writeOptionalVInt(Integer integer) throws IOException
IOExceptionpublic void writeLong(long i)
throws IOException
IOExceptionpublic void writeOptionalLong(Long l) throws IOException
IOExceptionpublic void writeVLong(long i)
throws IOException
writeLong(long) or writeZLong(long) for
negative numbers.IOExceptionpublic void writeOptionalVLong(Long l) throws IOException
IOExceptionpublic void writeZLong(long i)
throws IOException
writeVLong(long)IOExceptionpublic void writeFloat(float v)
throws IOException
IOExceptionpublic void writeOptionalFloat(Float floatValue) throws IOException
IOExceptionpublic void writeDouble(double v)
throws IOException
IOExceptionpublic void writeOptionalDouble(Double v) throws IOException
IOExceptionpublic void writeBoolean(boolean b)
throws IOException
IOExceptionpublic void writeOptionalBoolean(Boolean b) throws IOException
IOExceptionpublic void write(int b)
throws IOException
write 在类中 OutputStreamIOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
write 在类中 OutputStreamIOExceptionpublic void writeGenericValue(Object value) throws IOException
writeMapWithConsistentOrderIOExceptionCopyright © 2021. All rights reserved.