|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.voytechs.jnetstream.codec.HeaderImpl
public class HeaderImpl
Note: The HeaderImpl class * is usually hidden from the user and the default public JNetStream access interfaces.
Default header interface implementation. This implementation allows header objects to be created from NPL definitions and input byte stream. Also 2 levels of properties are maintained. Permanent and temporary. Permanent properties are shared between all header objects of this type. Only a single instance of the property table exists. These can be static properties such as protocol description of RFC reference.
A second property table is maintained that is unique to each header object. The temporary property table has properties that are specific to each instance of the header. Such as 1-line summary of the important fields in the header, length of the header if variable, etc...
| Field Summary |
|---|
| Fields inherited from interface com.voytechs.jnetstream.codec.Header |
|---|
ABREVIATION, ACL, ADMINISTRATOR, ANSI, AUTHOR, COMMON, COMPANY, COPYRIGHT, CREATIONDATE, CREATOR, DESCRIPTION, DOC, HIDEHEADERLINE, HTTP, IEEE, IETF, IMTC, ITU, NAME, OMG, ORGANIZATION, OSILAYER, RFC, SHORTDESCRIPTION, SHORTHEADER, STD, SUMMARY, TRADEMARK, W3C |
| Fields inherited from interface com.voytechs.jnetstream.codec.Identity |
|---|
SHORT_NAME |
| Constructor Summary | |
|---|---|
HeaderImpl(java.lang.String name,
java.util.Map permProperties)
|
|
| Method Summary | |
|---|---|
void |
addField(Field field)
Adds a new protocol field to the packet. |
void |
addHeader(Header header)
Adds a new header to the packet. |
void |
addNote(Note note)
Notes are special formatting and cary additional information. |
boolean |
empty()
Checks to see if the header has any fields defined or not. |
Field |
getField(int index)
Returns the indexed field from the packet. |
Field |
getField(java.lang.String name)
Returns the named field from the packet. |
int |
getFieldCount()
Returns the number of fields within this header. |
Header |
getHeader(int index)
Returns the indexed header from the packet. |
Header |
getHeader(java.lang.String name)
Returns the named header from the packet. |
int |
getHeaderCount()
Returns the size of this header. |
int |
getHeaderLength()
Returns the number of bytes of length of this header as decoded from the input byte stream. |
java.lang.String |
getName()
Returns the name of this header as it was originally defined. |
java.util.Map |
getPermProperties()
|
Primitive |
getProperty(java.lang.String name)
Retrieve a named property from either the permanent or temporary properties tables. |
java.lang.Object |
getPropertyValue(java.lang.String name)
Retrieve a named property from either the permanent or temporary properties tables. |
java.util.Map |
getTempProperties()
|
java.lang.Object |
getValue(int index)
Conveniece method to retrieve a value of a field directly. |
java.lang.Object |
getValue(java.lang.String name)
Conveniece method to retrieve a value of a field or property directly. |
boolean |
hasHeader(java.lang.String name)
Checks to if the specified header exists in the packet. |
protected int |
longestName()
|
static void |
main(java.lang.String[] args)
Test function for HeaderImpl |
void |
merge(HeaderImpl header)
A utitility function to merge the fields of one header with another. |
void |
setHeaderLength(int headerLength)
Sets the length of this header. |
void |
setProperty(java.lang.String name,
Primitive property)
Set a property value in the temporary table. |
java.lang.String |
toString()
|
OutputBuffer |
toString(OutputBuffer s)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public HeaderImpl(java.lang.String name,
java.util.Map permProperties)
name - Name for this header.permProperties - External reference to a global permanent properties
table what is shared among all headers of this type.| Method Detail |
|---|
public void addHeader(Header header)
header - A reference to a header to be added to the list of header
within this PacketImpl object.public boolean hasHeader(java.lang.String name)
Header
hasHeader in interface Headername - name of the header to check for.
public Header getHeader(java.lang.String name)
getHeader in interface Headername - Name of the header to retrieve from the PacketImpl list
of headers it has.
public Header getHeader(int index)
getHeader in interface Headerindex - Index of the header to return from the list of headers.
public int getHeaderCount()
getHeaderCount in interface Header
public void setProperty(java.lang.String name,
Primitive property)
setProperty in interface MutableHeadername - Name of the property.property - Value of the property.public boolean empty()
public Primitive getProperty(java.lang.String name)
getProperty in interface Identitypublic java.lang.Object getPropertyValue(java.lang.String name)
public void addField(Field field)
addField in interface MutableHeaderfield - The protocol Field object to add to this header.public void addNote(Note note)
Notes are special formatting and cary additional information. They are added to the same list as the fields and thus allow the user to insert text and other information along just like a field does when converted to text output using the toString() method.
Notes are not accessible in any otherway after they have been added. They only show up when the toString() method is called.
addNote in interface MutableHeadernote - The Note object to add to the list of fields.public Field getField(java.lang.String name)
getField in interface Headername - Name of the field to retrieve.
public Field getField(int index)
getField in interface Headername - Name of the field to retrieve.
public java.lang.Object getValue(java.lang.String name)
getValue in interface Headername - Field or property name to retrieve the value from.
public java.lang.Object getValue(int index)
getValue in interface Headerindex - Index of the field within the header to retrieve the value
from.
public int getFieldCount()
Returns the number of fields within this header.
getFieldCount in interface Headerpublic int getHeaderLength()
getHeaderLength in interface Headerpublic void setHeaderLength(int headerLength)
headerLength - Length in bytes of this header.public void merge(HeaderImpl header)
header - The header from which to take the fields to merge with
this header.public java.lang.String getName()
getName in interface Identitypublic java.lang.String toString()
toString in class java.lang.Objectpublic OutputBuffer toString(OutputBuffer s)
protected int longestName()
public static void main(java.lang.String[] args)
args - command line argumentspublic java.util.Map getPermProperties()
public java.util.Map getTempProperties()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||