public class HeaderLineReader extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
bCr
True if the previous character was a CR.
|
boolean |
bEncodedWords
Support encoded words.
|
boolean |
bEof
Boolean indicating whether or not EOF has been reached on stream.
|
int |
bfErrors
Bit field of errors encountered while attempting to read a line.
|
boolean |
bLWS
Support LWS.
|
boolean |
bNameValue
Parses a headerline if true and a normal line if false.
|
boolean |
bQuotedText
Support quoted text.
|
protected boolean |
bValidChar
Used by decode method to indicated valid or non valid character.
|
protected ByteArrayOutputStreamWithUnread |
bytesOut
Stream used to record the raw characters read by the parser.
|
protected static int |
CC_CONTROL
Control character characteristic.
|
protected static int |
CC_SEPARATOR_WS
Separator character characteristic.
|
static byte[] |
charCharacteristicsTab
Table of separator characters.
|
static int |
E_BIT_EOF
Bit denoting unexpected EOF.
|
static int |
E_BIT_INVALID_CHARSET
Bit denoting an invalid encoding.
|
static int |
E_BIT_INVALID_CONTROL_CHAR
Bit denoting an invalid control character.
|
static int |
E_BIT_INVALID_QUOTED_PAIR_CHAR
Bit denoting an invalid quoted pair character.
|
static int |
E_BIT_INVALID_SEPARATOR_CHAR
Bit denoting an invalid separator character.
|
static int |
E_BIT_INVALID_US_ASCII_CHAR
Bit denoting an invalid US-ASCII character.
|
static int |
E_BIT_INVALID_UTF8_ENCODING
Bit denoting an invalid UTF-8 encoded character.
|
static int |
E_BIT_MISPLACED_CR
Bit denoting a misplaced CR.
|
static int |
E_BIT_MISSING_CR
Bit denoting a missing CR.
|
static int |
E_BIT_MISSING_QUOTE
Bit denoting a missing quote character.
|
static int |
E_BIT_MISSING_QUOTED_PAIR_CHAR
Bit denoting a missing quoted pair character.
|
static int |
E_BIT_UNEXPECTED_CR
Bit denoting an unexpected CR.
|
static int |
ENC_ISO8859_1
ISO-8859-1 encoding identifier.
|
static int |
ENC_RAW
Raw encoding identifier.
|
static int |
ENC_US_ASCII
US-ASCII encoding identifier.
|
static int |
ENC_UTF8
UTF-8 encoding identifier.
|
int |
encoding
Identifier for the expected character encoding.
|
int |
eol
Identifier for the Expected end of line character sequence.
|
static int |
EOL_CRLF
CRLF end of line identifier.
|
static int |
EOL_LF
LF end of line identifier.
|
protected java.lang.StringBuffer |
lineSb
Reusable
StringBuffer for lines. |
protected java.lang.StringBuffer |
nvSb
Reusable
StringBuffer for name/value strings. |
protected static int |
S_LINE
Initial state for reading a normal line.
|
protected static int |
S_LWS
State for reading a LWS character sequence.
|
protected static int |
S_NAME
Initial state for reading a header line.
|
protected static int |
S_QUOTED_LWS
State for reading a quoted LWS character sequence.
|
protected static int |
S_QUOTED_PAIR
State for reading a quoted pair character.
|
protected static int |
S_QUOTED_TEXT
State for reading a quoted string.
|
protected static int |
S_VALUE
State for reading a header value.
|
static java.lang.String |
separatorsWs
rfc2616 separator characters.
|
protected UTF8 |
utf8
Reusable UTF-8 validation object instance.
|
| Modifier | Constructor and Description |
|---|---|
protected |
HeaderLineReader()
Prohibit public construction.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
check_eol()
Check and report whether the line ended as expected.
|
protected int |
decode(int c,
java.io.InputStream in)
Decode a character according to the expected encoding.
|
static HeaderLineReader |
getHeaderLineReader()
Returns a reader initialized to read header lines.
|
static HeaderLineReader |
getLineReader()
Returns a reader initialized to read normal lines.
|
static HeaderLineReader |
getReader()
Returns a reader with default configuration values.
|
HeaderLine |
readLine(java.io.PushbackInputStream in)
Reads a header/line according to the configuration.
|
static void |
report_error(int bfErrors,
Diagnostics diagnostics)
Report bit field errors as diagnoses.
|
static java.lang.String |
trim(java.lang.StringBuffer sb)
Trims the whitespace characters found in the beginning and end of a
string.
|
protected static final int S_LINE
protected static final int S_NAME
protected static final int S_VALUE
protected static final int S_LWS
protected static final int S_QUOTED_TEXT
protected static final int S_QUOTED_PAIR
protected static final int S_QUOTED_LWS
protected static final int CC_CONTROL
protected static final int CC_SEPARATOR_WS
public static final java.lang.String separatorsWs
public static final byte[] charCharacteristicsTab
public static final int ENC_RAW
public static final int ENC_US_ASCII
public static final int ENC_ISO8859_1
public static final int ENC_UTF8
public static final int EOL_LF
public static final int EOL_CRLF
public boolean bNameValue
public int encoding
public int eol
public boolean bLWS
public boolean bQuotedText
public boolean bEncodedWords
protected final java.lang.StringBuffer lineSb
StringBuffer for lines.protected final java.lang.StringBuffer nvSb
StringBuffer for name/value strings.protected ByteArrayOutputStreamWithUnread bytesOut
public static final int E_BIT_EOF
public static final int E_BIT_MISPLACED_CR
public static final int E_BIT_MISSING_CR
public static final int E_BIT_UNEXPECTED_CR
public static final int E_BIT_INVALID_UTF8_ENCODING
public static final int E_BIT_INVALID_US_ASCII_CHAR
public static final int E_BIT_INVALID_CONTROL_CHAR
public static final int E_BIT_INVALID_SEPARATOR_CHAR
public static final int E_BIT_MISSING_QUOTE
public static final int E_BIT_MISSING_QUOTED_PAIR_CHAR
public static final int E_BIT_INVALID_QUOTED_PAIR_CHAR
public static final int E_BIT_INVALID_CHARSET
protected boolean bCr
protected boolean bValidChar
public boolean bEof
public int bfErrors
protected HeaderLineReader()
public static HeaderLineReader getReader()
public static HeaderLineReader getLineReader()
public static HeaderLineReader getHeaderLineReader()
public HeaderLine readLine(java.io.PushbackInputStream in) throws java.io.IOException
in - InputStream with charactersHeaderLine objectjava.io.IOException - if an I/O error occurs in the underlying input streamprotected int decode(int c, java.io.InputStream in) throws java.io.IOException
c - first character of the possibly encoded character sequencein - InputStream with possible extra encoded characters.java.io.IOException - if an I/O error occurs in the underlying input streamprotected void check_eol()
public static java.lang.String trim(java.lang.StringBuffer sb)
sb - StringBuffer to be trimmedpublic static void report_error(int bfErrors, Diagnostics diagnostics)
bfErrors - bit field with indicated errorsdiagnostics - diagnostics object used to report diagnosesCopyright © 2011–2023. All rights reserved.