Top Inners Fields Constructors Methods
org.apache.pdfbox.util.filetypedetector

pack-priv Class ByteTrie<T>

extends Object
Class Inheritance
Type Parameters
<T>
the type of value to store for byte sequences
Imports
java.util.HashMap, .Map

Author
Drew Noakes code taken from https://github.com/drewnoakes/metadata-extractor 2016-01-04 latest commit number 73f1a48 Stores values using a prefix tree (aka 'trie', i.e. reTRIEval data structure).

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
ByteTrie.ByteTrieNode<T>

A node in the trie.

Field Summary

Modifier and TypeField and Description
private int
private final ByteTrie.ByteTrieNode<T>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
addPath(T value, byte[]... parts)

Store the given value at the specified path.

public T
find(byte[] bytes)

Return the most specific value stored for this byte sequence.

public int
getMaxDepth()

Gets the maximum depth stored in this trie.

public void
setDefaultValue(T defaultValue)

Sets the default value to use in ByteTrie#find(byte[]) when no path matches.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

maxDepthback to summary
private int maxDepth
rootback to summary
private final ByteTrie.ByteTrieNode<T> root

Constructor Detail

ByteTrieback to summary
pack-priv ByteTrie()

Method Detail

addPathback to summary
public void addPath(T value, byte[]... parts)

Store the given value at the specified path.

findback to summary
public T find(byte[] bytes)

Return the most specific value stored for this byte sequence. If not found, returns null or a default values as specified by calling ByteTrie#setDefaultValue.

getMaxDepthback to summary
public int getMaxDepth()

Gets the maximum depth stored in this trie.

setDefaultValueback to summary
public void setDefaultValue(T defaultValue)

Sets the default value to use in ByteTrie#find(byte[]) when no path matches.

org.apache.pdfbox.util.filetypedetector back to summary

pack-priv Class ByteTrie.ByteTrieNode<T>

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.pdfbox.util.filetypedetector.ByteTrie.ByteTrieNode

A node in the trie. Has children and may have an associated value.

Field Summary

Modifier and TypeField and Description
private final Map<Byte, ByteTrie.ByteTrieNode<T>>
private T

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public T
public void
setValue(T value)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

childrenback to summary
private final Map<Byte, ByteTrie.ByteTrieNode<T>> children
valueback to summary
private T value

Constructor Detail

ByteTrieNodeback to summary
pack-priv ByteTrieNode()

Method Detail

getValueback to summary
public T getValue()
setValueback to summary
public void setValue(T value)