Package net.handle.hdllib
Class Encoder
- java.lang.Object
-
- net.handle.hdllib.Encoder
-
public abstract class Encoder extends java.lang.ObjectThe static functions in this class are used to translate message objects and records to and from their byte-array representation in which they are sent over the network.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEncoder.MessageHeaders
-
Field Summary
Fields Modifier and Type Field Description static byteENV_FLAG_COMPRESSEDstatic byteENV_FLAG_ENCRYPTEDstatic byteENV_FLAG_TRUNCATEDstatic intINT_SIZEstatic intINT2_SIZEstatic intLONG_SIZEstatic intMSG_FLAG_AUTHstatic intMSG_FLAG_CACRstatic intMSG_FLAG_CERTstatic intMSG_FLAG_CONTstatic intMSG_FLAG_DNRFstatic intMSG_FLAG_ENCRstatic intMSG_FLAG_KPALstatic intMSG_FLAG_MINTstatic intMSG_FLAG_OVRWstatic intMSG_FLAG_PUBLstatic intMSG_FLAG_RECUstatic intMSG_FLAG_RRDGstatic java.lang.StringMSG_INVALID_ARRAY_SIZEstatic bytePERM_ADMIN_READstatic bytePERM_ADMIN_WRITEstatic bytePERM_PUBLIC_READstatic bytePERM_PUBLIC_WRITEstatic intSESSION_FLAG_CERTstatic intSESSION_FLAG_ENCR
-
Constructor Summary
Constructors Constructor Description Encoder()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static intcalcHandleValueSize(byte[] values, int offset)Calculate the number of bytes required to store the specified valuestatic intcalcStorageSize(HandleValue value)Calculate the number of bytes required to store the specified valuestatic intcalculateAdminRecordSize(AdminRecord admin)Calculate the size that a buffer would have to be in order to hold an encoded value of the given admin record.static AddValueRequestdecodeAddValueRequest(byte[] msg, int offset, MessageEnvelope env)Decode, create, and return an AddValueRequest object from the given bufferstatic AdminRecorddecodeAdminRecord(byte[] data, int offset)static voiddecodeAdminRecord(byte[] data, int offset, AdminRecord admin)Decode an administrator record from the given byte array.static CreateHandleRequestdecodeCreateHandleRequest(byte[] msg, int offset, MessageEnvelope env, int opCode)Decode, create, and return a CreateHandleRequest from the given bufferstatic DeleteHandleRequestdecodeDeleteHandleRequest(byte[] msg, int offset, MessageEnvelope env)Decode, create, and return a DeleteHandleRequest from the given bufferstatic voiddecodeEnvelope(byte[] udpPkt, MessageEnvelope msgEnv)Read the encoded value of the given buffer and populate the fields of the given message envelope object.static GenericRequestdecodeGenericRequest(byte[] msg, int offset, int opCode, MessageEnvelope env)Decode and return a generic request method with the given encoding and opCode This returns a GenericRequest object which consists of all the normal message info along with a handle.static GenericResponsedecodeGenericResponse(byte[] msg, int loc, MessageEnvelope env)Decode the given generic message (ie no body, identified only by the opCode and responseCode) from the given buffer.static HandleValue[]decodeGlobalValues(java.io.InputStream in)Decode from the given input stream a set of handle values.static HandleValue[]decodeHandleValue(byte[][] handleValues)Deprecated.static intdecodeHandleValue(byte[] buf, int offset, HandleValue value)Populate the specified handle value with the values encoded in the given byte array and return the number of bytes read.static HandleValue[]decodeHandleValues(byte[] buf)Decode from the given byte buffer, a set of handle values.static HandleValue[]decodeHandleValues(byte[][] handleValues)Converts a raw buffer into an array of HandleValue.static java.util.Map<java.lang.String,java.lang.String>decodeLocalAddresses(java.io.InputStream in)Reads pairs of IP addresses into a hashtable.static java.util.Map<java.lang.String,SiteInfo[]>decodeLocalSites(java.io.InputStream in)Reads SiteInfo/NA-list pairs into a hashtable.static AbstractMessagedecodeMessage(byte[] msg, int offset, MessageEnvelope envelope)decode a response message - given the message buffer and a separate 0 envelop, return a response object.static ModifyValueRequestdecodeModifyValueRequest(byte[] msg, int offset, MessageEnvelope env)Decode, create, and return a ModifyValueRequest object from the given bufferstatic voiddecodeOpFlagsInToMessage(AbstractMessage message, int opFlags)static RemoveValueRequestdecodeRemoveValueRequest(byte[] msg, int offset, MessageEnvelope env)Decode, create, and return a RemoveValueRequest object from the given bufferstatic ResolutionRequestdecodeResolutionRequest(byte[] msg, int offset, MessageEnvelope env)Decode and create a resolution request object from the given buffer.static ResolutionResponsedecodeResolutionResponse(byte[] msg, int offset, MessageEnvelope env)Decode and create a resolution response object from the given buffer.static ServiceReferralResponsedecodeServiceReferralResponse(int responseCode, byte[] msg, int offset, MessageEnvelope env, int endOfBuf)static SiteInfodecodeSiteInfoRecord(byte[] data, int offset)Decode a site info record from a byte array.static voiddecodeSiteInfoRecord(byte[] data, int offset, SiteInfo site)Decode a site info record from a byte array.static ValueReference[]decodeValueReferenceList(byte[] buf, int offset)Decode, create, and return a list of handle value references (handle/index pairs) from the given buffer.static voiddumpBytes(byte[] buf)Display the contents of the given buffer in a somewhat human-readable format.static voiddumpBytes(byte[] buf, int len)Display the contents of the given buffer in a somewhat human-readable format.static voiddumpBytes(byte[] buf, int offset, int len)Display the contents of the given buffer in a somewhat human-readable format.static byte[]encodeAddValueRequest(AddValueRequest req)Encode an AddValueRequest object and return the buffer with the encoding.static byte[]encodeAdminRecord(AdminRecord admin)Encode the given admin record into a byte array and return it.static byte[]encodeCreateHandleRequest(CreateHandleRequest req)Encode the given CreateHandleRequest and return the resulting buffer.static byte[]encodeCreateHandleResponse(CreateHandleResponse res)static byte[]encodeDeleteHandleRequest(DeleteHandleRequest req)Encode the given DeleteHandleRequest and return the resulting buffer.static voidencodeEnvelope(MessageEnvelope msgEnv, byte[] udpPkt)Write the encoded value of the given message envelope to the given buffer.static byte[]encodeGenericRequest(AbstractRequest req)Encode a generic request (containing a handle, and the basic header info).static byte[]encodeGenericResponse(AbstractMessage res)Encode the given generic message (identified only by the opCode, and responseCode) and return the resulting buffer.static byte[]encodeGlobalValues(HandleValue[] values)Encode the given handle values into a buffer that can be used as the global (or root) service/site information.static intencodeHandleValue(byte[] buf, int offset, HandleValue value)Encode the values of the handle into the specified array starting at offset.static byte[]encodeHandleValue(HandleValue value)static byte[][]encodeHandleValues(HandleValue[] values)static byte[]encodeLocalSites(SiteInfo[] sites, java.lang.String[][] na)Encode the given String[]/SiteInfo pairs into a buffer that can be used as the local service/site information.static byte[]encodeMessage(AbstractMessage msg)Encode the given message object as a byte array and return the resulting buffer.static byte[]encodeModifyValueRequest(ModifyValueRequest req)Encode a ModifyValueRequest object and return the buffer with the encoding.static byte[]encodeRemoveValueRequest(RemoveValueRequest req)Encode a RemoveValueRequest object and return the buffer with the encoding.static byte[]encodeResolutionRequest(ResolutionRequest req)Encode the given ResolutionRequest and return the resulting bufferstatic byte[]encodeResolutionResponse(ResolutionResponse res)Encode the given ResolutionResponse and return the resulting bufferstatic byte[]encodeSecretKey(byte[] secretKey, boolean hash)Encode the given secret key into a byte array, performing an SHA1 hash and lower-case hex encoding if the hash flag is set.static byte[]encodeServiceReferralResponse(ServiceReferralResponse res)static byte[]encodeSiteInfoRecord(SiteInfo site)Encode the given site info record into a byte array and return the result.static byte[]encodeValueReferenceList(ValueReference[] values)Encode the given list of handle value references (handle/index pairs) and return the resulting byte array.static intgetHandleValueIndex(byte[] buf, int offset)Get only the index from the encoded handle value starting at offset.static bytegetHandleValuePermissions(byte[] buf, int offset)Get only the permissions from the encoded handle value starting at offset.static byte[]getHandleValueType(byte[] buf, int offset)Get only the type from the encoded handle value starting at offset.static byte[]readByteArray(byte[] buf, int offset)Read a byte array from the given buffer starting at the specified location.static intreadByteArrayArray(byte[][] a, byte[] buf, int offset)This allocates and reads an array of byte arrays where the length of the array is already known.static intreadInt(byte[] buf, int offset)Read a 4-byte integer value from the given byte array starting at the specified location.static intreadInt2(byte[] buf, int offset)Read a 2-byte integer value from the given byte array starting at the specified location.static int[]readIntArray(byte[] buf, int offset)Read an array of 4-byte integer values from the given buffer starting at the specified location.static longreadLong(byte[] buf, int offset)Read an 8-octet integer (java long) value from the given byte array starting at the specified location.static intreadOpCode(byte[] msg, int offset)static intwriteByteArray(byte[] buf, int offset, byte[] bufToWrite)Write the given byte array to a given buffer starting at the specified location.static intwriteByteArray(byte[] buf, int offset, byte[] bufToWrite, int woffset, int length)Write the given byte array to a given buffer starting at the specified location.static intwriteByteArrayArray(byte[] buf, int offset, byte[][] bufToWrite)This writes an array of byte arrays to the given buffer.static intwriteInt(byte[] buf, int offset, int value)Write a 4-byte integer value into the given byte array starting at the specified location.static intwriteInt2(byte[] buf, int offset, int value)Write a 2-byte integer value into the given byte array starting at the specified location.static intwriteIntArray(byte[] buf, int offset, int[] bufToWrite)This writes a given array of integers to the given buffer, starting at the specified location.static voidwriteLocalAddresses(java.util.Map<?,?> map, java.io.OutputStream out)Writes pairs of IP addresses into a hashtable.static intwriteLong(byte[] buf, int offset, long value)Write an 8-octet integer (java long) value into the given byte array starting at the specified location.
-
-
-
Field Detail
-
INT_SIZE
public static final int INT_SIZE
- See Also:
- Constant Field Values
-
INT2_SIZE
public static final int INT2_SIZE
- See Also:
- Constant Field Values
-
LONG_SIZE
public static final int LONG_SIZE
- See Also:
- Constant Field Values
-
MSG_FLAG_AUTH
public static final int MSG_FLAG_AUTH
- See Also:
- Constant Field Values
-
MSG_FLAG_CERT
public static final int MSG_FLAG_CERT
- See Also:
- Constant Field Values
-
MSG_FLAG_ENCR
public static final int MSG_FLAG_ENCR
- See Also:
- Constant Field Values
-
MSG_FLAG_RECU
public static final int MSG_FLAG_RECU
- See Also:
- Constant Field Values
-
MSG_FLAG_CACR
public static final int MSG_FLAG_CACR
- See Also:
- Constant Field Values
-
MSG_FLAG_CONT
public static final int MSG_FLAG_CONT
- See Also:
- Constant Field Values
-
MSG_FLAG_KPAL
public static final int MSG_FLAG_KPAL
- See Also:
- Constant Field Values
-
MSG_FLAG_PUBL
public static final int MSG_FLAG_PUBL
- See Also:
- Constant Field Values
-
MSG_FLAG_RRDG
public static final int MSG_FLAG_RRDG
- See Also:
- Constant Field Values
-
MSG_FLAG_OVRW
public static final int MSG_FLAG_OVRW
- See Also:
- Constant Field Values
-
MSG_FLAG_MINT
public static final int MSG_FLAG_MINT
- See Also:
- Constant Field Values
-
MSG_FLAG_DNRF
public static final int MSG_FLAG_DNRF
- See Also:
- Constant Field Values
-
ENV_FLAG_COMPRESSED
public static final byte ENV_FLAG_COMPRESSED
- See Also:
- Constant Field Values
-
ENV_FLAG_ENCRYPTED
public static final byte ENV_FLAG_ENCRYPTED
- See Also:
- Constant Field Values
-
ENV_FLAG_TRUNCATED
public static final byte ENV_FLAG_TRUNCATED
- See Also:
- Constant Field Values
-
PERM_ADMIN_READ
public static final byte PERM_ADMIN_READ
- See Also:
- Constant Field Values
-
PERM_ADMIN_WRITE
public static final byte PERM_ADMIN_WRITE
- See Also:
- Constant Field Values
-
PERM_PUBLIC_READ
public static final byte PERM_PUBLIC_READ
- See Also:
- Constant Field Values
-
PERM_PUBLIC_WRITE
public static final byte PERM_PUBLIC_WRITE
- See Also:
- Constant Field Values
-
MSG_INVALID_ARRAY_SIZE
public static final java.lang.String MSG_INVALID_ARRAY_SIZE
- See Also:
- Constant Field Values
-
SESSION_FLAG_CERT
public static final int SESSION_FLAG_CERT
- See Also:
- Constant Field Values
-
SESSION_FLAG_ENCR
public static final int SESSION_FLAG_ENCR
- See Also:
- Constant Field Values
-
-
Method Detail
-
readLong
public static final long readLong(byte[] buf, int offset)Read an 8-octet integer (java long) value from the given byte array starting at the specified location.
-
writeLong
public static final int writeLong(byte[] buf, int offset, long value)Write an 8-octet integer (java long) value into the given byte array starting at the specified location.
-
readInt2
public static final int readInt2(byte[] buf, int offset)Read a 2-byte integer value from the given byte array starting at the specified location.
-
writeInt2
public static final int writeInt2(byte[] buf, int offset, int value)Write a 2-byte integer value into the given byte array starting at the specified location.
-
readInt
public static final int readInt(byte[] buf, int offset)Read a 4-byte integer value from the given byte array starting at the specified location.
-
writeInt
public static final int writeInt(byte[] buf, int offset, int value)Write a 4-byte integer value into the given byte array starting at the specified location.
-
readByteArray
public static final byte[] readByteArray(byte[] buf, int offset) throws HandleExceptionRead a byte array from the given buffer starting at the specified location. This method first reads a 4-octet integer and then reads that many bytes from the buffer.- Throws:
HandleException
-
writeByteArray
public static final int writeByteArray(byte[] buf, int offset, byte[] bufToWrite)Write the given byte array to a given buffer starting at the specified location. This first writes the length of the array as a 4-octet integer, and then writes the bytes of the array.
-
writeByteArray
public static final int writeByteArray(byte[] buf, int offset, byte[] bufToWrite, int woffset, int length)Write the given byte array to a given buffer starting at the specified location. This first writes the length of the array as a 4-octet integer, and then writes the bytes of the array.
-
writeByteArrayArray
public static final int writeByteArrayArray(byte[] buf, int offset, byte[][] bufToWrite)This writes an array of byte arrays to the given buffer. This first writes the number of arrays as a 4-octet integer, and then writes each individual byte array using a call to writeByteArray.
-
writeIntArray
public static final int writeIntArray(byte[] buf, int offset, int[] bufToWrite)This writes a given array of integers to the given buffer, starting at the specified location. This first writes the length of the integer array as a 4-octet integer, then writes each integer in the array using a call to writeInt. This will return the number of bytes that were read.
-
readIntArray
public static final int[] readIntArray(byte[] buf, int offset) throws HandleExceptionRead an array of 4-byte integer values from the given buffer starting at the specified location. This method first reads a 4-octet integer and then reads that many integer values from the buffer.- Throws:
HandleException
-
readByteArrayArray
public static final int readByteArrayArray(byte[][] a, byte[] buf, int offset) throws HandleExceptionThis allocates and reads an array of byte arrays where the length of the array is already known. For each byte array in 'a', this reads a byte array using a call to readByteArray. This will return the number of bytes that were read.- Throws:
HandleException
-
dumpBytes
public static final void dumpBytes(byte[] buf)
Display the contents of the given buffer in a somewhat human-readable format. This is only used for debugging.
-
dumpBytes
public static final void dumpBytes(byte[] buf, int len)Display the contents of the given buffer in a somewhat human-readable format. This is only used for debugging.
-
dumpBytes
public static final void dumpBytes(byte[] buf, int offset, int len)Display the contents of the given buffer in a somewhat human-readable format. This is only used for debugging.
-
readOpCode
public static int readOpCode(byte[] msg, int offset)
-
decodeMessage
public static final AbstractMessage decodeMessage(byte[] msg, int offset, MessageEnvelope envelope) throws HandleException
decode a response message - given the message buffer and a separate 0 envelop, return a response object. If the message is a certified message, the signature for the message is read and put into the message object.- Throws:
HandleException
-
decodeOpFlagsInToMessage
public static void decodeOpFlagsInToMessage(AbstractMessage message, int opFlags)
-
decodeSiteInfoRecord
public static SiteInfo decodeSiteInfoRecord(byte[] data, int offset) throws HandleException
Decode a site info record from a byte array.- Throws:
HandleException
-
decodeSiteInfoRecord
public static void decodeSiteInfoRecord(byte[] data, int offset, SiteInfo site) throws HandleExceptionDecode a site info record from a byte array.- Throws:
HandleException
-
encodeSiteInfoRecord
public static byte[] encodeSiteInfoRecord(SiteInfo site)
Encode the given site info record into a byte array and return the result.
-
decodeAdminRecord
public static AdminRecord decodeAdminRecord(byte[] data, int offset) throws HandleException
- Throws:
HandleException
-
decodeAdminRecord
public static void decodeAdminRecord(byte[] data, int offset, AdminRecord admin) throws HandleExceptionDecode an administrator record from the given byte array.- Throws:
HandleException
-
encodeAdminRecord
public static byte[] encodeAdminRecord(AdminRecord admin)
Encode the given admin record into a byte array and return it.
-
encodeSecretKey
public static byte[] encodeSecretKey(byte[] secretKey, boolean hash) throws java.lang.ExceptionEncode the given secret key into a byte array, performing an SHA1 hash and lower-case hex encoding if the hash flag is set. If the hash flag is not set this may return the same secretKey array that was passed as a parameter.- Throws:
java.lang.Exception
-
calculateAdminRecordSize
public static int calculateAdminRecordSize(AdminRecord admin)
Calculate the size that a buffer would have to be in order to hold an encoded value of the given admin record.
-
encodeGenericRequest
public static byte[] encodeGenericRequest(AbstractRequest req)
Encode a generic request (containing a handle, and the basic header info).
-
decodeGenericRequest
public static GenericRequest decodeGenericRequest(byte[] msg, int offset, int opCode, MessageEnvelope env) throws HandleException
Decode and return a generic request method with the given encoding and opCode This returns a GenericRequest object which consists of all the normal message info along with a handle.- Throws:
HandleException
-
encodeHandleValue
public static byte[] encodeHandleValue(HandleValue value)
-
encodeHandleValues
public static byte[][] encodeHandleValues(HandleValue[] values)
-
encodeHandleValue
public static final int encodeHandleValue(byte[] buf, int offset, HandleValue value)Encode the values of the handle into the specified array starting at offset.- Returns:
- the number of bytes written to the array.;
-
getHandleValueType
public static final byte[] getHandleValueType(byte[] buf, int offset) throws HandleExceptionGet only the type from the encoded handle value starting at offset.- Throws:
HandleException
-
getHandleValueIndex
public static final int getHandleValueIndex(byte[] buf, int offset)Get only the index from the encoded handle value starting at offset.
-
getHandleValuePermissions
public static final byte getHandleValuePermissions(byte[] buf, int offset)Get only the permissions from the encoded handle value starting at offset.
-
calcStorageSize
public static final int calcStorageSize(HandleValue value)
Calculate the number of bytes required to store the specified value
-
calcHandleValueSize
public static final int calcHandleValueSize(byte[] values, int offset)Calculate the number of bytes required to store the specified value
-
decodeHandleValues
public static HandleValue[] decodeHandleValues(byte[][] handleValues) throws HandleException
Converts a raw buffer into an array of HandleValue.- Parameters:
handleValues-- Returns:
- null in the case the handleValues parameter is null;
- Throws:
HandleException
-
decodeHandleValue
@Deprecated public static HandleValue[] decodeHandleValue(byte[][] handleValues) throws HandleException
Deprecated.- Throws:
HandleException
-
decodeHandleValue
public static final int decodeHandleValue(byte[] buf, int offset, HandleValue value) throws HandleExceptionPopulate the specified handle value with the values encoded in the given byte array and return the number of bytes read.- Throws:
HandleException
-
encodeMessage
public static final byte[] encodeMessage(AbstractMessage msg) throws HandleException
Encode the given message object as a byte array and return the resulting buffer. The isResponse flag is necessary to determine the type of object being encoded (not really, maybe this can be cleaned up).- Throws:
HandleException
-
encodeEnvelope
public static final void encodeEnvelope(MessageEnvelope msgEnv, byte[] udpPkt)
Write the encoded value of the given message envelope to the given buffer.
-
decodeEnvelope
public static final void decodeEnvelope(byte[] udpPkt, MessageEnvelope msgEnv) throws HandleExceptionRead the encoded value of the given buffer and populate the fields of the given message envelope object.- Throws:
HandleException
-
decodeAddValueRequest
public static final AddValueRequest decodeAddValueRequest(byte[] msg, int offset, MessageEnvelope env) throws HandleException
Decode, create, and return an AddValueRequest object from the given buffer- Throws:
HandleException
-
encodeAddValueRequest
public static final byte[] encodeAddValueRequest(AddValueRequest req)
Encode an AddValueRequest object and return the buffer with the encoding.
-
decodeModifyValueRequest
public static final ModifyValueRequest decodeModifyValueRequest(byte[] msg, int offset, MessageEnvelope env) throws HandleException
Decode, create, and return a ModifyValueRequest object from the given buffer- Throws:
HandleException
-
encodeModifyValueRequest
public static final byte[] encodeModifyValueRequest(ModifyValueRequest req)
Encode a ModifyValueRequest object and return the buffer with the encoding.
-
decodeRemoveValueRequest
public static final RemoveValueRequest decodeRemoveValueRequest(byte[] msg, int offset, MessageEnvelope env) throws HandleException
Decode, create, and return a RemoveValueRequest object from the given buffer- Throws:
HandleException
-
encodeRemoveValueRequest
public static final byte[] encodeRemoveValueRequest(RemoveValueRequest req)
Encode a RemoveValueRequest object and return the buffer with the encoding.
-
decodeDeleteHandleRequest
public static final DeleteHandleRequest decodeDeleteHandleRequest(byte[] msg, int offset, MessageEnvelope env) throws HandleException
Decode, create, and return a DeleteHandleRequest from the given buffer- Throws:
HandleException
-
encodeDeleteHandleRequest
public static final byte[] encodeDeleteHandleRequest(DeleteHandleRequest req)
Encode the given DeleteHandleRequest and return the resulting buffer.
-
decodeGenericResponse
public static final GenericResponse decodeGenericResponse(byte[] msg, int loc, MessageEnvelope env)
Decode the given generic message (ie no body, identified only by the opCode and responseCode) from the given buffer.
-
encodeGenericResponse
public static final byte[] encodeGenericResponse(AbstractMessage res)
Encode the given generic message (identified only by the opCode, and responseCode) and return the resulting buffer.
-
decodeCreateHandleRequest
public static final CreateHandleRequest decodeCreateHandleRequest(byte[] msg, int offset, MessageEnvelope env, int opCode) throws HandleException
Decode, create, and return a CreateHandleRequest from the given buffer- Throws:
HandleException
-
encodeCreateHandleRequest
public static final byte[] encodeCreateHandleRequest(CreateHandleRequest req)
Encode the given CreateHandleRequest and return the resulting buffer.
-
decodeResolutionRequest
public static ResolutionRequest decodeResolutionRequest(byte[] msg, int offset, MessageEnvelope env) throws HandleException
Decode and create a resolution request object from the given buffer.- Throws:
HandleException
-
decodeResolutionResponse
public static ResolutionResponse decodeResolutionResponse(byte[] msg, int offset, MessageEnvelope env) throws HandleException
Decode and create a resolution response object from the given buffer.- Throws:
HandleException
-
decodeServiceReferralResponse
public static ServiceReferralResponse decodeServiceReferralResponse(int responseCode, byte[] msg, int offset, MessageEnvelope env, int endOfBuf) throws HandleException
- Throws:
HandleException
-
encodeResolutionRequest
public static final byte[] encodeResolutionRequest(ResolutionRequest req)
Encode the given ResolutionRequest and return the resulting buffer
-
encodeResolutionResponse
public static final byte[] encodeResolutionResponse(ResolutionResponse res)
Encode the given ResolutionResponse and return the resulting buffer
-
encodeServiceReferralResponse
public static final byte[] encodeServiceReferralResponse(ServiceReferralResponse res)
-
decodeValueReferenceList
public static final ValueReference[] decodeValueReferenceList(byte[] buf, int offset) throws HandleException
Decode, create, and return a list of handle value references (handle/index pairs) from the given buffer.- Throws:
HandleException
-
encodeValueReferenceList
public static final byte[] encodeValueReferenceList(ValueReference[] values)
Encode the given list of handle value references (handle/index pairs) and return the resulting byte array.
-
encodeGlobalValues
public static final byte[] encodeGlobalValues(HandleValue[] values)
Encode the given handle values into a buffer that can be used as the global (or root) service/site information.
-
encodeLocalSites
public static final byte[] encodeLocalSites(SiteInfo[] sites, java.lang.String[][] na) throws HandleException
Encode the given String[]/SiteInfo pairs into a buffer that can be used as the local service/site information. For the SiteInfo object at sites[i] the corresponding prefixes should be listed in na[i].- Throws:
HandleException
-
decodeLocalSites
public static final java.util.Map<java.lang.String,SiteInfo[]> decodeLocalSites(java.io.InputStream in) throws HandleException
Reads SiteInfo/NA-list pairs into a hashtable. Each NA value is used as a key to a SiteInfo[].- Throws:
HandleException
-
decodeLocalAddresses
public static final java.util.Map<java.lang.String,java.lang.String> decodeLocalAddresses(java.io.InputStream in) throws HandleExceptionReads pairs of IP addresses into a hashtable.- Throws:
HandleException
-
writeLocalAddresses
public static final void writeLocalAddresses(java.util.Map<?,?> map, java.io.OutputStream out) throws java.io.IOExceptionWrites pairs of IP addresses into a hashtable.- Throws:
java.io.IOException
-
decodeGlobalValues
public static final HandleValue[] decodeGlobalValues(java.io.InputStream in) throws HandleException
Decode from the given input stream a set of handle values. The stream should contain data in the format output from the encodeGlobalValues() function.- Throws:
HandleException
-
decodeHandleValues
public static final HandleValue[] decodeHandleValues(byte[] buf) throws HandleException
Decode from the given byte buffer, a set of handle values.- Throws:
HandleException
-
encodeCreateHandleResponse
public static final byte[] encodeCreateHandleResponse(CreateHandleResponse res)
-
-