Package org.eclipse.rdf4j.rio.hdt
Class HDTPart
- java.lang.Object
-
- org.eclipse.rdf4j.rio.hdt.HDTPart
-
- Direct Known Subclasses:
HDTArray,HDTBitmap,HDTDictionary,HDTDictionarySection,HDTGlobal,HDTHeader,HDTTriples,HDTTriplesSection
abstract class HDTPart extends java.lang.ObjectHelper class for different HDT parts.Each part starts with
$HDT, followed by a byte indicating the type of the part.Structure:
+------+------+ | $HDT | type | +------+------+
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classHDTPart.Type
-
Field Summary
Fields Modifier and Type Field Description private static intBUFLENprotected static byte[]COOKIEprotected java.lang.Stringnameprotected longposprotected java.util.Map<java.lang.String,java.lang.String>properties
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static voidcheckControl(java.io.InputStream is, HDTPart.Type ctype)Check start of part for$HDTand the byte indicating the typeprotected static voidcheckCRC(java.util.zip.CheckedInputStream cis, java.io.InputStream is, int len)Compare the calculated checksum to the expected one.protected static voidcheckFormat(java.io.InputStream is, byte[] format)Check fornullterminated format string.protected static intcountToNull(byte[] b, int start)Get the first position of the NULL byte within an array of bytesprotected java.lang.StringgetDebugPartStr()Get a string for debugging purposes, containing the name and starting position of this part.protected intgetIntegerProperty(java.util.Map<java.lang.String,java.lang.String> props, java.lang.String prop, java.lang.String name)Get the positive integer value from a property map.protected java.util.Map<java.lang.String,java.lang.String>getProperties()Get properties, if any.protected static java.util.Map<java.lang.String,java.lang.String>getProperties(java.io.InputStream is)Get the properties from the input stream, reading at most BUFLEN bytes.protected static java.util.Map<java.lang.String,java.lang.String>mapProperties(byte[] props)Get properties as a key, value mapprotected abstract voidparse(java.io.InputStream is)Parse from input streamprotected static byte[]readToNull(java.io.InputStream is)Read null terminated series of bytes
-
-
-
Field Detail
-
COOKIE
protected static final byte[] COOKIE
-
BUFLEN
private static final int BUFLEN
- See Also:
- Constant Field Values
-
name
protected final java.lang.String name
-
pos
protected final long pos
-
properties
protected java.util.Map<java.lang.String,java.lang.String> properties
-
-
Method Detail
-
parse
protected abstract void parse(java.io.InputStream is) throws java.io.IOExceptionParse from input stream- Parameters:
is-- Throws:
java.io.IOException
-
getProperties
protected java.util.Map<java.lang.String,java.lang.String> getProperties()
Get properties, if any.- Returns:
- key, value map
-
getDebugPartStr
protected java.lang.String getDebugPartStr()
Get a string for debugging purposes, containing the name and starting position of this part.- Returns:
- string
-
checkControl
protected static void checkControl(java.io.InputStream is, HDTPart.Type ctype) throws java.io.IOExceptionCheck start of part for$HDTand the byte indicating the type- Parameters:
is- input streamctype- control type- Throws:
java.io.IOException
-
checkFormat
protected static void checkFormat(java.io.InputStream is, byte[] format) throws java.io.IOExceptionCheck fornullterminated format string.- Parameters:
is-format-- Throws:
java.io.IOException
-
readToNull
protected static byte[] readToNull(java.io.InputStream is) throws java.io.IOExceptionRead null terminated series of bytes- Parameters:
is- input stream- Returns:
- Throws:
java.io.IOException
-
countToNull
protected static int countToNull(byte[] b, int start) throws java.io.IOExceptionGet the first position of the NULL byte within an array of bytes- Parameters:
b- byte arraystart- position to start from- Returns:
- position of first NULL byte
- Throws:
java.io.IOException
-
getProperties
protected static java.util.Map<java.lang.String,java.lang.String> getProperties(java.io.InputStream is) throws java.io.IOExceptionGet the properties from the input stream, reading at most BUFLEN bytes. The properties are encoded as akey=value;string and must benullterminated.- Parameters:
is- input stream- Returns:
- key, value map
- Throws:
java.io.IOException
-
mapProperties
protected static java.util.Map<java.lang.String,java.lang.String> mapProperties(byte[] props)
Get properties as a key, value map- Parameters:
props-- Returns:
-
getIntegerProperty
protected int getIntegerProperty(java.util.Map<java.lang.String,java.lang.String> props, java.lang.String prop, java.lang.String name) throws java.io.IOExceptionGet the positive integer value from a property map. Throw an exception when the property is missing, or less than 1.- Parameters:
props- property mapprop- name of the propertyname- display name of the property- Returns:
- positive integer
- Throws:
java.io.IOException
-
checkCRC
protected static void checkCRC(java.util.zip.CheckedInputStream cis, java.io.InputStream is, int len) throws java.io.IOExceptionCompare the calculated checksum to the expected one.- Parameters:
cis- checked input streamis- (unchecked) input streamlen- number of bytes of the checksum- Throws:
java.io.IOException
-
-