org.PingOO.DLAI.lib.util
Class BinaryData

java.lang.Object
  |
  +--org.PingOO.DLAI.lib.util.BinaryData

public final class BinaryData
extends java.lang.Object

A pseudo-file, containing bytes array and a file name.
Used to transfert binary datas (including files) over the network, from various sources.

Since:
PingOO 2.0
Version:
2.0
Author:
Fabrice Bouyé (bouye@cur-archamps.fr)

Field Summary
private  byte[] data
          The byte datas.
private  java.lang.String name
          The name of this object.
 
Constructor Summary
BinaryData(byte[] data)
          Creates a new instance of this class.
BinaryData(java.lang.String name, byte[] data)
          Creates a new instance of this class.
 
Method Summary
 java.lang.Object clone()
          Gets a clone of this object.
 byte[] getData()
          Returns the byte data contained in this object.
 java.lang.String getName()
          Return the name of this object.
 void setData(byte[] data)
          Sets the data contained in this object.
 void setName(java.lang.String name)
          Sets the name of this object.
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

name

private java.lang.String name
The name of this object.

data

private byte[] data
The byte datas.
Constructor Detail

BinaryData

public BinaryData(byte[] data)
           throws java.lang.NullPointerException
Creates a new instance of this class.
Parameters:
data - The byte data to be contained by this object.
Throws:
NulPointerException - If the byte array is null.

BinaryData

public BinaryData(java.lang.String name,
                  byte[] data)
           throws java.lang.NullPointerException
Creates a new instance of this class.
Parameters:
name - The name of this object, can be null.
data - The byte data to be contained by this object.
Throws:
NulPointerException - If the byte array is null.
Method Detail

getData

public final byte[] getData()
Returns the byte data contained in this object.
Returns:
The byte data contained in this object.

setData

public final void setData(byte[] data)
                   throws java.lang.NullPointerException
Sets the data contained in this object.
Parameters:
data - The new byte array.
Throws:
NulPointerException - If the byte array is null.

getName

public final java.lang.String getName()
Return the name of this object.
Returns:
The name of this object, or null if this object has no name.

setName

public final void setName(java.lang.String name)
Sets the name of this object.
Parameters:
name - The new name, can be null.

clone

public java.lang.Object clone()
Gets a clone of this object.
Returns:
An object which is a clone of this object.
Overrides:
clone in class java.lang.Object