|
JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.impl.endpoint.msgframing.MessagePackageHeader
public class MessagePackageHeader
Header Package for Messages. Analogous to HTTP Headers.
Nested Class Summary | |
---|---|
static class |
MessagePackageHeader.Header
Used for storing individual header elements. |
Constructor Summary | |
---|---|
MessagePackageHeader()
Creates a new instance of MessagePackageHeader. |
|
MessagePackageHeader(InputStream in)
Creates a new instance of MessagePackageHeader. |
Method Summary | |
---|---|
void |
addHeader(String name,
byte[] value)
Add a header. |
void |
addHeader(String name,
String value)
Add a header. |
ByteBuffer |
getByteBuffer()
Return a ByteBuffer representing this group of header elements. |
long |
getContentLengthHeader()
Convenience method for getting the " content-length " header. |
MimeMediaType |
getContentTypeHeader()
Convenience method for getting the " content-type " header. |
Iterator<MessagePackageHeader.Header> |
getHeader(String name)
Gets all of the headers matching the specified name |
ListIterator<MessagePackageHeader.Header> |
getHeaders()
Gets all of the headers. |
boolean |
readHeader(ByteBuffer buffer)
Reads a Header from a ByteBuffer |
void |
replaceHeader(String name,
byte[] value)
Replace a header. |
void |
replaceHeader(String name,
String value)
Replace a header. |
void |
sendToStream(OutputStream out)
Write this group of header elements to a stream. |
void |
setContentLengthHeader(long length)
Convenience method setting the " content-length " header. |
void |
setContentTypeHeader(MimeMediaType type)
Convenience method for setting the " content-type " header. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MessagePackageHeader()
public MessagePackageHeader(InputStream in) throws IOException
in
- The stream from which the headers will be read.
IOException
- if an io error occurs.Method Detail |
---|
public String toString()
toString
in class Object
public boolean readHeader(ByteBuffer buffer) throws IOException
buffer
- the input buffer
true
If the header block was completely read.
IOException
- if an io error is encounteredpublic void addHeader(String name, byte[] value)
name
- The header name. The UTF-8 encoded representation of this
name may not be longer than 255 bytes.value
- The value for the header. May not exceed 65535 bytes in
length.public void addHeader(String name, String value)
name
- The header name. The UTF-8 encoded representation of this
name may not be longer than 255 bytes.value
- The value for the header. May not exceed 65535 bytes in
length.public void replaceHeader(String name, byte[] value)
name
- The header name. The UTF-8 encoded representation of this
name may not be longer than 255 bytes.value
- The value for the header. May not exceed 65535 bytes in
length.public void replaceHeader(String name, String value)
name
- The header name. The UTF-8 encoded representation of this
name may not be longer than 255 bytes.value
- The value for the header. May not exceed 65535 bytes in
length.public ListIterator<MessagePackageHeader.Header> getHeaders()
add()
,
set()
, remove()
is permitted.
public Iterator<MessagePackageHeader.Header> getHeader(String name)
name
- the name of the header we are seeking.public void sendToStream(OutputStream out) throws IOException
out
- the stream to send the headers to.
IOException
- if an io error occurspublic ByteBuffer getByteBuffer()
public void setContentLengthHeader(long length)
content-length
" header.
length
- length of the message.public long getContentLengthHeader()
content-length
" header.
content-length
header element.public void setContentTypeHeader(MimeMediaType type)
content-type
" header.
type
- type of the message.public MimeMediaType getContentTypeHeader()
content-type
" header.
application/octet-stream
" if
there was no content-type
header.
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |