com.caucho.burlap.client
类 MicroBurlapInput

java.lang.Object
  继承者 com.caucho.burlap.client.MicroBurlapInput

public class MicroBurlapInput
extends java.lang.Object

Input stream for Burlap requests, compatible with microedition Java. It only uses classes and types available to J2ME. In particular, it does not have any support for the <double> type.

MicroBurlapInput does not depend on any classes other than in J2ME, so it can be extracted independently into a smaller package.

MicroBurlapInput is unbuffered, so any client needs to provide its own buffering.

 InputStream is = ...; // from http connection
 MicroBurlapInput in = new MicroBurlapInput(is);
 String value;

 in.startReply();         // read reply header
 value = in.readString(); // read string value
 in.completeReply();      // read reply footer
 


构造方法摘要
MicroBurlapInput()
          Creates an uninitialized Burlap input stream.
MicroBurlapInput(java.io.InputStream is)
          Creates a new Burlap input stream, initialized with an underlying input stream.
 
方法摘要
 void completeCall()
          Completes reading the call.
 void completeReply()
          Completes reading the reply.
 java.lang.String getMethod()
          Returns a call's method.
 void init(java.io.InputStream is)
          Initialize the Burlap input stream with a new underlying stream.
 boolean readBoolean()
          Reads a boolean value from the input stream.
 byte[] readBytes()
          Reads a byte array from the input stream.
 java.util.Hashtable readFault()
          Reads a fault.
 int readInt()
          Reads an integer value from the input stream.
 int readLength()
          Reads a length value from the input stream.
 java.lang.Object readList(java.lang.Class expectedClass, java.lang.String type, int length)
          Reads a list object from the input stream.
 long readLocalDate()
          Reads a date value from the input stream.
 long readLong()
          Reads a long value from the input stream.
 java.lang.Object readMap(java.lang.Class expectedClass, java.lang.String type)
          Reads an object from the input stream.
 java.lang.Object readObject(java.lang.Class expectedClass)
          Reads an arbitrary object the input stream.
 BurlapRemote readRemote()
          Reads a remote value from the input stream.
 java.lang.Object readReply(java.lang.Class expectedClass)
          Reads a reply as an object.
 java.lang.String readString()
          Reads a string value from the input stream.
 java.lang.String readType()
          Reads a type value from the input stream.
 long readUTCDate()
          Reads a date value from the input stream.
 java.lang.Object resolveRemote(java.lang.String type, java.lang.String url)
          Resolves a remote object.
 void startCall()
          Starts reading the call A successful completion will have a single value: <burlap:call> <method>method</method>
 boolean startReply()
          Starts reading the reply.
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

MicroBurlapInput

public MicroBurlapInput(java.io.InputStream is)
Creates a new Burlap input stream, initialized with an underlying input stream.

参数:
is - the underlying input stream.

MicroBurlapInput

public MicroBurlapInput()
Creates an uninitialized Burlap input stream.

方法详细信息

getMethod

public java.lang.String getMethod()
Returns a call's method.


init

public void init(java.io.InputStream is)
Initialize the Burlap input stream with a new underlying stream. Applications can use init(InputStream) to reuse MicroBurlapInput to save garbage collection.


startCall

public void startCall()
               throws java.io.IOException
Starts reading the call

A successful completion will have a single value:

 <burlap:call>
 <method>method</method>
 

抛出:
java.io.IOException

completeCall

public void completeCall()
                  throws java.io.IOException
Completes reading the call.
 </burlap:call>
 

抛出:
java.io.IOException

readReply

public java.lang.Object readReply(java.lang.Class expectedClass)
                           throws java.lang.Exception
Reads a reply as an object. If the reply has a fault, throws the exception.

抛出:
java.lang.Exception

startReply

public boolean startReply()
                   throws java.io.IOException
Starts reading the reply.

A successful completion will have a single value. An unsuccessful one will have a fault:

 <burlap:reply>
 

返回:
true if success, false for fault.
抛出:
java.io.IOException

completeReply

public void completeReply()
                   throws java.io.IOException
Completes reading the reply.
 </burlap:reply>
 

抛出:
java.io.IOException

readBoolean

public boolean readBoolean()
                    throws java.io.IOException
Reads a boolean value from the input stream.

抛出:
java.io.IOException

readInt

public int readInt()
            throws java.io.IOException
Reads an integer value from the input stream.

抛出:
java.io.IOException

readLong

public long readLong()
              throws java.io.IOException
Reads a long value from the input stream.

抛出:
java.io.IOException

readUTCDate

public long readUTCDate()
                 throws java.io.IOException
Reads a date value from the input stream.

抛出:
java.io.IOException

readLocalDate

public long readLocalDate()
                   throws java.io.IOException
Reads a date value from the input stream.

抛出:
java.io.IOException

readRemote

public BurlapRemote readRemote()
                        throws java.io.IOException
Reads a remote value from the input stream.

抛出:
java.io.IOException

readString

public java.lang.String readString()
                            throws java.io.IOException
Reads a string value from the input stream.

The two valid possibilities are either a <null> or a <string>. The string value is encoded in utf-8, and understands the basic XML escapes: "&123;", "<", ">", "'", """.

 <null></null>
 <string>a utf-8 encoded string</string>
 

抛出:
java.io.IOException

readBytes

public byte[] readBytes()
                 throws java.io.IOException
Reads a byte array from the input stream.

The two valid possibilities are either a <null> or a <base64>.

抛出:
java.io.IOException

readObject

public java.lang.Object readObject(java.lang.Class expectedClass)
                            throws java.io.IOException
Reads an arbitrary object the input stream.

抛出:
java.io.IOException

readType

public java.lang.String readType()
                          throws java.io.IOException
Reads a type value from the input stream.
 <type>a utf-8 encoded string</type>
 

抛出:
java.io.IOException

readLength

public int readLength()
               throws java.io.IOException
Reads a length value from the input stream. If the length isn't specified, returns -1.
 <length>integer</length>
 

抛出:
java.io.IOException

resolveRemote

public java.lang.Object resolveRemote(java.lang.String type,
                                      java.lang.String url)
                               throws java.io.IOException
Resolves a remote object.

抛出:
java.io.IOException

readFault

public java.util.Hashtable readFault()
                              throws java.io.IOException
Reads a fault.

抛出:
java.io.IOException

readMap

public java.lang.Object readMap(java.lang.Class expectedClass,
                                java.lang.String type)
                         throws java.io.IOException
Reads an object from the input stream.

参数:
expectedClass - the calling routine's expected class
type - the type from the stream
抛出:
java.io.IOException

readList

public java.lang.Object readList(java.lang.Class expectedClass,
                                 java.lang.String type,
                                 int length)
                          throws java.io.IOException
Reads a list object from the input stream.

参数:
expectedClass - the calling routine's expected class
type - the type from the stream
length - the expected length, -1 for unspecified length
抛出:
java.io.IOException