Project JXTA

net.jxta.endpoint
Class NewByteArrayMessageElement

java.lang.Object
  |
  +--net.jxta.endpoint.NewMessageElement
        |
        +--net.jxta.endpoint.NewByteArrayMessageElement
All Implemented Interfaces:
java.lang.Cloneable, Document

Deprecated. Though new to this release, this class will be disappearing in the next stable release. Do not write code which imports this class!

public class NewByteArrayMessageElement
extends NewMessageElement

A Message is composed of MessageElements. An MessageElement has an optional name, an optional type (which defaults to "Application/Octet-stream"), a body and an optional digest/digital signature.


Field Summary
protected  byte[] b
          Deprecated. The bytes of this element.
protected  int len
          Deprecated. length of the element data.
protected  int offset
          Deprecated. This is the offset of our data within the array
 
Fields inherited from class net.jxta.endpoint.NewMessageElement
name, properties, sig, type
 
Constructor Summary
NewByteArrayMessageElement(java.lang.String name, MimeMediaType type, byte[] b, int offset, int len, NewMessageElement sig)
          Deprecated. Create a new Element, but dont add it to the message.
NewByteArrayMessageElement(java.lang.String name, MimeMediaType type, byte[] b, int offset, NewMessageElement sig)
          Deprecated. Create a new Element, but dont add it to the message.
NewByteArrayMessageElement(java.lang.String name, MimeMediaType type, byte[] b, NewMessageElement sig)
          Deprecated. Create a new Message Element.
 
Method Summary
 boolean equals(java.lang.Object target)
          Deprecated. Compare this MessageElement against another
 long getByteLength()
          Deprecated. Returns the size of the element data.
 byte[] getBytes()
          Deprecated. Returns the contents of this element as a byte array.
 java.io.InputStream getStream()
          Deprecated. Returns a stream containing the element data.
 int hashCode()
          Deprecated. Returns a hash code value for the object.
 void sendToStream(java.io.OutputStream sendTo)
          Deprecated. Sends the element data to the specified stream
 java.lang.String toString()
          Deprecated. Returns the string representation of this element.
 
Methods inherited from class net.jxta.endpoint.NewMessageElement
clone, getFileExtension, getMessageProperty, getMimeType, getName, getSequentialName, getSignature, getUniqueName, setMessageProperty
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

b

protected byte[] b
Deprecated. 
The bytes of this element.

offset

protected int offset
Deprecated. 
This is the offset of our data within the array

len

protected int len
Deprecated. 
length of the element data. sometimes the same as b.length, but may be lesser.
Constructor Detail

NewByteArrayMessageElement

public NewByteArrayMessageElement(java.lang.String name,
                                  MimeMediaType type,
                                  byte[] b,
                                  NewMessageElement sig)
Deprecated. 
Create a new Message Element. The contents of the byte array ARE copied during construction.
Parameters:
namespace - namespace for the MessageElement.
name - Name of the Element. May be the empty string ("") if the Element is not named.
type - Type of the Element. null is equivalent to specifying the type "Application/Octet-stream"
b - A byte array containing the contents of this element.
sig - optional message digest/digital signature elemnent. If no signature is to be specified, pass null.
Throws:
NullPointerException - if name or b are null.
Since:
JXTA 1.0

NewByteArrayMessageElement

public NewByteArrayMessageElement(java.lang.String name,
                                  MimeMediaType type,
                                  byte[] b,
                                  int offset,
                                  NewMessageElement sig)
Deprecated. 
Create a new Element, but dont add it to the message. The contents of the byte array ARE copied during construction.
Parameters:
namespace - namespace for the MessageElement.
name - Name of the Element. May be the empty string ("") if the Element is not named.
type - Type of the Element. null is equivalent to specifying the type "Application/Octet-stream"
b - A byte array containing the contents of this element.
offset - all bytes before this location in b will be ignored.
sig - optional message digest/digital signature elemnent. If no signature is to be specified, pass null.
Throws:
NullPointerException - if name or b are null.
IndexOutOfBoundsException - if offset is negative or greater than or equal to the length of b
Since:
JXTA 1.0

NewByteArrayMessageElement

public NewByteArrayMessageElement(java.lang.String name,
                                  MimeMediaType type,
                                  byte[] b,
                                  int offset,
                                  int len,
                                  NewMessageElement sig)
Deprecated. 
Create a new Element, but dont add it to the message. The contents of the byte array ARE copied during construction.
Parameters:
namespace - namespace for the MessageElement.
name - Name of the Element. May be the empty string ("") if the Element is not named.
type - Type of the Element. null is equivalent to specifying the type "Application/Octet-stream"
b - A byte array containing the contents of this Element.
offset - all bytes before this location will be ignored.
len - number of bytes to include
sig - optional message digest/digital signature elemnent. If no signature is to be specified, pass null.
Throws:
NullPointerException - if name or b are null.
IndexOutOfBoundsException - if offset is negative or greater than or equal to the length of b or if offset + len is greater than the length of b
Since:
JXTA 1.0
Method Detail

equals

public boolean equals(java.lang.Object target)
Deprecated. 
Compare this MessageElement against another
Overrides:
equals in class NewMessageElement
Parameters:
target - The to compare against.
Returns:
boolean true if the elements are identical.
Since:
JXTA 1.0

hashCode

public int hashCode()
Deprecated. 
Returns a hash code value for the object. This method is supported for the benefit of hashtables.
Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this object.

toString

public java.lang.String toString()
Deprecated. 
Returns the string representation of this element. The 'charset' parameter of the mimetype, if any, is used to determine encoding. If the charset specified is unsupported then the default enconding will be used.
Overrides:
toString in class NewMessageElement
Returns:
String string representation of this message element.

getByteLength

public long getByteLength()
Deprecated. 
Returns the size of the element data.
Overrides:
getByteLength in class NewMessageElement
Returns:
long containing the size of the element data.
Since:
JXTA 1.0

getStream

public java.io.InputStream getStream()
Deprecated. 
Returns a stream containing the element data.
Overrides:
getStream in class NewMessageElement
Returns:
InputStream of the stream containing element data.
Since:
JXTA 1.0

sendToStream

public void sendToStream(java.io.OutputStream sendTo)
                  throws java.io.IOException
Deprecated. 
Sends the element data to the specified stream
Overrides:
sendToStream in class NewMessageElement
Parameters:
sendTo - the output stream to send the data to.
Since:
JXTA 1.0

getBytes

public byte[] getBytes()
Deprecated. 
Returns the contents of this element as a byte array. If this elements was originally constructed from a intact byte array, the array returned is a "shared" copy of the byte array used by this element. If this element was constructed with an offset of other than zero and a length different than the length of the source array then this function WILL RETURN A COPY OF THE BYTE ARRAY.
Returns:
a byte array containing the contents of this element.

Project JXTA