public class GsonJsonObjectInput extends Object implements ObjectInput
| 构造器和说明 |
|---|
GsonJsonObjectInput(InputStream in) |
GsonJsonObjectInput(Reader reader) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
readBool()
Read boolean.
|
byte |
readByte()
Read byte.
|
byte[] |
readBytes()
Read byte array.
|
double |
readDouble()
Read double.
|
float |
readFloat()
Read float.
|
int |
readInt()
Read integer.
|
long |
readLong()
Read long.
|
Object |
readObject()
Consider use
ObjectInput.readObject(Class) or ObjectInput.readObject(Class, Type) where possible |
<T> T |
readObject(Class<T> cls)
read object
|
<T> T |
readObject(Class<T> cls,
Type type)
read object
|
short |
readShort()
Read short integer.
|
Throwable |
readThrowable()
The following methods are customized for the requirement of Dubbo's RPC protocol implementation.
|
String |
readUTF()
Read UTF-8 string.
|
readAttachments, readEventpublic GsonJsonObjectInput(InputStream in)
public GsonJsonObjectInput(Reader reader)
public boolean readBool()
throws IOException
DataInputreadBool 在接口中 DataInputIOExceptionpublic byte readByte()
throws IOException
DataInputreadByte 在接口中 DataInputIOExceptionpublic short readShort()
throws IOException
DataInputreadShort 在接口中 DataInputIOExceptionpublic int readInt()
throws IOException
DataInputreadInt 在接口中 DataInputIOExceptionpublic long readLong()
throws IOException
DataInputreadLong 在接口中 DataInputIOExceptionpublic float readFloat()
throws IOException
DataInputreadFloat 在接口中 DataInputIOExceptionpublic double readDouble()
throws IOException
DataInputreadDouble 在接口中 DataInputIOExceptionpublic String readUTF() throws IOException
DataInputreadUTF 在接口中 DataInputIOExceptionpublic byte[] readBytes()
throws IOException
DataInputreadBytes 在接口中 DataInputIOExceptionpublic Object readObject() throws IOException, ClassNotFoundException
ObjectInputObjectInput.readObject(Class) or ObjectInput.readObject(Class, Type) where possiblereadObject 在接口中 ObjectInputIOException - if an I/O error occursClassNotFoundException - if an ClassNotFoundException occurspublic <T> T readObject(Class<T> cls) throws IOException, ClassNotFoundException
ObjectInputreadObject 在接口中 ObjectInputcls - object classIOException - if an I/O error occursClassNotFoundException - if an ClassNotFoundException occurspublic <T> T readObject(Class<T> cls, Type type) throws IOException, ClassNotFoundException
ObjectInputreadObject 在接口中 ObjectInputcls - object classtype - object typeIOException - if an I/O error occursClassNotFoundException - if an ClassNotFoundException occurspublic Throwable readThrowable() throws IOException, ClassNotFoundException
ObjectInputSee 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
readThrowable 在接口中 ObjectInputIOExceptionClassNotFoundExceptionCopyright © 2011–2021 The Apache Software Foundation. All rights reserved.