Package com.tailf.proto
Class ConfEBinary
Object
com.tailf.proto.ConfEObject
com.tailf.proto.ConfEBinary
- All Implemented Interfaces:
Serializable
,Cloneable
Provides a Java representation of E binaries. Anything that can be
represented as a sequence of bytes can be made into an E binary.
- See Also:
-
Constructor Summary
ConstructorDescriptionConfEBinary
(byte[] bin) Create a binary from a byte arrayCreate a binary from a stream containing a binary encoded in E external format.Create a binary from an arbitrary Java Object. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Get the byte array from a binary.clone()
void
encode
(ConfOutputStream buf) Convert this binary to the equivalent E external representation.boolean
Determine if two binaries are equal.Get the java Object from the binary.int
hashCode()
int
size()
Get the size of the binary.Get the string representation of binarytoString()
Get the string representation of this binary object.Methods inherited from class com.tailf.proto.ConfEObject
decode
-
Constructor Details
-
ConfEBinary
public ConfEBinary(byte[] bin) Create a binary from a byte array- Parameters:
bin
- the array of bytes from which to create the binary.
-
ConfEBinary
-
ConfEBinary
Create a binary from a stream containing a binary encoded in E external format.- Parameters:
buf
- the stream containing the encoded binary.- Throws:
ConfEDecodeException
- if the buffer does not contain a valid external representation of an E binary.
-
ConfEBinary
Create a binary from an arbitrary Java Object. The object must implement java.io.Serializable or java.io.Externalizable.- Parameters:
o
- the object to serialize and create this binary from.
-
-
Method Details
-
binaryValue
public byte[] binaryValue()Get the byte array from a binary.- Returns:
- the byte array containing the bytes for this binary.
-
stringValue
Get the string representation of binary- Returns:
- a string object containing the bytes for this binary.
-
size
public int size()Get the size of the binary.- Returns:
- the number of bytes contained in the binary.
-
getObject
Get the java Object from the binary. If the binary contains a serialized Java object, then this method will recreate the object.- Returns:
- the java Object represented by this binary, or null if the binary does not represent a Java Object.
-
toString
Get the string representation of this binary object. A binary is printed as #Bin<N>, where N is the number of bytes contained in the object.- Specified by:
toString
in classConfEObject
- Returns:
- the E string representation of this binary.
-
encode
Convert this binary to the equivalent E external representation.- Specified by:
encode
in classConfEObject
- Parameters:
buf
- an output stream to which the encoded binary should be written.
-
equals
Determine if two binaries are equal. Binaries are equal if they have the same length and the array of bytes is identical.- Specified by:
equals
in classConfEObject
- Parameters:
o
- the binary to compare to.- Returns:
- true if the byte arrays contain the same bytes, false otherwise.
-
hashCode
public int hashCode() -
clone
- Overrides:
clone
in classConfEObject
-