All Packages Class Hierarchy This Package Previous Next Index
Class sun.servlet.http.MessageBytes
java.lang.Object
|
+----sun.servlet.util.Ascii
|
+----sun.servlet.http.MessageBytes
- public class MessageBytes
- extends Ascii
This class is used to represent a subarray of bytes in an HTTP message.
-
bytes
- The message bytes.
-
length
- The length of the bytes.
-
offset
- The start offset of the bytes.
-
MessageBytes()
- Creates a new, uninitialized MessageBytes object.
-
MessageBytes(byte[], int, int)
- Creates a new MessageBytes object with the specified bytes.
-
equals(byte[], int, int)
- Compares the message bytes to the specified subarray of bytes.
-
equals(String)
- Compares the message bytes to the specified String object.
-
equalsIgnoreCase(byte[], int, int)
- Compares the message bytes to the specified subarray of bytes.
-
equalsIgnoreCase(String)
- Compares the message bytes to the specified String object.
-
getBytes()
- Returns the message bytes.
-
getBytes(byte[], int)
- Puts the message bytes in buf starting at buf_offset.
-
getLength()
- Returns the length of the bytes.
-
getOffset()
- Returns the start offset of the bytes.
-
isSet()
- Returns true if the message bytes have been set.
-
length()
- Returns the length of the message bytes.
-
reset()
- Resets the message bytes to an uninitialized state.
-
setBytes(byte[], int, int)
- Sets the message bytes to the specified subarray of bytes.
-
startsWith(String)
- Returns true if the message bytes starts with the specified string.
-
toDate(HttpDate)
- Returns the message bytes parsed as a date.
-
toInteger()
- Returns the message bytes parsed as an unsigned integer.
-
toString()
- Returns the message bytes as a String object.
-
write(OutputStream)
- Writes the message bytes to the specified output stream.
bytes
protected byte bytes[]
- The message bytes.
offset
protected int offset
- The start offset of the bytes.
length
protected int length
- The length of the bytes.
MessageBytes
public MessageBytes()
- Creates a new, uninitialized MessageBytes object.
MessageBytes
public MessageBytes(byte b[],
int off,
int len)
- Creates a new MessageBytes object with the specified bytes.
- Parameters:
- b - the bytes
- off - the start offset of the bytes
- len - the length of the bytes
reset
public void reset()
- Resets the message bytes to an uninitialized state.
setBytes
public void setBytes(byte b[],
int off,
int len)
- Sets the message bytes to the specified subarray of bytes.
- Parameters:
- b - the ascii bytes
- off - the start offset of the bytes
- len - the length of the bytes
getBytes
public byte[] getBytes()
- Returns the message bytes.
getBytes
public int getBytes(byte buf[],
int buf_offset)
- Puts the message bytes in buf starting at buf_offset.
- Returns:
- the number of bytes added to buf.
getOffset
public int getOffset()
- Returns the start offset of the bytes.
getLength
public int getLength()
- Returns the length of the bytes.
isSet
public boolean isSet()
- Returns true if the message bytes have been set.
toString
public String toString()
- Returns the message bytes as a String object.
- Overrides:
- toString in class Object
toInteger
public int toInteger() throws NumberFormatException
- Returns the message bytes parsed as an unsigned integer.
- Throws: NumberFormatException
- if the integer format was invalid
toDate
public long toDate(HttpDate d) throws IllegalArgumentException
- Returns the message bytes parsed as a date.
- Parameters:
- d - the HttpDate object to use for parsing
- Throws: IllegalArgumentException
- if the date format was invalid
equals
public boolean equals(String s)
- Compares the message bytes to the specified String object.
- Parameters:
- s - the String to compare
- Returns:
- true if the comparison succeeded, false otherwise
equalsIgnoreCase
public boolean equalsIgnoreCase(String s)
- Compares the message bytes to the specified String object. Case is
ignored in the comparison.
- Parameters:
- s - the String to compare
- Returns:
- true if the comparison succeeded, false otherwise
equals
public boolean equals(byte b[],
int off,
int len)
- Compares the message bytes to the specified subarray of bytes.
- Parameters:
- b - the bytes to compare
- off - the start offset of the bytes
- len - the length of the bytes
- Returns:
- true if the comparison succeeded, false otherwise
equalsIgnoreCase
public boolean equalsIgnoreCase(byte b[],
int off,
int len)
- Compares the message bytes to the specified subarray of bytes.
Case is ignored in the comparison.
- Parameters:
- b - the bytes to compare
- off - the start offset of the bytes
- len - the length of the bytes
- Returns:
- true if the comparison succeeded, false otherwise
startsWith
public boolean startsWith(String s)
- Returns true if the message bytes starts with the specified string.
- Parameters:
- s - the string
write
public void write(OutputStream out) throws IOException
- Writes the message bytes to the specified output stream.
- Parameters:
- out - the output stream
- Throws: IOException
- if an I/O error has occurred
length
public int length()
- Returns the length of the message bytes.
All Packages Class Hierarchy This Package Previous Next Index