Class BinaryQueryResultParser
java.lang.Object
org.eclipse.rdf4j.query.resultio.AbstractQueryResultParser
org.eclipse.rdf4j.query.resultio.AbstractTupleQueryResultParser
org.eclipse.rdf4j.query.resultio.binary.BinaryQueryResultParser
- All Implemented Interfaces:
QueryResultParser
,TupleQueryResultParser
Reader for the binary tuple result format. The format is explained in
BinaryQueryResultConstants
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CharsetDecoder
private int
private DataInputStream
private static final int
private static final org.slf4j.Logger
private String[]
Fields inherited from class org.eclipse.rdf4j.query.resultio.AbstractQueryResultParser
handler, valueFactory
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new parser for the binary query result format that will use an instance ofSimpleValueFactory
to create Value objects.BinaryQueryResultParser
(ValueFactory valueFactory) Creates a new parser for the binary query result format that will use the supplied ValueFactory to create Value objects. -
Method Summary
Modifier and TypeMethodDescriptionprivate String
extractInvalidContentAsString
(int recordTypeMarker) Used when trying to parse some invalid content.final TupleQueryResultFormat
Gets the query result format that this parser can parse.void
parse
(InputStream in) Parses the data from the supplied InputStream.private void
private void
private BNode
private Value
private Literal
readLiteral
(int recordTypeMarker) private IRI
private String
private String
Reads a string from the version 1 format, i.e.private String
Reads a string from the version 2 format.private Triple
private IRI
readURI()
Methods inherited from class org.eclipse.rdf4j.query.resultio.AbstractTupleQueryResultParser
getQueryResultFormat, parseQueryResult, setTupleQueryResultHandler
Methods inherited from class org.eclipse.rdf4j.query.resultio.AbstractQueryResultParser
getParseErrorListener, getParseLocationListener, getParserConfig, getSupportedSettings, set, setParseErrorListener, setParseLocationListener, setParserConfig, setQueryResultHandler, setValueFactory
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.rdf4j.query.resultio.QueryResultParser
getParserConfig, getSupportedSettings, set, setParseErrorListener, setParseLocationListener, setParserConfig, setQueryResultHandler, setValueFactory
-
Field Details
-
in
-
formatVersion
private int formatVersion -
charsetDecoder
-
logger
private static final org.slf4j.Logger logger -
namespaceArray
-
INVALID_CONTENT_LIMIT
private static final int INVALID_CONTENT_LIMIT- See Also:
-
-
Constructor Details
-
BinaryQueryResultParser
public BinaryQueryResultParser()Creates a new parser for the binary query result format that will use an instance ofSimpleValueFactory
to create Value objects. -
BinaryQueryResultParser
Creates a new parser for the binary query result format that will use the supplied ValueFactory to create Value objects.
-
-
Method Details
-
getTupleQueryResultFormat
Description copied from interface:TupleQueryResultParser
Gets the query result format that this parser can parse. -
parse
public void parse(InputStream in) throws IOException, QueryResultParseException, TupleQueryResultHandlerException Description copied from interface:TupleQueryResultParser
Parses the data from the supplied InputStream.- Parameters:
in
- The InputStream from which to read the data.- Throws:
IOException
- If an I/O error occurred while data was read from the InputStream.QueryResultParseException
- If the parser has encountered an unrecoverable parse error.TupleQueryResultHandlerException
- If the configured query result handler has encountered an unrecoverable error.
-
processError
- Throws:
IOException
QueryResultParseException
-
processNamespace
- Throws:
IOException
-
readQName
- Throws:
IOException
-
readURI
- Throws:
IOException
-
readBnode
- Throws:
IOException
-
readLiteral
- Throws:
IOException
QueryResultParseException
-
readString
- Throws:
IOException
-
extractInvalidContentAsString
Used when trying to parse some invalid content. Reads the remaining bytes as string in order to provide more user-friendly error message. Sets the max limit of the returned string, if its length > INVALID_CONTENT_LIMIT, the returned string is trimmed and "..." is appended in order to prevent displaying too long result.- Throws:
IOException
-
readStringV1
Reads a string from the version 1 format, i.e. in Java'sinvalid @link
{@link DataInput#modified-utf-8
- Throws:
IOException
-
readStringV2
Reads a string from the version 2 format. Strings are encoded as UTF-8 and are preceeded by a 32-bit integer (high byte first) specifying the length of the encoded string.- Throws:
IOException
-
readTriple
- Throws:
IOException
-
readDirectValue
- Throws:
IOException
-