public class Searcher extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
HeaderInfoLength |
static int |
SegmentIndexSize |
static byte[] |
shiftIndex |
static int |
VectorIndexCols |
static int |
VectorIndexRows |
static int |
VectorIndexSize |
| Constructor and Description |
|---|
Searcher(String dbFile,
byte[] vectorIndex,
byte[] cBuff) |
| Modifier and Type | Method and Description |
|---|---|
static long |
checkIP(String ip) |
void |
close() |
static int |
getInt(byte[] b,
int offset) |
static int |
getInt2(byte[] b,
int offset) |
static long |
getIntLong(byte[] b,
int offset) |
int |
getIOCount() |
static byte[] |
loadContent(RandomAccessFile handle) |
static byte[] |
loadContentFromFile(String dbPath) |
static Header |
loadHeader(RandomAccessFile handle) |
static Header |
loadHeaderFromFile(String dbPath) |
static byte[] |
loadVectorIndex(RandomAccessFile handle) |
static byte[] |
loadVectorIndexFromFile(String dbPath) |
static String |
long2ip(long ip) |
static Searcher |
newWithBuffer(byte[] cBuff) |
static Searcher |
newWithFileOnly(String dbPath) |
static Searcher |
newWithVectorIndex(String dbPath,
byte[] vectorIndex) |
protected void |
read(int offset,
byte[] buffer) |
String |
search(long ip) |
String |
search(String ipStr) |
public static final int HeaderInfoLength
public static final int VectorIndexRows
public static final int VectorIndexCols
public static final int VectorIndexSize
public static final int SegmentIndexSize
public static final byte[] shiftIndex
public Searcher(String dbFile, byte[] vectorIndex, byte[] cBuff) throws IOException
IOExceptionpublic static Searcher newWithFileOnly(String dbPath) throws IOException
IOExceptionpublic static Searcher newWithVectorIndex(String dbPath, byte[] vectorIndex) throws IOException
IOExceptionpublic static Searcher newWithBuffer(byte[] cBuff) throws IOException
IOExceptionpublic void close()
throws IOException
IOExceptionpublic int getIOCount()
public String search(long ip) throws IOException
IOExceptionprotected void read(int offset,
byte[] buffer)
throws IOException
IOExceptionpublic static Header loadHeader(RandomAccessFile handle) throws IOException
IOExceptionpublic static Header loadHeaderFromFile(String dbPath) throws IOException
IOExceptionpublic static byte[] loadVectorIndex(RandomAccessFile handle) throws IOException
IOExceptionpublic static byte[] loadVectorIndexFromFile(String dbPath) throws IOException
IOExceptionpublic static byte[] loadContent(RandomAccessFile handle) throws IOException
IOExceptionpublic static byte[] loadContentFromFile(String dbPath) throws IOException
IOExceptionpublic static long getIntLong(byte[] b,
int offset)
public static int getInt(byte[] b,
int offset)
public static int getInt2(byte[] b,
int offset)
public static String long2ip(long ip)
Copyright © 2022. All rights reserved.