类 Hessian2Input
- java.lang.Object
-
- com.alibaba.com.caucho.hessian.io.AbstractHessianInput
-
- com.alibaba.com.caucho.hessian.io.Hessian2Input
-
- 所有已实现的接口:
Hessian2Constants
public class Hessian2Input extends AbstractHessianInput implements Hessian2Constants
Input stream for Hessian requests.HessianInput is unbuffered, so any client needs to provide its own buffering.
InputStream is = ...; // from http connection HessianInput in = new HessianInput(is); String value; in.startReply(); // read reply header value = in.readString(); // read string value in.completeReply(); // read reply footer
-
-
字段概要
-
从接口继承的字段 com.alibaba.com.caucho.hessian.io.Hessian2Constants
BC_BINARY, BC_BINARY_CHUNK, BC_BINARY_DIRECT, BC_BINARY_SHORT, BC_CLASS_DEF, BC_DATE, BC_DATE_MINUTE, BC_DOUBLE, BC_DOUBLE_BYTE, BC_DOUBLE_MILL, BC_DOUBLE_ONE, BC_DOUBLE_SHORT, BC_DOUBLE_ZERO, BC_END, BC_FALSE, BC_INT, BC_INT_BYTE_ZERO, BC_INT_SHORT_ZERO, BC_INT_ZERO, BC_LIST_DIRECT, BC_LIST_DIRECT_UNTYPED, BC_LIST_FIXED, BC_LIST_FIXED_UNTYPED, BC_LIST_VARIABLE, BC_LIST_VARIABLE_UNTYPED, BC_LONG, BC_LONG_BYTE_ZERO, BC_LONG_INT, BC_LONG_SHORT_ZERO, BC_LONG_ZERO, BC_MAP, BC_MAP_UNTYPED, BC_NULL, BC_OBJECT, BC_OBJECT_DEF, BC_OBJECT_DIRECT, BC_REF, BC_STRING, BC_STRING_CHUNK, BC_STRING_DIRECT, BC_STRING_SHORT, BC_TRUE, BINARY_DIRECT_MAX, BINARY_SHORT_MAX, INT_BYTE_MAX, INT_BYTE_MIN, INT_DIRECT_MAX, INT_DIRECT_MIN, INT_SHORT_MAX, INT_SHORT_MIN, LIST_DIRECT_MAX, LONG_BYTE_MAX, LONG_BYTE_MIN, LONG_DIRECT_MAX, LONG_DIRECT_MIN, LONG_SHORT_MAX, LONG_SHORT_MIN, OBJECT_DIRECT_MAX, P_PACKET, P_PACKET_CHUNK, P_PACKET_DIRECT, P_PACKET_SHORT, PACKET_DIRECT_MAX, PACKET_SHORT_MAX, STRING_DIRECT_MAX, STRING_SHORT_MAX
-
-
构造器概要
构造器 构造器 说明 Hessian2Input(InputStream is)Creates a new Hessian input stream, initialized with an underlying input stream.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 intaddRef(Object ref)Adds a list/map reference.booleancheckAndReadNull()voidclose()voidcompleteCall()Completes reading the callvoidcompleteEnvelope()Completes reading the envelopevoidcompleteMessage()Completes reading the messagevoidcompleteReply()Completes reading the callvoidcompleteValueReply()Completes reading the callSerializerFactoryfindSerializerFactory()Gets the serializer factory, creating a default if necessary.StringgetMethod()Returns the calls methodReadergetReader()Starts reading a string.ThrowablegetReplyFault()Returns any reply fault.SerializerFactorygetSerializerFactory()Gets the serializer factory.voidinit(InputStream is)Initialize the Hessian stream with the underlying input stream.booleanisCloseStreamOnClose()booleanisEnd()Returns true if this is the end of a list or a map.intread()Normally, shouldn't be called externally, but needed for QA, e.g.booleanreadBoolean()Reads a booleanintreadByte()Reads a byte from the stream.byte[]readBytes()Reads a byte arrayintreadBytes(byte[] buffer, int offset, int length)Reads a byte array from the stream.intreadCall()Starts reading the callintreadChar()Reads a byte from the stream.doublereadDouble()Reads a doublevoidreadEnd()Reads the end byte.intreadEnvelope()Starts reading the envelopefloatreadFloat()Reads a floatStringreadHeader()Reads a header, returning null if there are no headers.InputStreamreadInputStream()Reads bytes based on an input stream.intreadInt()Reads an integerintreadLength()Parses the length for an arrayvoidreadListEnd()Reads the end byte.intreadListStart()Reads the start of a list.longreadLong()Reads a longvoidreadMapEnd()Reads the end byte.intreadMapStart()Reads the start of a list.StringreadMethod()Starts reading the callintreadMethodArgLength()Returns the number of method argumentsvoidreadNull()Reads a nullObjectreadObject()Reads an arbitrary object from the input stream when the type is unknown.ObjectreadObject(Class cl)Reads an object from the input stream with an expected type.ObjectreadObject(Class expectedClass, Class<?>... expectedTypes)Reads an arbitrary object from the input stream.ObjectreadObject(List<Class<?>> expectedTypes)Reads an arbitrary object from the input stream.ObjectreadRef()Reads a reference.ObjectreadRemote()Reads a remote object.ObjectreadReply(Class expectedClass)Reads a reply as an object.shortreadShort()Reads a shortObjectreadStreamingObject()StringreadString()Reads a stringintreadString(char[] buffer, int offset, int length)Reads a byte array from the stream.StringreadType()Parses a type from the stream.longreadUTCDate()Reads a date.voidreset()voidresetReferences()Resets the references for streaming.ObjectresolveRemote(String type, String url)Resolves a remote object.voidsetCloseStreamOnClose(boolean isClose)voidsetRef(int i, Object ref)Adds a list/map reference.voidsetSerializerFactory(SerializerFactory factory)Sets the serializer factory.voidstartCall()Starts reading the call, including the headers.intstartMessage()Starts reading the messagevoidstartReply()Starts reading the reply-
从类继承的方法 com.alibaba.com.caucho.hessian.io.AbstractHessianInput
getRemoteResolver, readNode, setRemoteResolver, skipOptionalCall
-
-
-
-
构造器详细资料
-
Hessian2Input
public Hessian2Input(InputStream is)
Creates a new Hessian input stream, initialized with an underlying input stream.- 参数:
is- the underlying input stream.
-
-
方法详细资料
-
getSerializerFactory
public SerializerFactory getSerializerFactory()
Gets the serializer factory.
-
setSerializerFactory
public void setSerializerFactory(SerializerFactory factory)
Sets the serializer factory.
-
findSerializerFactory
public final SerializerFactory findSerializerFactory()
Gets the serializer factory, creating a default if necessary.
-
isCloseStreamOnClose
public boolean isCloseStreamOnClose()
-
setCloseStreamOnClose
public void setCloseStreamOnClose(boolean isClose)
-
getMethod
public String getMethod()
Returns the calls method- 指定者:
getMethod在类中AbstractHessianInput
-
getReplyFault
public Throwable getReplyFault()
Returns any reply fault.
-
init
public void init(InputStream is)
从类复制的说明:AbstractHessianInputInitialize the Hessian stream with the underlying input stream.- 覆盖:
init在类中AbstractHessianInput
-
reset
public void reset()
-
checkAndReadNull
public boolean checkAndReadNull()
- 指定者:
checkAndReadNull在类中AbstractHessianInput
-
readCall
public int readCall() throws IOExceptionStarts reading the callc major minor
- 指定者:
readCall在类中AbstractHessianInput- 抛出:
IOException
-
readEnvelope
public int readEnvelope() throws IOExceptionStarts reading the envelopeE major minor
- 抛出:
IOException
-
completeEnvelope
public void completeEnvelope() throws IOExceptionCompletes reading the envelopeA successful completion will have a single value:
Z
- 抛出:
IOException
-
readMethod
public String readMethod() throws IOException
Starts reading the callA successful completion will have a single value:
string
- 指定者:
readMethod在类中AbstractHessianInput- 抛出:
IOException
-
readMethodArgLength
public int readMethodArgLength() throws IOExceptionReturns the number of method argumentsint
- 覆盖:
readMethodArgLength在类中AbstractHessianInput- 返回:
- -1 for a variable length (hessian 1.0)
- 抛出:
IOException
-
startCall
public void startCall() throws IOExceptionStarts reading the call, including the headers.The call expects the following protocol data
c major minor m b16 b8 method
- 指定者:
startCall在类中AbstractHessianInput- 抛出:
IOException
-
completeCall
public void completeCall() throws IOExceptionCompletes reading the callA successful completion will have a single value:
- 指定者:
completeCall在类中AbstractHessianInput- 抛出:
IOException
-
readReply
public Object readReply(Class expectedClass) throws Throwable
Reads a reply as an object. If the reply has a fault, throws the exception.- 指定者:
readReply在类中AbstractHessianInput- 抛出:
Throwable
-
startReply
public void startReply() throws ThrowableStarts reading the replyA successful completion will have a single value:
r
- 指定者:
startReply在类中AbstractHessianInput- 抛出:
Throwable
-
completeReply
public void completeReply() throws IOExceptionCompletes reading the callA successful completion will have a single value:
z
- 指定者:
completeReply在类中AbstractHessianInput- 抛出:
IOException
-
completeValueReply
public void completeValueReply() throws IOExceptionCompletes reading the callA successful completion will have a single value:
z
- 抛出:
IOException
-
readHeader
public String readHeader() throws IOException
Reads a header, returning null if there are no headers.H b16 b8 value
- 指定者:
readHeader在类中AbstractHessianInput- 抛出:
IOException
-
startMessage
public int startMessage() throws IOExceptionStarts reading the messagep major minor
- 抛出:
IOException
-
completeMessage
public void completeMessage() throws IOExceptionCompletes reading the messageA successful completion will have a single value:
z
- 抛出:
IOException
-
readNull
public void readNull() throws IOExceptionReads a nullN
- 指定者:
readNull在类中AbstractHessianInput- 抛出:
IOException
-
readBoolean
public boolean readBoolean() throws IOExceptionReads a booleanT F
- 指定者:
readBoolean在类中AbstractHessianInput- 抛出:
IOException
-
readShort
public short readShort() throws IOExceptionReads a shortI b32 b24 b16 b8
- 抛出:
IOException
-
readInt
public final int readInt() throws IOExceptionReads an integerI b32 b24 b16 b8
- 指定者:
readInt在类中AbstractHessianInput- 抛出:
IOException
-
readLong
public long readLong() throws IOExceptionReads a longL b64 b56 b48 b40 b32 b24 b16 b8
- 指定者:
readLong在类中AbstractHessianInput- 抛出:
IOException
-
readFloat
public float readFloat() throws IOExceptionReads a floatD b64 b56 b48 b40 b32 b24 b16 b8
- 抛出:
IOException
-
readDouble
public double readDouble() throws IOExceptionReads a doubleD b64 b56 b48 b40 b32 b24 b16 b8
- 指定者:
readDouble在类中AbstractHessianInput- 抛出:
IOException
-
readUTCDate
public long readUTCDate() throws IOExceptionReads a date.T b64 b56 b48 b40 b32 b24 b16 b8
- 指定者:
readUTCDate在类中AbstractHessianInput- 抛出:
IOException
-
readChar
public int readChar() throws IOExceptionReads a byte from the stream.- 抛出:
IOException
-
readString
public int readString(char[] buffer, int offset, int length) throws IOExceptionReads a byte array from the stream.- 抛出:
IOException
-
readString
public String readString() throws IOException
Reads a stringS b16 b8 string value
- 指定者:
readString在类中AbstractHessianInput- 抛出:
IOException
-
readBytes
public byte[] readBytes() throws IOExceptionReads a byte arrayB b16 b8 data value
- 指定者:
readBytes在类中AbstractHessianInput- 抛出:
IOException
-
readByte
public int readByte() throws IOExceptionReads a byte from the stream.- 抛出:
IOException
-
readBytes
public int readBytes(byte[] buffer, int offset, int length) throws IOExceptionReads a byte array from the stream.- 抛出:
IOException
-
readObject
public Object readObject(Class cl) throws IOException
Reads an object from the input stream with an expected type.- 指定者:
readObject在类中AbstractHessianInput- 参数:
cl- the expected class if the protocol doesn't supply it.- 抛出:
IOException
-
readObject
public Object readObject(Class expectedClass, Class<?>... expectedTypes) throws IOException
从类复制的说明:AbstractHessianInputReads an arbitrary object from the input stream.- 覆盖:
readObject在类中AbstractHessianInput- 参数:
expectedClass- the expected class if the protocol doesn't supply it.expectedTypes- the runtime type hints, eg: expectedClass equals Map, expectedTypes can equals String.class, Short.class- 抛出:
IOException
-
readObject
public Object readObject() throws IOException
Reads an arbitrary object from the input stream when the type is unknown.- 指定者:
readObject在类中AbstractHessianInput- 抛出:
IOException
-
readObject
public Object readObject(List<Class<?>> expectedTypes) throws IOException
从类复制的说明:AbstractHessianInputReads an arbitrary object from the input stream.- 覆盖:
readObject在类中AbstractHessianInput- 参数:
expectedTypes- the runtime type hints, eg: expectedTypes can equals String.class, Short.class for HashMap- 抛出:
IOException
-
readRemote
public Object readRemote() throws IOException
Reads a remote object.- 指定者:
readRemote在类中AbstractHessianInput- 抛出:
IOException
-
readRef
public Object readRef() throws IOException
Reads a reference.- 指定者:
readRef在类中AbstractHessianInput- 抛出:
IOException
-
readListStart
public int readListStart() throws IOExceptionReads the start of a list.- 指定者:
readListStart在类中AbstractHessianInput- 抛出:
IOException
-
readMapStart
public int readMapStart() throws IOExceptionReads the start of a list.- 指定者:
readMapStart在类中AbstractHessianInput- 抛出:
IOException
-
isEnd
public boolean isEnd() throws IOExceptionReturns true if this is the end of a list or a map.- 指定者:
isEnd在类中AbstractHessianInput- 抛出:
IOException
-
readEnd
public void readEnd() throws IOExceptionReads the end byte.- 指定者:
readEnd在类中AbstractHessianInput- 抛出:
IOException
-
readMapEnd
public void readMapEnd() throws IOExceptionReads the end byte.- 指定者:
readMapEnd在类中AbstractHessianInput- 抛出:
IOException
-
readListEnd
public void readListEnd() throws IOExceptionReads the end byte.- 指定者:
readListEnd在类中AbstractHessianInput- 抛出:
IOException
-
addRef
public int addRef(Object ref)
Adds a list/map reference.- 指定者:
addRef在类中AbstractHessianInput
-
setRef
public void setRef(int i, Object ref)Adds a list/map reference.- 指定者:
setRef在类中AbstractHessianInput
-
resetReferences
public void resetReferences()
Resets the references for streaming.- 覆盖:
resetReferences在类中AbstractHessianInput
-
readStreamingObject
public Object readStreamingObject() throws IOException
- 抛出:
IOException
-
resolveRemote
public Object resolveRemote(String type, String url) throws IOException
Resolves a remote object.- 抛出:
IOException
-
readType
public String readType() throws IOException
Parses a type from the stream.type ::= string type ::= int
- 指定者:
readType在类中AbstractHessianInput- 抛出:
IOException
-
readLength
public int readLength() throws IOExceptionParses the length for an arrayl b32 b24 b16 b8
- 指定者:
readLength在类中AbstractHessianInput- 抛出:
IOException
-
readInputStream
public InputStream readInputStream() throws IOException
Reads bytes based on an input stream.- 指定者:
readInputStream在类中AbstractHessianInput- 抛出:
IOException
-
read
public final int read() throws IOExceptionNormally, shouldn't be called externally, but needed for QA, e.g. ejb/3b01.- 抛出:
IOException
-
getReader
public Reader getReader()
从类复制的说明:AbstractHessianInputStarts reading a string. All the characters must be read before calling the next method. The actual characters will be read with the reader's read() or read(char [], int, int).s b16 b8 non-final string chunk S b16 b8 final string chunk
- 指定者:
getReader在类中AbstractHessianInput
-
close
public void close() throws IOException- 覆盖:
close在类中AbstractHessianInput- 抛出:
IOException
-
-