com.resilientedge.jockey.appcomm
Class FixedString

java.lang.Object
  |
  +--com.resilientedge.jockey.appcomm.FixedString
All Implemented Interfaces:
Marshallable

public class FixedString
extends java.lang.Object
implements Marshallable

A simple implementation of a fixed length marshallable string. Useful for assembling more complex marshallable objects.

Version:
$Revision: 1.1.1.1 $
Author:
John Gardner

Fields inherited from interface com.resilientedge.jockey.appcomm.Marshallable
FAILED, SUCCESS, TYPE_FIXED_STRING, TYPE_OBJECT, TYPE_UINT_32
 
Constructor Summary
FixedString()
          Constructor.
FixedString(java.lang.String value)
          Constructor.
 
Method Summary
 int fromBytes(byte[] buffer, int offset)
          Reinitialize this object from the contents of an array of bytes.
 java.lang.String getMarshalName()
          Return an identifier for this object.
 int getMarshalSize()
          Return the number of bytes that this object would require to marshal itself.
 java.lang.String getValue()
          Return the string represented by this object.
 int toBytes(byte[] buffer, int offset)
          Marshal this object to a language independent array of bytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedString

public FixedString()
Constructor.

FixedString

public FixedString(java.lang.String value)
Constructor.
Parameters:
value - value of this string
Method Detail

getValue

public java.lang.String getValue()
Return the string represented by this object.
Returns:
value

getMarshalName

public java.lang.String getMarshalName()
Return an identifier for this object. This has to be unique among marshallable objects. The name actually doesn't matter for this object, since it is a primitive type understood by the marshaller.
Specified by:
getMarshalName in interface Marshallable
Returns:
name for this object.

toBytes

public int toBytes(byte[] buffer,
                   int offset)
Marshal this object to a language independent array of bytes. Should be called by any subclass before marshalling derived attributes.
Specified by:
toBytes in interface Marshallable
Parameters:
buffer - a destination buffer to receive this object.
Returns:
the number of bytes of the input buffer consumed.

fromBytes

public int fromBytes(byte[] buffer,
                     int offset)
Reinitialize this object from the contents of an array of bytes. Should be called by any subclass before unmarshalling derived attributes.
Specified by:
fromBytes in interface Marshallable
Parameters:
buffer - a buffer containing the marshalled object.
Returns:
the number of bytes of the input buffer consumed.

getMarshalSize

public int getMarshalSize()
Return the number of bytes that this object would require to marshal itself. Should be called by any subclass and added to defived size.
Specified by:
getMarshalSize in interface Marshallable
Returns:
the number of bytes that the header information would consume.


Copyright © 2001 Resilient Edge, Inc. All Rights Reserved.