|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.w3c.www.http.HttpParser
public class HttpParser
A private class to help with the parsing. Contains only some static method, helping to parse various byte buffers into Java object (Yes, I am still and again trying to reduce memory consumption).
I don't know wether this sucks or not. One hand I am sparing a tremedous amount of Strings creation, on the other end I am recoding a number of parsers that are available on String instances.
Constructor Summary | |
---|---|
HttpParser()
|
Method Summary | |
---|---|
static int |
compare(byte[] b1,
int o1,
int l1,
byte[] b2)
Compare two byte arrays. |
static int |
compare(byte[] b1,
int o1,
int l1,
byte[] b2,
int o2,
int l2)
Compare two byte arrays. |
protected static void |
error(java.lang.String mth,
java.lang.String msg)
Emit an error. |
static int |
nextItem(byte[] buf,
org.w3c.www.http.ParseState ps)
Parse list of items, taking care of quotes and optional LWS. |
static long |
parseDate(byte[] buf,
org.w3c.www.http.ParseState ps)
Parse the given byte array as an HTTP compliant date. |
static long |
parseDateOrDeltaSeconds(byte[] buf,
org.w3c.www.http.ParseState ps)
|
static long |
parseDateOrDeltaSeconds(byte[] buf,
org.w3c.www.http.ParseState ps,
long relto)
Parse a date as either a delta-second value, or a date. |
static long |
parseDeltaSecond(byte[] buf,
org.w3c.www.http.ParseState ps)
Parse a delta-second value. |
static int |
parseInt(byte[] buf,
int radix,
org.w3c.www.http.ParseState ps)
Parse an integer, and return an updated pointer. |
static int |
parseInt(byte[] buf,
org.w3c.www.http.ParseState ps)
|
static long |
parseLong(byte[] buf,
int radix,
org.w3c.www.http.ParseState ps)
Parse an integer, and return an updated pointer. |
static long |
parseLong(byte[] buf,
org.w3c.www.http.ParseState ps)
|
static int |
parseMonth(byte[] buf,
org.w3c.www.http.ParseState ps)
|
static double |
parseQuality(byte[] buf,
org.w3c.www.http.ParseState ps)
|
static int |
skipSpaces(byte[] buf,
org.w3c.www.http.ParseState ps)
Skip leading LWS, not including CR LF. |
static boolean |
unquote(byte[] buf,
org.w3c.www.http.ParseState ps)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HttpParser()
Method Detail |
---|
protected static void error(java.lang.String mth, java.lang.String msg) throws HttpInvalidValueException
mth
- The method trigerring the error.msg
- An associated message.
HttpInvalidValueException
- To indicate the error to caller.public static final int compare(byte[] b1, int o1, int l1, byte[] b2, int o2, int l2)
b1
- The first byte array.o1
- The offset of the bytes to compare.l1
- The number of bytes to compare.b2
- What to compare against.o2
- The offset of the bytes to compare.l2
- The length of the bytes to compare.
public static final int compare(byte[] b1, int o1, int l1, byte[] b2)
b1
- The first byte array.o1
- The offset of the bytes to compare.l1
- The number of bytes to compare.b2
- What to compare against.
public static final int parseInt(byte[] buf, int radix, org.w3c.www.http.ParseState ps)
public static final int parseInt(byte[] buf, org.w3c.www.http.ParseState ps)
public static final long parseLong(byte[] buf, int radix, org.w3c.www.http.ParseState ps)
public static final long parseLong(byte[] buf, org.w3c.www.http.ParseState ps)
public static boolean unquote(byte[] buf, org.w3c.www.http.ParseState ps)
public static final int skipSpaces(byte[] buf, org.w3c.www.http.ParseState ps)
buf
- The buffer to be parsed.ptr
- The buffer pointer to be updated on return.
public static final int nextItem(byte[] buf, org.w3c.www.http.ParseState ps)
public static int parseMonth(byte[] buf, org.w3c.www.http.ParseState ps)
public static long parseDeltaSecond(byte[] buf, org.w3c.www.http.ParseState ps)
public static long parseDate(byte[] buf, org.w3c.www.http.ParseState ps)
buf
- The byte buffer to parse.sp
- The current parsing state.
public static long parseDateOrDeltaSeconds(byte[] buf, org.w3c.www.http.ParseState ps, long relto)
public static long parseDateOrDeltaSeconds(byte[] buf, org.w3c.www.http.ParseState ps)
public static double parseQuality(byte[] buf, org.w3c.www.http.ParseState ps)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |