public class KryoObjectOutput2 extends Object implements ObjectOutput, Cleanable
| Constructor and Description |
|---|
KryoObjectOutput2(OutputStream outputStream) |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanup()
Implementations must implement this cleanup method
|
void |
flushBuffer()
Flush buffer.
|
void |
writeBool(boolean v)
Write boolean.
|
void |
writeByte(byte v)
Write byte.
|
void |
writeBytes(byte[] v)
Write byte array.
|
void |
writeBytes(byte[] v,
int off,
int len)
Write byte array.
|
void |
writeDouble(double v)
Write double.
|
void |
writeFloat(float v)
Write float.
|
void |
writeInt(int v)
Write integer.
|
void |
writeLong(long v)
Write long.
|
void |
writeObject(Object v)
write object.
|
void |
writeShort(short v)
Write short.
|
void |
writeThrowable(Object v)
The following methods are customized for the requirement of Dubbo's RPC protocol implementation.
|
void |
writeUTF(String v)
Write string.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwriteAttachments, writeEventpublic KryoObjectOutput2(OutputStream outputStream)
public void writeBool(boolean v)
throws IOException
DataOutputwriteBool in interface DataOutputv - value.IOExceptionpublic void writeByte(byte v)
throws IOException
DataOutputwriteByte in interface DataOutputv - value.IOExceptionpublic void writeShort(short v)
throws IOException
DataOutputwriteShort in interface DataOutputv - value.IOExceptionpublic void writeInt(int v)
throws IOException
DataOutputwriteInt in interface DataOutputv - value.IOExceptionpublic void writeLong(long v)
throws IOException
DataOutputwriteLong in interface DataOutputv - value.IOExceptionpublic void writeFloat(float v)
throws IOException
DataOutputwriteFloat in interface DataOutputv - value.IOExceptionpublic void writeDouble(double v)
throws IOException
DataOutputwriteDouble in interface DataOutputv - value.IOExceptionpublic void writeBytes(byte[] v)
throws IOException
DataOutputwriteBytes in interface DataOutputv - value.IOExceptionpublic void writeBytes(byte[] v,
int off,
int len)
throws IOException
DataOutputwriteBytes in interface DataOutputv - value.off - the start offset in the data.len - the number of bytes that are written.IOExceptionpublic void writeUTF(String v) throws IOException
DataOutputwriteUTF in interface DataOutputv - value.IOExceptionpublic void writeObject(Object v) throws IOException
ObjectOutputwriteObject in interface ObjectOutputv - object.IOExceptionpublic void writeThrowable(Object v) throws IOException
ObjectOutputSee how ProtobufSerialization, KryoSerialization implemented these methods for more details.
The binding of RPC protocol and biz serialization protocol is not a good practice. Encoding of RPC protocol should be highly independent and portable, easy to cross platforms and languages, for example, like the http headers, restricting the content of headers / attachments to Ascii strings and uses ISO_8859_1 to encode them. https://tools.ietf.org/html/rfc7540#section-8.1.2
writeThrowable in interface ObjectOutputIOExceptionpublic void flushBuffer()
throws IOException
DataOutputflushBuffer in interface DataOutputIOExceptionCopyright © 2011–2020 The Apache Software Foundation. All rights reserved.