com.cisco.provisioning.cpe.extensions.services
Class Blob

java.lang.Object
  extended by com.cisco.provisioning.cpe.extensions.services.Blob
All Implemented Interfaces:
com.cisco.csrc.encode.Encodable, Externalizable, Serializable

public class Blob
extends Object
implements Externalizable, com.cisco.csrc.encode.Encodable

This object provides a wrapper for byte array, so it could be serialized and stored as an attribute in any logical layer database object.

See Also:
Serialized Form

Constructor Summary
Blob()
          Default constructor required for externalizable classes.
Blob(byte[] blob)
          Creates an instance of this class that wraps a byte array.
 
Method Summary
 void decode(ByteArrayInputStream in, com.cisco.csrc.encode.DataDecoder decoder)
          Decodes object out of binary data using a specified decoder.
 void encode(ByteArrayOutputStream out, com.cisco.csrc.encode.DataEncoder encoder)
          Encodes object in a binary format.
 byte[] getBinaryData()
          Returns the binary data for this blob.
 long getLength()
          Returns the length of the binary data for this blob.
 void readExternal(ObjectInput in)
          Externalizable interface.
 void writeExternal(ObjectOutput out)
          Externalizable interface.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Blob

public Blob(byte[] blob)
Creates an instance of this class that wraps a byte array.


Blob

public Blob()
Default constructor required for externalizable classes.

Method Detail

getBinaryData

public byte[] getBinaryData()
Returns the binary data for this blob.

Returns:
byte array of data

getLength

public long getLength()
Returns the length of the binary data for this blob.

Returns:
length of the byte array

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Externalizable interface. The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.

Specified by:
readExternal in interface Externalizable
Parameters:
in - the stream to read data from in order to restore the object
Throws:
IOException - if I/O errors occur
ClassNotFoundException - If the class for an object being restored cannot be found.

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Externalizable interface. The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Specified by:
writeExternal in interface Externalizable
Parameters:
out - the stream to write the object to
Throws:
IOException - Includes any I/O exceptions that may occur

encode

public void encode(ByteArrayOutputStream out,
                   com.cisco.csrc.encode.DataEncoder encoder)
Encodes object in a binary format.

Specified by:
encode in interface com.cisco.csrc.encode.Encodable
Parameters:
out - the output stream to write to
encoder - the encoder to use for primitive types

decode

public void decode(ByteArrayInputStream in,
                   com.cisco.csrc.encode.DataDecoder decoder)
Decodes object out of binary data using a specified decoder.

Specified by:
decode in interface com.cisco.csrc.encode.Encodable
Parameters:
in - input stream containing binary data
decoder - the decoder to use