|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xbill.DNS.Tokenizer
Tokenizer is used to parse DNS records and zones from text format,
Nested Class Summary | |
static class |
Tokenizer.Token
|
Field Summary | |
static int |
COMMENT
A comment; only returned when wantComment is set |
static int |
EOF
End of file |
static int |
EOL
End of line |
static int |
IDENTIFIER
An identifier (unquoted string) |
static int |
QUOTED_STRING
A quoted string |
static int |
WHITESPACE
Whitespace; only returned when wantWhitespace is set |
Constructor Summary | |
Tokenizer(File f)
Creates a Tokenizer from a file. |
|
Tokenizer(InputStream is)
Creates a Tokenizer from an arbitrary input stream. |
|
Tokenizer(String s)
Creates a Tokenizer from a string. |
Method Summary | |
TextParseException |
exception(String s)
Creates an exception which includes the current state in the error message |
Tokenizer.Token |
get()
Gets the next token from a tokenizer, ignoring whitespace and comments. |
Tokenizer.Token |
get(boolean wantWhitespace,
boolean wantComment)
Gets the next token from a tokenizer. |
double |
getDouble()
Gets the next token from a tokenizer and converts it to a double. |
void |
getEOL()
Gets the next token from a tokenizer, which must be an EOL or EOF. |
String |
getIdentifier()
Gets the next token from a tokenizer, ensures it is an unquoted string, and converts it to a string. |
long |
getLong()
Gets the next token from a tokenizer and converts it to a long. |
Name |
getName(Name origin)
Gets the next token from a tokenizer and converts it to a name. |
String |
getString()
Gets the next token from a tokenizer and converts it to a string. |
int |
getTTL()
Gets the next token from a tokenizer and converts it to an integer representing a TTL (which may be encoded in the BIND TTL format). |
int |
getUInt16()
Gets the next token from a tokenizer and converts it to an unsigned 16 bit integer. |
long |
getUInt32()
Gets the next token from a tokenizer and converts it to an unsigned 32 bit integer. |
int |
getUInt8()
Gets the next token from a tokenizer and converts it to an unsigned 8 bit integer. |
void |
unget()
Returns a token to the stream, so that it will be returned by the next call to get(). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int EOF
public static final int EOL
public static final int WHITESPACE
public static final int IDENTIFIER
public static final int QUOTED_STRING
public static final int COMMENT
Constructor Detail |
public Tokenizer(InputStream is)
is
- The InputStream to tokenize.public Tokenizer(String s)
s
- The String to tokenize.public Tokenizer(File f) throws FileNotFoundException
f
- The File to tokenize.Method Detail |
public Tokenizer.Token get(boolean wantWhitespace, boolean wantComment) throws IOException
wantWhitespace
- If true, leading whitespace will be returned as a
token.wantComment
- If true, comments are returned as tokens.
TextParseException
- The input was invalid.
IOException
- An I/O error occurred.public Tokenizer.Token get() throws IOException
TextParseException
- The input was invalid.
IOException
- An I/O error occurred.public void unget()
IllegalStateException
- There are already ungotten tokens.public String getString() throws IOException
TextParseException
- The input was invalid or not a string.
IOException
- An I/O error occurred.public String getIdentifier() throws IOException
TextParseException
- The input was invalid or not an unquoted string.
IOException
- An I/O error occurred.public long getLong() throws IOException
TextParseException
- The input was invalid or not a long.
IOException
- An I/O error occurred.public long getUInt32() throws IOException
TextParseException
- The input was invalid or not an unsigned 32
bit integer.
IOException
- An I/O error occurred.public int getUInt16() throws IOException
TextParseException
- The input was invalid or not an unsigned 16
bit integer.
IOException
- An I/O error occurred.public int getUInt8() throws IOException
TextParseException
- The input was invalid or not an unsigned 8
bit integer.
IOException
- An I/O error occurred.public double getDouble() throws IOException
TextParseException
- The input was invalid or not a double.
IOException
- An I/O error occurred.public int getTTL() throws IOException
TextParseException
- The input was invalid or not a valid TTL.
IOException
- An I/O error occurred.TTL
public Name getName(Name origin) throws IOException
origin
- The origin to append to relative names.
TextParseException
- The input was invalid or not a valid name.
IOException
- An I/O error occurred.
RelativeNameException
- The parsed name was relative, even with the
origin.Name
public void getEOL() throws IOException
TextParseException
- The input was invalid or not an EOL or EOF token.
IOException
- An I/O error occurred.public TextParseException exception(String s)
s
- The error message to include.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |