public abstract class ValueParser extends Object
Constructor and Description |
---|
ValueParser() |
Modifier and Type | Method and Description |
---|---|
abstract void |
checkStream(InputStream in)
Checks the value of a table element which is encoded in a BINARY
stream.
|
abstract void |
checkString(String text)
Checks the value of a string which contains the value.
|
void |
error(VotLintCode code,
String msg)
Writes an error mesage to the user.
|
abstract Class<?> |
getContentClass()
Returns the class of values which would be used in Java to represent
an object parsed by this parser, although this class does not
actually return such values.
|
VotLintContext |
getContext()
Returns this parser's context.
|
abstract int |
getElementCount()
Returns the number of items of class
getContentClass() which
correspond to values parsed by this parser. |
void |
info(VotLintCode code,
String msg)
Writes an info mesage to the user.
|
static ValueParser |
makeParser(ElementHandler handler,
String datatype,
String arraysize,
String xtype)
Constructs a ValueParsers for a given element.
|
static byte[] |
readStreamBytes(InputStream in,
int nbyte,
VotLintContext context)
Reads and returns a fixed number of bytes from a stream.
|
void |
setContext(VotLintContext context)
Sets this parser's context.
|
static void |
slurpStream(InputStream in,
int nbyte,
VotLintContext context)
Uncritically reads in a fixed number of bytes from a stream.
|
void |
warning(VotLintCode code,
String msg)
Writes a warning mesage to the user.
|
public abstract void checkString(String text)
text
- value stringpublic abstract void checkStream(InputStream in) throws IOException
in
- input streamIOException
public abstract Class<?> getContentClass()
ValueInfo.getContentClass()
would return for this object if a StarTable was being built.public abstract int getElementCount()
getContentClass()
which
correspond to values parsed by this parser. This should be the
same as the product of shape elements returned by
ValueInfo.getShape()
.
If the number is indeterminate, -1 should be returned.public void setContext(VotLintContext context)
context
- lint contextpublic VotLintContext getContext()
public void info(VotLintCode code, String msg)
code
- message identifiermsg
- message textpublic void warning(VotLintCode code, String msg)
code
- message identifiermsg
- message textpublic void error(VotLintCode code, String msg)
code
- message identifiermsg
- message textpublic static ValueParser makeParser(ElementHandler handler, String datatype, String arraysize, String xtype)
handler
- element handlerdatatype
- datatype attribute valuearraysize
- arraysize attribute valuextype
- xtype (extended type) attribute valuepublic static void slurpStream(InputStream in, int nbyte, VotLintContext context) throws IOException
in
- input streamnbyte
- number of bytes to readcontext
- error reporting contextIOException
public static byte[] readStreamBytes(InputStream in, int nbyte, VotLintContext context) throws IOException
in
- input streamnbyte
- number of bytes to readcontext
- error reporting contextnbyte
IOException
- if read could not completeCopyright © 2023 Central Laboratory of the Research Councils. All Rights Reserved.