public abstract class ValueParser extends Object
Modifier and Type | Method and Description |
---|---|
abstract void |
checkStream(InputStream in,
long irow)
Checks the value of a table element which is encoded in a BINARY
stream.
|
abstract void |
checkString(String text,
long irow)
Checks the value of a string which contains the value.
|
void |
error(VotLintCode code,
String msg,
long irow)
Writes an error message 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,
long irow)
Writes an info message to the user.
|
static ValueParser |
makeParser(ElementHandler handler,
String name,
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,
long irow)
Writes a warning message to the user.
|
public abstract void checkString(String text, long irow)
value
attribute
of a PARAM element or the contents of a TD element.text
- value stringirow
- row index at which error occurred,
or negative if unknown/inapplicablepublic abstract void checkStream(InputStream in, long irow) throws IOException
in
- input streamirow
- row index at which error occurred,
or negative if unknown/inapplicableIOException
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, long irow)
code
- message identifiermsg
- message textirow
- row index associated with message,
or -1 for unknown/inapplicablepublic void warning(VotLintCode code, String msg, long irow)
code
- message identifiermsg
- message textirow
- row index associated with message,
or -1 for unknown/inapplicablepublic void error(VotLintCode code, String msg, long irow)
code
- message identifiermsg
- message textirow
- row index associated with message,
or -1 for unknown/inapplicablepublic static ValueParser makeParser(ElementHandler handler, String name, String datatype, String arraysize, String xtype)
handler
- element handlername
- name attribute valuedatatype
- datatype attribute valuearraysize
- arraysize attribute valuextype
- xtype (extended type) attribute valuenull
if one can't
be constructedpublic 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 © 2024 Central Laboratory of the Research Councils. All Rights Reserved.