| org.archive.util.anvl.ANVLRecord
MAXIMUM_SIZE | final public static long MAXIMUM_SIZE(Code) | | Arbitrary upper bound on maximum size of ANVL Record.
Will throw an IOException if exceed this size.
|
ANVLRecord | public ANVLRecord()(Code) | | |
ANVLRecord | public ANVLRecord(int initialCapacity)(Code) | | |
getLength | public synchronized int getLength()(Code) | | Count of ANVLRecord bytes. Be careful, an empty ANVLRecord isCRLFCRLF so is of size 4. Also, expensive, since it makes String ofthe record so it can count bytes. |
isCR | public static boolean isCR(char c)(Code) | | |
isCROrLF | public static boolean isCROrLF(char c)(Code) | | |
isLF | public static boolean isLF(char c)(Code) | | |
load | public static ANVLRecord load(InputStream is) throws IOException(Code) | | Parses a single ANVLRecord from passed InputStream.
Read as a single-byte stream until we get to a CRLFCRLF which
signifies End-of-ANVLRecord. Then parse all read as a UTF-8 Stream.
Doing it this way, while requiring a double-scan, it makes it so do not
need to be passed a RepositionableStream or a Stream that supports
marking. Also no danger of over-reading which can happen when we
wrap passed Stream with an InputStreamReader for doing UTF-8
character conversion (See the ISR class comment).
Parameters: is - InputStream An ANVLRecord instance. throws: IOException - |
load | public static ANVLRecord load(String s) throws IOException(Code) | | Parse passed String for an ANVL Record.
Looked at writing javacc grammer but preprocessing is required to
handle folding: See
https://javacc.dev.java.net/servlets/BrowseList?list=users&by=thread&from=56173.
Looked at Terence Parr's ANTLR. More capable. Can set lookahead count.
A value of 3 would help with folding. But its a pain defining UNICODE
grammers -- needed by ANVL -- and support seems incomplete
anyways: http://www.doc.ic.ac.uk/lab/secondyear/Antlr/lexer.html#unicode.
For now, go with the below hand-rolled parser.
Parameters: s - String with an ANVLRecord. ANVLRecord parsed from passed String. throws: IOException - |
|
|