Project JXTA

net.jxta.endpoint
Class NewInputStreamMessageElement

java.lang.Object
  |
  +--net.jxta.endpoint.NewMessageElement
        |
        +--net.jxta.endpoint.NewInputStreamMessageElement
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 NewInputStreamMessageElement
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.


Fields inherited from class net.jxta.endpoint.NewMessageElement
name, properties, sig, type
 
Constructor Summary
NewInputStreamMessageElement(java.lang.String name, MimeMediaType type, java.io.InputStream in, long len, NewMessageElement sig)
          Deprecated. Create a new Message Element.
NewInputStreamMessageElement(java.lang.String name, MimeMediaType type, java.io.InputStream in, NewMessageElement sig)
          Deprecated. Create a new MessageElement.
 
Method Summary
 boolean equals(java.lang.Object target)
          Deprecated. Compare this MessageElement against another
 long getByteLength()
          Deprecated. Returns the size of the element data.
 java.io.InputStream getStream()
          Deprecated. Returns a stream containing the element data.
 int hashCode()
          Deprecated. Returns a hash code value for the object.
 
Methods inherited from class net.jxta.endpoint.NewMessageElement
clone, getFileExtension, getMessageProperty, getMimeType, getName, getSequentialName, getSignature, getUniqueName, sendToStream, setMessageProperty, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NewInputStreamMessageElement

public NewInputStreamMessageElement(java.lang.String name,
                                    MimeMediaType type,
                                    java.io.InputStream in,
                                    NewMessageElement sig)
                             throws java.io.IOException
Deprecated. 
Create a new MessageElement. This constructor copies the data as needed and closes the stream upon completion. If the stream does not support the "mark" operation then the data is copied immediately.
Parameters:
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"
in - the stream containing the body of the Element. The stream will be closed by the Element.
sig - optional message digest/digital signature elemnent. If no signature is to be specified, pass null.
Throws:
java.io.IOException - If there is a problem reading from the source stream.
Since:
JXTA 1.0

NewInputStreamMessageElement

public NewInputStreamMessageElement(java.lang.String name,
                                    MimeMediaType type,
                                    java.io.InputStream in,
                                    long len,
                                    NewMessageElement sig)
                             throws java.io.IOException
Deprecated. 
Create a new Message Element.
Parameters:
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"
in - the stream containing the body of the Element. If the stream does not support the "mark" operation then a copy of the stream contents is made immediately. The stream will NOT be closed by the Element.
len - The size of the Element will be limited to len bytes from the stream. If you are using the stream interface and know the size of the stream, specifying it here improves performance and space effciency a lot.
sig - optional message digest/digital signature elemnent. If no signature is to be specified, pass null.
Throws:
java.io.IOException - if there is a problem reading from the source stream
Since:
JXTA 1.0
Method Detail

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()
                              throws java.io.IOException
Deprecated. 
Returns a stream containing the element data. This stream may be a shared input stream. Do not call 'mark()' on this stream. (it may be enforced in some implementations).
Overrides:
getStream in class NewMessageElement
Returns:
InputStream of the stream containing element data.
Throws:
java.io.IOException - if there is a problem generating the stream
Since:
JXTA 1.0

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.

Project JXTA