|
JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.util.ClassFactory<MimeMediaType,WireFormatMessageFactory.Instantiator>
net.jxta.endpoint.WireFormatMessageFactory
public final class WireFormatMessageFactory
This class is a class factory for Wire Format Messages. This class abstracts The implementation of Wire Format Messages and allows for construction based on the MimeType of InputStreams.
The WireFormatMessageFactory extends the ClassFactory to register the various Message wire format implementations into a static hashtable. The factory is called with the Mime type requested to create the corresponding Wire Format type.
Message
,
WireFormatMessage
,
ClassFactory
,
MimeMediaType
Nested Class Summary | |
---|---|
static interface |
WireFormatMessageFactory.Instantiator
Interface for instantiators of wire format messages. |
Field Summary | |
---|---|
static MimeMediaType |
DEFAULT_WIRE_MIME
The mime media type of preferred/default wire format. |
Method Summary | |
---|---|
static Message |
fromBuffer(ByteBuffer buffer,
MimeMediaType type,
MimeMediaType contentEncoding)
Constructs an instance of Message from matching the type
specified by the type parameter. |
static Message |
fromWire(InputStream is,
MimeMediaType type,
MimeMediaType contentEncoding)
Constructs an instance of Message from matching the type
specified by the type parameter. |
protected Map<MimeMediaType,WireFormatMessageFactory.Instantiator> |
getAssocTable()
Used by ClassFactory methods to get the mapping of keys to constructors. |
Class |
getClassForKey()
Used by ClassFactory methods to ensure that all keys used with the mapping are of the correct type. |
Class<WireFormatMessageFactory.Instantiator> |
getClassOfInstantiators()
Used by ClassFactory methods to ensure that all of the instance classes which register with this factory have the correct base class |
protected boolean |
registerAssoc(String className)
Register a class with the factory from its class name. |
static boolean |
registerInstantiator(MimeMediaType mimetype,
WireFormatMessageFactory.Instantiator instantiator)
Register an instantiator object a mime-type of documents to be constructed. |
static WireFormatMessage |
toWire(Message msg,
MimeMediaType type,
MimeMediaType[] preferedEncodings)
Constructs an instance of WireFormatMessage matching the type
specified by the type parameter. |
Methods inherited from class net.jxta.util.ClassFactory |
---|
getAvailableKeys, getEntrySet, getInstantiator, registerAssoc, registerFromFile, registerFromResources, registerFromString, registerProviders |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final MimeMediaType DEFAULT_WIRE_MIME
Method Detail |
---|
protected Map<MimeMediaType,WireFormatMessageFactory.Instantiator> getAssocTable()
getAssocTable
in class ClassFactory<MimeMediaType,WireFormatMessageFactory.Instantiator>
public Class<WireFormatMessageFactory.Instantiator> getClassOfInstantiators()
getClassOfInstantiators
in class ClassFactory<MimeMediaType,WireFormatMessageFactory.Instantiator>
public Class getClassForKey()
getClassForKey
in class ClassFactory<MimeMediaType,WireFormatMessageFactory.Instantiator>
protected boolean registerAssoc(String className)
registerAssoc
in class ClassFactory<MimeMediaType,WireFormatMessageFactory.Instantiator>
className
- The class name which will be registered.
public static boolean registerInstantiator(MimeMediaType mimetype, WireFormatMessageFactory.Instantiator instantiator)
mimetype
- the mime-type associated.instantiator
- the instantiator that wants to be registered..
SecurityException
- there were permission problems registering
the instantiator.public static WireFormatMessage toWire(Message msg, MimeMediaType type, MimeMediaType[] preferedEncodings)
WireFormatMessage
matching the type
specified by the type
parameter.
msg
- the message for which a serialization is desired.type
- the the serialization form desired. This can include
mime parameters to control options.preferedEncodings
- An array of acceptable message encodings
in descending order of preference. any or none of these encoding options
may be used. May be null for unencoded messages.
public static Message fromWire(InputStream is, MimeMediaType type, MimeMediaType contentEncoding) throws IOException
Message
from matching the type
specified by the type
parameter.
is
- The message stream. Message serializations must either use
internal data or EOF to determine the length of the stream.type
- Declared message type of the stream including any optional
configuration parameters.contentEncoding
- Content encoding (including optional parameters)
which has been applied to the message. May be null for unencoded messages.
IOException
- if an io error occurspublic static Message fromBuffer(ByteBuffer buffer, MimeMediaType type, MimeMediaType contentEncoding) throws IOException
Message
from matching the type
specified by the type
parameter.
buffer
- The message buffer. Message serializations must either use
internal data or EOF to determine the length of the stream.type
- Declared message type of the stream including any optional
configuration parameters.contentEncoding
- Content encoding (including optional parameters)
which has been applied to the message. May be null for unencoded messages.
IOException
- if an io error occurs
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |