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.
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
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.
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
This documentation is Copyright (C) 1998-2001 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: http://www.cs.utah.edu/flux/janos/