## org.apache.catalina.connector.warp
Class WarpPacket

    java.lang.Object
      org.apache.catalina.connector.warp.WarpPacket

public class WarpPacket
extends java.lang.Object

Field Summary
`protected byte[]` `buffer` This packet's data buffer
`protected int` `pointer`
`protected int` `size` Number of bytes stored in the buffer

Constructor Summary
`WarpPacket()` Construct a new WarpPacket instance.

Method Summary
`java.lang.String` `dump()`
`int` `getType()` Return the type of this packet.
`int` `readInteger()` Read a signed integer value (32 bit) from the packet buffer.
`java.lang.String` `readString()` Read a string from the packet buffer.
`int` `readUnsignedShort()` Read an unsigned short value (16 bit) from the packet buffer.
`void` `reset()` Reset this packet.
`void` `setType(int type)` Set this packet type.
`void` `writeInteger(int value)` Write a signed integer value (32 bit) in the packet buffer.
`void` `writeString(java.lang.String string)` Write a string into the packet buffer.
`void` `writeUnsignedShort(int value)` Write an unsigned short value (16 bit) in the packet buffer.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### buffer

    protected byte[] buffer

  This packet's data buffer

### size

    protected int size

  Number of bytes stored in the buffer

### pointer

    protected int pointer

Constructor Detail

### WarpPacket

    public WarpPacket()

  Construct a new WarpPacket instance.

Method Detail

### reset

    public void reset()

  Reset this packet.

### setType

    public void setType(int type)

  Set this packet type.

  Parameters:
    `type` - The type of this packet.

### getType

    public int getType()

  Return the type of this packet.

  Returns:
    The type of this packet.

### writeUnsignedShort

    public void writeUnsignedShort(int value)

  Write an unsigned short value (16 bit) in the packet buffer.

  Parameters:
    `value` - The unsigned short value to write.
  Throws:
    `java.lang.IllegalArgumentException` - If the value is negative or greater than 65535.
    `java.lang.ArrayIndexOutOfBoundsException` - If the packet buffer cannot contain the new value.

### writeInteger

    public void writeInteger(int value)

  Write a signed integer value (32 bit) in the packet buffer.

  Parameters:
    `value` - The signed integer value to write.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - If the packet buffer cannot contain the new value.

### writeString

    public void writeString(java.lang.String string)

  Write a string into the packet buffer.

  Parameters:
    `string` - The string to write into the packet buffer.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - If the packet buffer cannot contain the new value.
    `java.lang.RuntimeException` - If the platform doesn't support UTF-8 encoding.

### readUnsignedShort

    public int readUnsignedShort()

  Read an unsigned short value (16 bit) from the packet buffer.

  Returns:
    The unsigned short value as an integer.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - If no data is left in the packet buffer to be read.

### readInteger

    public int readInteger()

  Read a signed integer value (32 bit) from the packet buffer.

  Returns:
    The signed integer value.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - If no data is left in the packet buffer to be read.

### readString

    public java.lang.String readString()

  Read a string from the packet buffer.

  Returns:
    The string red from the packet buffer.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - If no data is left in the packet buffer to be read.

### dump

    public java.lang.String dump()

Copyright ? 2000-2002 Apache Software Foundation. All Rights Reserved.