|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tranche.remote.RemoteUtil
public class RemoteUtil
Utility methods for remote tranche server interaction.
| Field Summary | |
|---|---|
static byte |
BYTE_FALSE
|
static byte |
BYTE_TRUE
|
| Constructor Summary | |
|---|---|
RemoteUtil()
|
|
| Method Summary | |
|---|---|
static java.io.InputStream |
bufferData(java.io.InputStream in)
Helper method to read data |
static void |
checkOK(java.io.InputStream in)
Helper method that will throw an IOException if the input stream does not start with an Token.OK_STRING line. |
static void |
checkOK(java.lang.String line,
java.io.InputStream is)
Helper method that will throw an IOException if the line is not an Token.OK_STRING |
static boolean |
getBoolean(byte booleanByte)
|
static byte |
getByte(boolean byteBoolean)
|
static void |
handledError(java.lang.String responseLine,
java.io.InputStream in)
Helper method for handling errors. |
static boolean |
isAvailable(java.io.InputStream is)
Returns true if input stream doesn't have any available input, else false. |
static byte[][] |
read2dData(java.io.InputStream in)
|
static byte[][][] |
read3dData(java.io.InputStream in)
|
static BigHash |
readBigHash(java.io.InputStream is)
|
static BigHash[] |
readBigHashArray(java.io.InputStream is)
|
static boolean |
readBoolean(java.io.InputStream is)
Helper method to read an integer from an input stream. |
static boolean[] |
readBooleanArray(java.io.InputStream is)
|
static byte |
readByte(java.io.InputStream in)
|
static byte[] |
readBytes(int length,
java.io.InputStream in)
|
static java.io.InputStream |
readData(java.io.InputStream is)
Helper method for reading data. |
static byte[] |
readDataBytes(java.io.InputStream bis)
Helper method to return all bytes from an input stream. |
static int |
readInt(java.io.InputStream is)
Helper method to read an integer from an input stream. |
static java.lang.String |
readLine(java.io.InputStream is)
Helper method to read a single line of unencoded text |
static long |
readLong(java.io.InputStream is)
Helper method to read a long from an input stream. |
static Signature |
readSignature(java.io.InputStream in)
Helper method to read a signature from an input stream. |
static void |
write2dData(byte[][] data,
java.io.OutputStream out)
|
static void |
write3dData(byte[][][] data,
java.io.OutputStream out)
|
static void |
writeBigHash(BigHash hash,
java.io.OutputStream os)
|
static void |
writeBigHashArray(BigHash[] hashes,
java.io.OutputStream os)
|
static void |
writeBoolean(boolean b,
java.io.OutputStream out)
Helper method for writing an integer to an output stream. |
static void |
writeBooleanArray(boolean[] booleanArray,
java.io.OutputStream out)
|
static void |
writeByte(byte b,
java.io.OutputStream out)
|
static void |
writeBytes(byte[] bytes,
java.io.OutputStream out)
|
static void |
writeData(byte[] data,
java.io.OutputStream out)
Helper method for writing bytes to an output stream. |
static void |
writeError(java.lang.String message,
java.io.OutputStream out)
Helper method to write out an error message to the output stream. |
static void |
writeInt(int i,
java.io.OutputStream out)
Helper method for writing an integer to an output stream. |
static void |
writeLine(java.lang.String s,
java.io.OutputStream out)
Write a line to an output stream. |
static void |
writeLong(long l,
java.io.OutputStream out)
Helper method for writing a long to an output stream. |
static void |
writeSignature(Signature sig,
java.io.OutputStream bos)
Helper method to write out a signature to an output stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final byte BYTE_FALSE
public static final byte BYTE_TRUE
| Constructor Detail |
|---|
public RemoteUtil()
| Method Detail |
|---|
public static final boolean isAvailable(java.io.InputStream is)
throws java.io.IOException
Returns true if input stream doesn't have any available input, else false.
is - the input stream
true if the input stream does not have any available input;
false otherwise
java.io.IOException - if an input or output exception occurs
public static final boolean getBoolean(byte booleanByte)
throws java.io.IOException
booleanByte -
java.io.IOExceptionpublic static final byte getByte(boolean byteBoolean)
byteBoolean -
public static final void writeBooleanArray(boolean[] booleanArray,
java.io.OutputStream out)
throws java.io.IOException
booleanArray - out -
java.io.IOException
public static final boolean[] readBooleanArray(java.io.InputStream is)
throws java.io.IOException
is -
java.io.IOException
public static final void writeBigHashArray(BigHash[] hashes,
java.io.OutputStream os)
throws java.io.IOException
hashes - os -
java.io.IOException
public static final BigHash[] readBigHashArray(java.io.InputStream is)
throws java.io.IOException
is -
java.io.IOException
public static final BigHash readBigHash(java.io.InputStream is)
throws java.io.IOException
is -
java.io.IOException
public static final void writeBigHash(BigHash hash,
java.io.OutputStream os)
throws java.io.IOException
hash - os -
java.io.IOException
public static final java.lang.String readLine(java.io.InputStream is)
throws java.io.IOException
Helper method to read a single line of unencoded text
is - the input stream
java.io.IOException - if an input or output exception occurs
public static final void writeLine(java.lang.String s,
java.io.OutputStream out)
throws java.io.IOException
Write a line to an output stream.
s - the stringout - the output stream
java.io.IOException - if an input or output exception occurs
public static final java.io.InputStream bufferData(java.io.InputStream in)
throws java.io.IOException
Helper method to read data
in - the input stream
java.io.IOException - if an input or output exception occurs
public static final void handledError(java.lang.String responseLine,
java.io.InputStream in)
throws java.io.IOException,
java.lang.RuntimeException,
java.security.GeneralSecurityException
Helper method for handling errors.
responseLine - the response consisting of an exceptionin - the input stream
java.io.IOException - if an input or output exception occurs
java.lang.RuntimeException - if a server doesn't support an operation or another runtime exception occurs
java.security.GeneralSecurityException
public static final java.io.InputStream readData(java.io.InputStream is)
throws java.io.IOException
Helper method for reading data.
is - the input stream
java.io.IOException - if an input or output exception occurs
public static final byte[] readDataBytes(java.io.InputStream bis)
throws java.io.IOException
Helper method to return all bytes from an input stream.
bis - the input stream
java.io.IOException - if an input or output exception occurs
public static final void writeData(byte[] data,
java.io.OutputStream out)
throws java.io.IOException
Helper method for writing bytes to an output stream. Formats into two "lines", the first is the length of bytes plus Token.EOL, then the bytes plus Token.EOL.
data - the data bytesout - the output stream
java.io.IOException - if an input or output exception occurs
public static final void write2dData(byte[][] data,
java.io.OutputStream out)
throws java.io.IOException
data - out -
java.io.IOException
public static final byte[][] read2dData(java.io.InputStream in)
throws java.io.IOException
in -
java.io.IOException
public static final void write3dData(byte[][][] data,
java.io.OutputStream out)
throws java.io.IOException
data - out -
java.io.IOException
public static final byte[][][] read3dData(java.io.InputStream in)
throws java.io.IOException
in -
java.io.IOException
public static final void writeBytes(byte[] bytes,
java.io.OutputStream out)
throws java.io.IOException
bytes - out -
java.io.IOException
public static final byte[] readBytes(int length,
java.io.InputStream in)
throws java.io.IOException
length - in -
java.io.IOException
public static final void writeByte(byte b,
java.io.OutputStream out)
throws java.io.IOException
b - out -
java.io.IOException
public static final byte readByte(java.io.InputStream in)
throws java.io.IOException
in -
java.io.IOException
public static final void writeLong(long l,
java.io.OutputStream out)
throws java.io.IOException
Helper method for writing a long to an output stream.
l - the long to writeout - the output stream
java.io.IOException - if an input or output exception occurs
public static final long readLong(java.io.InputStream is)
throws java.io.IOException
Helper method to read a long from an input stream.
is - the input stream
java.io.IOException - if an input or output exception occurs
public static final void writeInt(int i,
java.io.OutputStream out)
throws java.io.IOException
Helper method for writing an integer to an output stream.
i - the integer to writeout - the output stream
java.io.IOException - if an input or output exception occurs
public static final int readInt(java.io.InputStream is)
throws java.io.IOException
Helper method to read an integer from an input stream.
is - the input stream
java.io.IOException - if an input or output exception occurs
public static final void writeBoolean(boolean b,
java.io.OutputStream out)
throws java.io.IOException
Helper method for writing an integer to an output stream.
b - the boolean to writeout - the output stream
java.io.IOException - if an input or output exception occurs
public static final boolean readBoolean(java.io.InputStream is)
throws java.io.IOException
Helper method to read an integer from an input stream.
is - the input stream
java.io.IOException - if an input or output exception occurs
public static final void writeError(java.lang.String message,
java.io.OutputStream out)
throws java.io.IOException
Helper method to write out an error message to the output stream.
message - the message to output as an errorout - the output stream
java.io.IOException - if an input or output exception occurs
public static final void writeSignature(Signature sig,
java.io.OutputStream bos)
throws java.lang.Exception
Helper method to write out a signature to an output stream.
sig - the signaturebos - the output stream
java.lang.Exception - if any exception occurs
public static final Signature readSignature(java.io.InputStream in)
throws java.lang.Exception
Helper method to read a signature from an input stream.
in - the input stream
java.lang.Exception - if any exception occurs
public static final void checkOK(java.io.InputStream in)
throws java.io.IOException,
java.security.GeneralSecurityException
Helper method that will throw an IOException if the input stream does not start with an Token.OK_STRING line.
in - the input stream
java.io.IOException - if an input or output exception occurs
java.security.GeneralSecurityException
public static final void checkOK(java.lang.String line,
java.io.InputStream is)
throws java.io.IOException,
java.security.GeneralSecurityException
Helper method that will throw an IOException if the line is not an Token.OK_STRING
line - the line checked for errorsis - the input stream
java.io.IOException - if an input or output exception occurs
java.security.GeneralSecurityException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||