public class BurlapOutput extends AbstractBurlapOutput
Since BurlapOutput does not depend on any classes other than in the JDK, it can be extracted independently into a smaller package.
BurlapOutput is unbuffered, so any client needs to provide its own buffering.
OutputStream os = ...; // from http connection
BurlapOutput out = new BurlapOutput(os);
String value;
out.startCall("hello"); // start hello call
out.writeString("arg1"); // write a string argument
out.completeCall(); // complete the call
| Modifier and Type | Field and Description |
|---|---|
protected OutputStream |
os |
_serializerFactory| Constructor and Description |
|---|
BurlapOutput()
Creates an uninitialized Burlap output stream.
|
BurlapOutput(OutputStream os)
Creates a new Burlap output stream, initialized with an
underlying output stream.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addRef(Object object)
If the object has already been written, just write its ref.
|
void |
call(String method,
Object[] args)
Writes a complete method call.
|
void |
completeCall()
Completes.
|
void |
completeReply()
Completes reading the reply
|
int |
getRef(Object obj) |
void |
init(OutputStream os)
Initializes the output
|
protected void |
print(char v)
Prints a char to the stream.
|
protected void |
print(double v)
Prints a double to the stream.
|
protected void |
print(int v)
Prints an integer to the stream.
|
protected void |
print(long v)
Prints a long to the stream.
|
protected void |
print(String s)
Prints a string as ascii to the stream.
|
void |
printDate(Calendar calendar)
Prints a date.
|
void |
printString(char[] v,
int offset,
int length)
Prints a string to the stream, encoded as UTF-8
|
void |
printString(String v)
Prints a string to the stream, encoded as UTF-8
|
void |
printString(String v,
int offset,
int length)
Prints a string to the stream, encoded as UTF-8
|
boolean |
removeRef(Object obj)
Removes a reference.
|
boolean |
replaceRef(Object oldRef,
Object newRef)
Replaces a reference from one object to another.
|
void |
startCall()
Starts the method call.
|
void |
startCall(String method)
Starts the method call.
|
void |
startReply()
Starts the reply
|
void |
writeBoolean(boolean value)
Writes a boolean value to the stream.
|
void |
writeByteBufferEnd(byte[] buffer,
int offset,
int length)
Writes a byte buffer to the stream.
|
void |
writeByteBufferPart(byte[] buffer,
int offset,
int length)
Writes a byte buffer to the stream.
|
void |
writeByteBufferStart()
Writes a byte buffer to the stream.
|
void |
writeBytes(byte[] buffer)
Writes a byte array to the stream.
|
void |
writeBytes(byte[] buffer,
int offset,
int length)
Writes a byte array to the stream.
|
void |
writeDouble(double value)
Writes a double value to the stream.
|
void |
writeFault(String code,
String message,
Object detail)
Writes a fault.
|
void |
writeHeader(String name)
Writes a header name.
|
void |
writeInt(int value)
Writes an integer value to the stream.
|
boolean |
writeListBegin(int length,
String type)
Writes the list header to the stream.
|
void |
writeListEnd()
Writes the tail of the list to the stream.
|
void |
writeLong(long value)
Writes a long value to the stream.
|
void |
writeMapBegin(String type)
Writes the map header to the stream.
|
void |
writeMapEnd()
Writes the tail of the map to the stream.
|
void |
writeMethod(String method)
Writes the method for a call.
|
void |
writeNull()
Writes a null value to the stream.
|
void |
writeObject(Object object)
Writes any object to the output stream.
|
void |
writeRef(int value)
Writes a reference.
|
void |
writeRemote(String type,
String url)
Writes a remote object reference to the stream.
|
void |
writeString(char[] buffer,
int offset,
int length)
Writes a string value to the stream using UTF-8 encoding.
|
void |
writeString(String value)
Writes a string value to the stream using UTF-8 encoding.
|
void |
writeUTCDate(long time)
Writes a date to the stream.
|
startCallclose, findSerializerFactory, flush, getSerializerFactory, resetReferences, setSerializerFactory, writeByteStream, writeClassFieldLength, writeObjectBegin, writeObjectEnd, writeReplyprotected OutputStream os
public BurlapOutput(OutputStream os)
os - the underlying output stream.public BurlapOutput()
public void init(OutputStream os)
init in class AbstractHessianOutputpublic void call(String method, Object[] args) throws IOException
call in class AbstractHessianOutputIOExceptionpublic void startCall(String method) throws IOException
startCall
instead of call if they wanted finer control over
writing the arguments, or needed to write headers.
<burlap:call>
<method>method-name</method>
method - the method name to call.IOExceptionpublic void startCall()
throws IOException
startCall
instead of call if they wanted finer control over
writing the arguments, or needed to write headers.
<method>method-name</method>
startCall in class AbstractHessianOutputIOExceptionpublic void writeMethod(String method) throws IOException
<method>value</method>
writeMethod in class AbstractHessianOutputmethod - the method name to call.IOExceptionpublic void completeCall()
throws IOException
</burlap:call>
completeCall in class AbstractHessianOutputIOExceptionpublic void startReply()
throws IOException
A successful completion will have a single value:
r
startReply in class AbstractHessianOutputIOExceptionpublic void completeReply()
throws IOException
A successful completion will have a single value:
</burlap:reply>
completeReply in class AbstractHessianOutputIOExceptionpublic void writeHeader(String name) throws IOException
<header>foo</header><int>value</int>
writeHeader in class AbstractHessianOutputIOExceptionpublic void writeFault(String code, String message, Object detail) throws IOException
<fault>
<string>code
<string>the fault code
<string>message
<string>the fault mesage
<string>detail
<map>t\x00\xnnjavax.ejb.FinderException
...
</map>
</fault>
writeFault in class AbstractHessianOutputcode - the fault code, a three digitIOExceptionpublic void writeObject(Object object) throws IOException
writeObject in class AbstractHessianOutputIOExceptionpublic boolean writeListBegin(int length,
String type)
throws IOException
writeListBegin followed by the list contents and then
call writeListEnd.
<list>
<type>java.util.ArrayList</type>
<length>3</length>
<int>1</int>
<int>2</int>
<int>3</int>
</list>
writeListBegin in class AbstractHessianOutputIOExceptionpublic void writeListEnd()
throws IOException
writeListEnd in class AbstractHessianOutputIOExceptionpublic void writeMapBegin(String type) throws IOException
writeMapBegin followed by the map contents and then
call writeMapEnd.
<map>
<type>type</type>
(<key> <value>)*
</map>
writeMapBegin in class AbstractHessianOutputIOExceptionpublic void writeMapEnd()
throws IOException
writeMapEnd in class AbstractHessianOutputIOExceptionpublic void writeRemote(String type, String url) throws IOException
<remote>
<type>test.account.Account</type>
<string>http://caucho.com/foo;ejbid=bar</string>
</remote>
IOExceptionpublic void writeBoolean(boolean value)
throws IOException
<boolean>0</boolean>
<boolean>1</boolean>
writeBoolean in class AbstractHessianOutputvalue - the boolean value to write.IOExceptionpublic void writeInt(int value)
throws IOException
<int>int value</int>
writeInt in class AbstractHessianOutputvalue - the integer value to write.IOExceptionpublic void writeLong(long value)
throws IOException
<long>int value</long>
writeLong in class AbstractHessianOutputvalue - the long value to write.IOExceptionpublic void writeDouble(double value)
throws IOException
<double>value</double>
writeDouble in class AbstractHessianOutputvalue - the double value to write.IOExceptionpublic void writeUTCDate(long time)
throws IOException
<date>iso8901</date>
writeUTCDate in class AbstractHessianOutputtime - the date in milliseconds from the epoch in UTCIOExceptionpublic void writeNull()
throws IOException
<null></null>
writeNull in class AbstractHessianOutputIOExceptionpublic void writeString(String value) throws IOException
<string>string-value</string>
If the value is null, it will be written as
<null></null>
writeString in class AbstractHessianOutputvalue - the string value to write.IOExceptionpublic void writeString(char[] buffer,
int offset,
int length)
throws IOException
S b16 b8 string-value
If the value is null, it will be written as
N
writeString in class AbstractHessianOutputbuffer - the char array value to write.offset - the index of the chars to write.length - the number of chars to write.IOExceptionpublic void writeBytes(byte[] buffer)
throws IOException
<base64>bytes</base64>
If the value is null, it will be written as
<null></null>
writeBytes in class AbstractHessianOutputbuffer - the byte array value to write.IOExceptionpublic void writeBytes(byte[] buffer,
int offset,
int length)
throws IOException
<base64>bytes</base64>
If the value is null, it will be written as
<null></null>
writeBytes in class AbstractHessianOutputbuffer - the byte array value to write.offset - the index of the bytes to write.length - the number of bytes to write.IOExceptionpublic void writeByteBufferStart()
throws IOException
writeByteBufferStart in class AbstractHessianOutputIOExceptionpublic void writeByteBufferPart(byte[] buffer,
int offset,
int length)
throws IOException
b b16 b18 bytes
writeByteBufferPart in class AbstractHessianOutputbuffer - the byte array value to write.offset - the index of the bytes to write.length - the number of bytes to write.IOExceptionpublic void writeByteBufferEnd(byte[] buffer,
int offset,
int length)
throws IOException
b b16 b18 bytes
writeByteBufferEnd in class AbstractHessianOutputbuffer - the byte array value to write.offset - the index of the bytes to write.length - the number of bytes to write.IOExceptionpublic void writeRef(int value)
throws IOException
<ref>int</ref>
writeRef in class AbstractHessianOutputvalue - the integer value to write.IOExceptionpublic boolean addRef(Object object) throws IOException
addRef in class AbstractHessianOutputobject - the object to add as a reference.IOExceptionpublic int getRef(Object obj)
getRef in class AbstractHessianOutputobj - an object.public boolean removeRef(Object obj) throws IOException
removeRef in class AbstractHessianOutputIOExceptionpublic boolean replaceRef(Object oldRef, Object newRef) throws IOException
replaceRef in class AbstractHessianOutputIOExceptionpublic void printString(String v) throws IOException
v - the string to print.IOExceptionpublic void printString(String v, int offset, int length) throws IOException
v - the string to print.IOExceptionpublic void printString(char[] v,
int offset,
int length)
throws IOException
v - the string to print.IOExceptionpublic void printDate(Calendar calendar) throws IOException
calendar - the date to print.IOExceptionprotected void print(char v)
throws IOException
v - the char to print.IOExceptionprotected void print(int v)
throws IOException
v - the integer to print.IOExceptionprotected void print(long v)
throws IOException
v - the long to print.IOExceptionprotected void print(double v)
throws IOException
v - the double to print.IOExceptionprotected void print(String s) throws IOException
s - the ascii string to print.IOExceptionCopyright © 2013. All Rights Reserved.