java.lang.Object
com.maxmind.db.Reader.Walker
- Enclosing class:
Reader
Walks the search tree writing the IPv4 ranges of one country.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ByteBufferBuffer holding the database data.private final StringThe country code being walked.private intRecord number of the country being walked, -1 until found.Node numbers already reported as not found.private final intNumber of nodes in the search tree.private final WriterWhere the walk writes its output.Constructor Summary
Method Summary
Field Details
_country
The country code being walked._out
Where the walk writes its output._nodeCount
private final int _nodeCountNumber of nodes in the search tree._buffer
Buffer holding the database data._negativeCache
_countryRecord
private int _countryRecordRecord number of the country being walked, -1 until found.
Constructor Details
Walker
Write all IPv4 address ranges for the given country to out.- Parameters:
country- the ISO 3166-1 alpha-2 code, upper caseout- where the ranges are written, in CIDR form- Throws:
IOException- declared by the signature, not thrown here
Method Details
walk
Writes the IPv4 ranges of the country, call once only.- Throws:
IOException- if the output write fails
walk
Recursive, depth first- Parameters:
record- the node number being visitedip- the IPv4 prefix walked so far, packed into the high bits of an intdepth- the number of address bits already walked- Throws:
IOException- if the output write fails