public class MicroBurlapInput
extends java.lang.Object
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
Modifier and Type | Field and Description |
---|---|
protected java.util.Date |
date |
protected java.lang.StringBuffer |
entity |
protected java.lang.String |
method |
protected int |
peek |
protected boolean |
peekTag |
protected java.util.Vector |
refs |
protected java.lang.StringBuffer |
sbuf |
protected java.util.Calendar |
utcCalendar |
Constructor and Description |
---|
MicroBurlapInput()
Creates an uninitialized Burlap input stream.
|
MicroBurlapInput(java.io.InputStream is)
Creates a new Burlap input stream, initialized with an
underlying input stream.
|
Modifier and Type | Method and Description |
---|---|
void |
completeCall()
Completes reading the call.
|
void |
completeReply()
Completes reading the reply.
|
protected java.io.IOException |
expectBeginTag(java.lang.String expect,
java.lang.String tag) |
protected java.io.IOException |
expectedChar(java.lang.String expect,
int actualChar) |
protected void |
expectEndTag(java.lang.String tag) |
protected void |
expectStartTag(java.lang.String tag) |
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.
|
protected boolean |
isWhitespace(int ch) |
protected byte[] |
parseBytes()
Parses a byte array.
|
protected java.io.ByteArrayOutputStream |
parseBytes(java.io.ByteArrayOutputStream bos)
Parses a byte array.
|
protected long |
parseDate(java.util.Calendar calendar)
Parses a date value from the stream.
|
protected int |
parseInt()
Parses an integer value from the stream.
|
protected long |
parseLong()
Parses a long value from the stream.
|
protected java.lang.String |
parseString()
Parses a string value from the stream.
|
protected java.lang.StringBuffer |
parseString(java.lang.StringBuffer sbuf)
Parses a string value from the stream.
|
protected boolean |
parseTag()
Parses a tag.
|
protected int |
read() |
boolean |
readBoolean()
Reads a boolean value from the input stream.
|
byte[] |
readBytes()
Reads a byte array from the input stream.
|
protected java.lang.Object |
readExtensionObject(java.lang.Class expectedClass,
java.lang.String tag)
Reads object unknown to MicroBurlapInput.
|
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.
|
protected int |
skipWhitespace() |
void |
startCall()
Starts reading the call
|
boolean |
startReply()
Starts reading the reply.
|
protected int peek
protected boolean peekTag
protected java.util.Date date
protected java.util.Calendar utcCalendar
protected java.util.Vector refs
protected java.lang.String method
protected java.lang.StringBuffer sbuf
protected java.lang.StringBuffer entity
public MicroBurlapInput(java.io.InputStream is)
is
- the underlying input stream.public MicroBurlapInput()
public java.lang.String getMethod()
public void init(java.io.InputStream is)
init(InputStream)
to reuse
MicroBurlapInput to save garbage collection.public void startCall() throws java.io.IOException
A successful completion will have a single value:
<burlap:call> <method>method</method>
java.io.IOException
public void completeCall() throws java.io.IOException
</burlap:call>
java.io.IOException
public java.lang.Object readReply(java.lang.Class expectedClass) throws java.lang.Exception
java.lang.Exception
public boolean startReply() throws java.io.IOException
A successful completion will have a single value. An unsuccessful one will have a fault:
<burlap:reply>
java.io.IOException
public void completeReply() throws java.io.IOException
</burlap:reply>
java.io.IOException
public boolean readBoolean() throws java.io.IOException
java.io.IOException
public int readInt() throws java.io.IOException
java.io.IOException
public long readLong() throws java.io.IOException
java.io.IOException
public long readUTCDate() throws java.io.IOException
java.io.IOException
public long readLocalDate() throws java.io.IOException
java.io.IOException
public BurlapRemote readRemote() throws java.io.IOException
java.io.IOException
public java.lang.String readString() throws java.io.IOException
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
public byte[] readBytes() throws java.io.IOException
The two valid possibilities are either a <null> or a <base64>.
java.io.IOException
public java.lang.Object readObject(java.lang.Class expectedClass) throws java.io.IOException
java.io.IOException
public java.lang.String readType() throws java.io.IOException
<type>a utf-8 encoded string</type>
java.io.IOException
public int readLength() throws java.io.IOException
<length>integer</length>
java.io.IOException
public java.lang.Object resolveRemote(java.lang.String type, java.lang.String url) throws java.io.IOException
java.io.IOException
public java.util.Hashtable readFault() throws java.io.IOException
java.io.IOException
public java.lang.Object readMap(java.lang.Class expectedClass, java.lang.String type) throws java.io.IOException
expectedClass
- the calling routine's expected classtype
- the type from the streamjava.io.IOException
protected java.lang.Object readExtensionObject(java.lang.Class expectedClass, java.lang.String tag) throws java.io.IOException
java.io.IOException
public java.lang.Object readList(java.lang.Class expectedClass, java.lang.String type, int length) throws java.io.IOException
expectedClass
- the calling routine's expected classtype
- the type from the streamlength
- the expected length, -1 for unspecified lengthjava.io.IOException
protected int parseInt() throws java.io.IOException
java.io.IOException
protected long parseLong() throws java.io.IOException
java.io.IOException
protected long parseDate(java.util.Calendar calendar) throws java.io.IOException
java.io.IOException
protected java.lang.String parseString() throws java.io.IOException
java.io.IOException
protected java.lang.StringBuffer parseString(java.lang.StringBuffer sbuf) throws java.io.IOException
java.io.IOException
protected byte[] parseBytes() throws java.io.IOException
java.io.IOException
protected java.io.ByteArrayOutputStream parseBytes(java.io.ByteArrayOutputStream bos) throws java.io.IOException
java.io.IOException
protected void expectStartTag(java.lang.String tag) throws java.io.IOException
java.io.IOException
protected void expectEndTag(java.lang.String tag) throws java.io.IOException
java.io.IOException
protected boolean parseTag() throws java.io.IOException
java.io.IOException
protected java.io.IOException expectedChar(java.lang.String expect, int actualChar)
protected java.io.IOException expectBeginTag(java.lang.String expect, java.lang.String tag)
protected int skipWhitespace() throws java.io.IOException
java.io.IOException
protected boolean isWhitespace(int ch) throws java.io.IOException
java.io.IOException
protected int read() throws java.io.IOException
java.io.IOException