JNodeOS v1.2.0 API

edu.utah.janos.util
Class PlainPacketSegment

java.lang.Object
  |
  +--edu.utah.janos.util.PlainPacketSegment

public class PlainPacketSegment
extends java.lang.Object
implements PacketSegment

A PlainPacketSegment implements the PacketSegment interface for an array of bytes.


Constructor Summary
PlainPacketSegment(byte[] body)
           
PlainPacketSegment(int length)
           
 
Method Summary
 byte[] getBody()
           
 byte getByte(int offset)
           
 int getInt(int offset)
           
 int getLength()
           
 short getShort(int offset)
           
 int marshal(BufferHandle bh, int offset)
           
 void setByte(int offset, byte val)
           
 void setInt(int offset, int val)
           
 void setShort(int offset, short val)
           
 java.lang.String toString()
           
 int unmarshal(BufferHandle bh, int offset)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PlainPacketSegment

public PlainPacketSegment(byte[] body)
Parameters:
body - The array of bytes that should make up the segment.

PlainPacketSegment

public PlainPacketSegment(int length)
Parameters:
length - The length of the expected byte array.
Method Detail

getLength

public int getLength()
Specified by:
getLength in interface PacketSegment
Returns:
The length of the byte array.

getBody

public byte[] getBody()
Returns:
The byte array that makes up this segment.

getByte

public byte getByte(int offset)
Parameters:
offset - The offset into the body.
Returns:
The byte at the given offset in the body of the segment.

setByte

public void setByte(int offset,
                    byte val)
Parameters:
offset - The offset into the body.
val - The byte at the given offset in the body of the segment.

getShort

public short getShort(int offset)
Parameters:
offset - The offset into the body.
Returns:
The short at the given offset in the body of the segment.

setShort

public void setShort(int offset,
                     short val)
Parameters:
offset - The offset into the body.
val - The short at the given offset in the body of the segment.

getInt

public int getInt(int offset)
Parameters:
offset - The offset into the body.
Returns:
The int at the given offset in the body of the segment.

setInt

public void setInt(int offset,
                   int val)
Parameters:
offset - The offset into the body.
val - The int at the given offset in the body of the segment.

marshal

public int marshal(BufferHandle bh,
                   int offset)
Specified by:
marshal in interface PacketSegment
Tags copied from interface: PacketSegment
Parameters:
bh - The buffer to marshal this packet into.
offset - The offset in the buffer to start marshalling.

unmarshal

public int unmarshal(BufferHandle bh,
                     int offset)
              throws InvalidPacketException
Specified by:
unmarshal in interface PacketSegment
Tags copied from interface: PacketSegment
Parameters:
bh - The buffer that contains the marshalled packet segments.
offset - The offset in the buffer to start unmarshalling.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

JNodeOS v1.2.0 API

This documentation is Copyright (C) 1998-2002 The University of Utah. All Rights Reserved. See the file LICENSE for distribution terms.
Documentation, software, and mailing list archives for Janos can be found at the Janos Project web site: http://www.cs.utah.edu/flux/janos/
Generated on Mar 17, 2002