Top Description Fields Constructors Methods
org.mortbay.io

public Class BufferUtil

extends Object
Class Inheritance
Imports
java.io.UnsupportedEncodingException, org.mortbay.util.StringUtil

Buffer utility methods.
Author
gregw

Field Summary

Modifier and TypeField and Description
private static int[]
private static final long[]
pack-priv static final byte[]
private static int[]
pack-priv static final byte
pack-priv static final byte

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static boolean
isPrefix(Buffer prefix, Buffer buffer)

public static void
prependHexInt(Buffer buffer, int n)

Add hex integer BEFORE current getIndex.

public static void
putCRLF(Buffer buffer)

public static void
putDecInt(Buffer buffer, int n)

public static void
putDecLong(Buffer buffer, long n)

public static void
putHexInt(Buffer buffer, int n)

public static String
public static Buffer
toBuffer(long value)

public static int

Returns:

an int
toInt
(Buffer
A buffer containing an integer. The position is not changed.
buffer
)

Convert buffer to an integer.

public static long

Returns:

an int
toLong
(Buffer
A buffer containing an integer. The position is not changed.
buffer
)

Convert buffer to an long.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

decDivisorsback to summary
private static int[] decDivisors
decDivisorsLback to summary
private static final long[] decDivisorsL
DIGITback to summary
pack-priv static final byte[] DIGIT
hexDivisorsback to summary
private static int[] hexDivisors
MINUSback to summary
pack-priv static final byte MINUS
SPACEback to summary
pack-priv static final byte SPACE

Constructor Detail

BufferUtilback to summary
public BufferUtil()

Method Detail

isPrefixback to summary
public static boolean isPrefix(Buffer prefix, Buffer buffer)
prependHexIntback to summary
public static void prependHexInt(Buffer buffer, int n)

Add hex integer BEFORE current getIndex.

putCRLFback to summary
public static void putCRLF(Buffer buffer)
putDecIntback to summary
public static void putDecInt(Buffer buffer, int n)
putDecLongback to summary
public static void putDecLong(Buffer buffer, long n)
putHexIntback to summary
public static void putHexInt(Buffer buffer, int n)
to8859_1_Stringback to summary
public static String to8859_1_String(Buffer buffer)
toBufferback to summary
public static Buffer toBuffer(long value)
toIntback to summary
public static int toInt(Buffer buffer)

Convert buffer to an integer. Parses up to the first non-numeric character. If no number is found an IllegalArgumentException is thrown

Parameters
buffer:Buffer

A buffer containing an integer. The position is not changed.

Returns:int

an int

toLongback to summary
public static long toLong(Buffer buffer)

Convert buffer to an long. Parses up to the first non-numeric character. If no number is found an IllegalArgumentException is thrown

Parameters
buffer:Buffer

A buffer containing an integer. The position is not changed.

Returns:long

an int