Class ByteTrie<T>
java.lang.Object
org.apache.pdfbox.util.filetypedetector.ByteTrie<T>
- Type Parameters:
T
- the type of value to store for byte sequences
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
A node in the trie. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Store the given value at the specified path.find
(byte[] bytes) Return the most specific value stored for this byte sequence.int
Gets the maximum depth stored in this trie.void
setDefaultValue
(T defaultValue) Sets the default value to use infind(byte[])
when no path matches.
-
Field Details
-
root
-
maxDepth
private int maxDepth
-
-
Constructor Details
-
ByteTrie
ByteTrie()
-
-
Method Details
-
find
Return the most specific value stored for this byte sequence. If not found, returnsnull
or a default values as specified by callingsetDefaultValue(T)
.- Parameters:
bytes
-- Returns:
-
addPath
Store the given value at the specified path.- Parameters:
value
-parts
-
-
setDefaultValue
Sets the default value to use infind(byte[])
when no path matches.- Parameters:
defaultValue
-
-
getMaxDepth
public int getMaxDepth()Gets the maximum depth stored in this trie.- Returns:
-