public class GenericProtobufObjectOutput extends Object implements ObjectOutput
| 构造器和说明 |
|---|
GenericProtobufObjectOutput(OutputStream os) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
flushBuffer()
Flush buffer.
|
void |
writeAttachments(Map<String,Object> attachments) |
void |
writeBool(boolean v)
Write boolean.
|
void |
writeByte(byte v)
Write byte.
|
void |
writeBytes(byte[] b)
Write byte array.
|
void |
writeBytes(byte[] b,
int off,
int len)
Write byte array.
|
void |
writeDouble(double v)
Write double.
|
void |
writeEvent(Object data) |
void |
writeFloat(float v)
Write float.
|
void |
writeInt(int v)
Write integer.
|
void |
writeLong(long v)
Write long.
|
void |
writeObject(Object obj)
write object.
|
void |
writeShort(short v)
Write short.
|
void |
writeThrowable(Object obj)
The following methods are customized for the requirement of Dubbo's RPC protocol implementation.
|
void |
writeUTF(String v)
Write string.
|
public GenericProtobufObjectOutput(OutputStream os)
public void writeBool(boolean v)
throws IOException
DataOutputwriteBool 在接口中 DataOutputv - value.IOExceptionpublic void writeByte(byte v)
throws IOException
DataOutputwriteByte 在接口中 DataOutputv - value.IOExceptionpublic void writeShort(short v)
throws IOException
DataOutputwriteShort 在接口中 DataOutputv - value.IOExceptionpublic void writeInt(int v)
throws IOException
DataOutputwriteInt 在接口中 DataOutputv - value.IOExceptionpublic void writeLong(long v)
throws IOException
DataOutputwriteLong 在接口中 DataOutputv - value.IOExceptionpublic void writeFloat(float v)
throws IOException
DataOutputwriteFloat 在接口中 DataOutputv - value.IOExceptionpublic void writeDouble(double v)
throws IOException
DataOutputwriteDouble 在接口中 DataOutputv - value.IOExceptionpublic void writeUTF(String v) throws IOException
DataOutputwriteUTF 在接口中 DataOutputv - value.IOExceptionpublic void writeBytes(byte[] b)
throws IOException
DataOutputwriteBytes 在接口中 DataOutputb - value.IOExceptionpublic void writeBytes(byte[] b,
int off,
int len)
throws IOException
DataOutputwriteBytes 在接口中 DataOutputb - value.off - the start offset in the data.len - the number of bytes that are written.IOExceptionpublic void writeObject(Object obj) throws IOException
ObjectOutputwriteObject 在接口中 ObjectOutputobj - object.IOExceptionpublic void writeEvent(Object data) throws IOException
writeEvent 在接口中 ObjectOutputIOExceptionpublic void writeThrowable(Object obj) 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 在接口中 ObjectOutputIOExceptionpublic void writeAttachments(Map<String,Object> attachments) throws IOException
writeAttachments 在接口中 ObjectOutputIOExceptionpublic void flushBuffer()
throws IOException
DataOutputflushBuffer 在接口中 DataOutputIOExceptionCopyright © 2011–2021 The Apache Software Foundation. All rights reserved.