public class MarshallingUtil extends Object
| Constructor and Description |
|---|
MarshallingUtil() |
| Modifier and Type | Method and Description |
|---|---|
long[] |
convertByteArrayToLongArray(byte[] sequenceOfBytes)
Converts a byte[] into a long[]
|
byte[] |
convertLongArrayToByteArray(long[] sequenceOfLongs)
Converts a long[] into a byte[].
|
static MarshallingUtil |
getInstance()
Deprecated.
|
int |
getInt(byte[] data,
int offset)
Given a sequence of bytes, this method returns the int value associated
with the sequence of bytes.
|
Properties |
readProperties(DataInputStream din)
Reads a property object from the underlying DataInputStream
|
String |
readString(DataInputStream din)
Reads a String from the underlying DataInputStream
|
void |
writeProperties(DataOutputStream dout,
Properties properties)
Writes a java.util.Properties object to the underlying DataOutputStream
|
void |
writeString(DataOutputStream dout,
String element)
Writes a String to the underlying DataOutputStream
|
@Deprecated public static MarshallingUtil getInstance()
MarshallingUtilpublic long[] convertByteArrayToLongArray(byte[] sequenceOfBytes)
throws IOException
sequenceOfBytes - The byte[] inputIOException - If there are problems in the conversion process.public byte[] convertLongArrayToByteArray(long[] sequenceOfLongs)
throws IOException
sequenceOfLongs - The long[] inputIOException - If there are problems in the conversion process.public void writeProperties(DataOutputStream dout, Properties properties) throws IOException
dout - The instance of the DataOutputStreamproperties - The Properties instance that needs to be serialized.IOException - If there are problems in the marshalling process.public Properties readProperties(DataInputStream din) throws IOException
din - The instance of the DataInputStream where the
Properties instance will be read from.Properties instanceIOException - If there are problems in the unmarshalling process.public void writeString(DataOutputStream dout, String element) throws IOException
dout - The instance of the DataOutputStreamelement - The String that needs to be writtenIOException - If there are problems in the Marshalling process.public String readString(DataInputStream din) throws IOException
din - The instance of the DataInputStream where the
String will be read from.String instanceIOException - If there are problems in the un-marshalling process.public int getInt(byte[] data,
int offset)
(data.length - offset) >= 4; otherwise, an illegal Argument
exception will be thrown.data - The byte[] which would be used to reconstruct the bytesoffset - The point from which an attempt to reconstruct the integer
must be madeint value associated with the byte[] starting at
the specified offset.Copyright © 2015. All rights reserved.