public final class ReaderImpl extends java.lang.Object implements StoreReader
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the store reader and free resources.
|
<K> K |
get(java.lang.Object key)
Gets the value for
key or null if not found. |
<K> K |
get(java.lang.Object key,
K defaultValue)
Gets the value for
key or defaultValue if not found. |
<K> K[] |
getArray(java.lang.Object key)
Gets the object array value for
key or null if not found. |
<K> K[] |
getArray(java.lang.Object key,
K[] defaultValue)
Gets the object array value for
key or defaultValue if not found. |
boolean |
getBoolean(java.lang.Object key)
Gets the boolean value for
key . |
boolean |
getBoolean(java.lang.Object key,
boolean defaultValue)
Gets the boolean value for
key or defaultValue if not found. |
boolean[] |
getBooleanArray(java.lang.Object key)
Gets the boolean array value for
key . |
boolean[] |
getBooleanArray(java.lang.Object key,
boolean[] defaultValue)
Gets the boolean array value for
key or defaultValue if not found. |
byte |
getByte(java.lang.Object key)
Gets the byte value for
key . |
byte |
getByte(java.lang.Object key,
byte defaultValue)
Gets the byte value for
key or defaultValue if not found. |
byte[] |
getByteArray(java.lang.Object key)
Gets the byte array value for
key . |
byte[] |
getByteArray(java.lang.Object key,
byte[] defaultValue)
Gets the byte array value for
key or defaultValue if not found. |
char |
getChar(java.lang.Object key)
Gets the char value for
key . |
char |
getChar(java.lang.Object key,
char defaultValue)
Gets the char value for
key or defaultValue if not found. |
char[] |
getCharArray(java.lang.Object key)
Gets the char array value for
key . |
char[] |
getCharArray(java.lang.Object key,
char[] defaultValue)
Gets the char array value for
key or defaultValue if not found. |
Configuration |
getConfiguration()
Returns the reader's configuration.
|
double |
getDouble(java.lang.Object key)
Gets the double value for
key . |
double |
getDouble(java.lang.Object key,
double defaultValue)
Gets the double value for
key or defaultValue if not found. |
double[] |
getDoubleArray(java.lang.Object key)
Gets the double array value for
key . |
double[] |
getDoubleArray(java.lang.Object key,
double[] defaultValue)
Gets the double array value for
key or defaultValue if not found. |
java.io.File |
getFile()
Returns the store file.
|
float |
getFloat(java.lang.Object key)
Gets the float value for
key . |
float |
getFloat(java.lang.Object key,
float defaultValue)
Gets the float value for
key or defaultValue if not found. |
float[] |
getFloatArray(java.lang.Object key)
Gets the float array value for
key . |
float[] |
getFloatArray(java.lang.Object key,
float[] defaultValue)
Gets the float array value for
key or defaultValue if not found. |
int |
getInt(java.lang.Object key)
Gets the int value for
key . |
int |
getInt(java.lang.Object key,
int defaultValue)
Gets the int value for
key or defaultValue if not found. |
int[] |
getIntArray(java.lang.Object key)
Gets the int array value for
key . |
int[] |
getIntArray(java.lang.Object key,
int[] defaultValue)
Gets the int array value for
key or defaultValue if not found. |
long |
getLong(java.lang.Object key)
Gets the long value for
key . |
long |
getLong(java.lang.Object key,
long defaultValue)
Gets the long value for
key or defaultValue if not found. |
long[] |
getLongArray(java.lang.Object key)
Gets the long array value for
key . |
long[] |
getLongArray(java.lang.Object key,
long[] defaultValue)
Gets the long array value for
key or defaultValue if not found. |
short |
getShort(java.lang.Object key)
Gets the short value for
key . |
short |
getShort(java.lang.Object key,
short defaultValue)
Gets the short value for
key or defaultValue if not found. |
short[] |
getShortArray(java.lang.Object key)
Gets the short array value for
key . |
short[] |
getShortArray(java.lang.Object key,
short[] defaultValue)
Gets the short array value for
key or defaultValue if not found. |
java.lang.String |
getString(java.lang.Object key)
Gets the string value for
key or null if not found. |
java.lang.String |
getString(java.lang.Object key,
java.lang.String defaultValue)
Gets the string value for
key or defaultValue if not found. |
java.lang.String[] |
getStringArray(java.lang.Object key)
Gets the string array value for
key or null if not found. |
java.lang.String[] |
getStringArray(java.lang.Object key,
java.lang.String[] defaultValue)
Gets the string array value for
key or defaultValue if not found. |
<K,V> java.lang.Iterable<java.util.Map.Entry<K,V>> |
iterable()
Gets the store iterable.
|
<K> java.lang.Iterable<K> |
keys()
Gets the store keys iterable.
|
long |
size()
Returns the number of keys in the store.
|
public void close()
StoreReader
A closed reader can't be reopened.
close
in interface StoreReader
public long size()
StoreReader
size
in interface StoreReader
public Configuration getConfiguration()
StoreReader
getConfiguration
in interface StoreReader
public java.io.File getFile()
StoreReader
getFile
in interface StoreReader
public <K> K get(java.lang.Object key)
StoreReader
key
or null if not found.get
in interface StoreReader
K
- return typekey
- key to fetchpublic <K> K get(java.lang.Object key, K defaultValue)
StoreReader
key
or defaultValue
if not found.get
in interface StoreReader
K
- return typekey
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic int getInt(java.lang.Object key, int defaultValue)
StoreReader
key
or defaultValue
if not found.getInt
in interface StoreReader
key
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic int getInt(java.lang.Object key) throws NotFoundException
StoreReader
key
.getInt
in interface StoreReader
key
- key to fetchNotFoundException
- if not foundpublic long getLong(java.lang.Object key, long defaultValue)
StoreReader
key
or defaultValue
if not found.getLong
in interface StoreReader
key
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic long getLong(java.lang.Object key) throws NotFoundException
StoreReader
key
.getLong
in interface StoreReader
key
- key to fetchNotFoundException
- if not foundpublic boolean getBoolean(java.lang.Object key, boolean defaultValue)
StoreReader
key
or defaultValue
if not found.getBoolean
in interface StoreReader
key
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic boolean getBoolean(java.lang.Object key) throws NotFoundException
StoreReader
key
.getBoolean
in interface StoreReader
key
- key to fetchNotFoundException
- if not foundpublic float getFloat(java.lang.Object key, float defaultValue)
StoreReader
key
or defaultValue
if not found.getFloat
in interface StoreReader
key
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic float getFloat(java.lang.Object key) throws NotFoundException
StoreReader
key
.getFloat
in interface StoreReader
key
- key to fetchNotFoundException
- if not foundpublic double getDouble(java.lang.Object key, double defaultValue)
StoreReader
key
or defaultValue
if not found.getDouble
in interface StoreReader
key
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic double getDouble(java.lang.Object key) throws NotFoundException
StoreReader
key
.getDouble
in interface StoreReader
key
- key to fetchNotFoundException
- if not foundpublic short getShort(java.lang.Object key, short defaultValue)
StoreReader
key
or defaultValue
if not found.getShort
in interface StoreReader
key
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic short getShort(java.lang.Object key) throws NotFoundException
StoreReader
key
.getShort
in interface StoreReader
key
- key to fetchNotFoundException
- if not foundpublic byte getByte(java.lang.Object key, byte defaultValue)
StoreReader
key
or defaultValue
if not found.getByte
in interface StoreReader
key
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic byte getByte(java.lang.Object key) throws NotFoundException
StoreReader
key
.getByte
in interface StoreReader
key
- key to fetchNotFoundException
- if not foundpublic java.lang.String getString(java.lang.Object key, java.lang.String defaultValue)
StoreReader
key
or defaultValue
if not found.getString
in interface StoreReader
key
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic java.lang.String getString(java.lang.Object key)
StoreReader
key
or null if not found.getString
in interface StoreReader
key
- key to fetchpublic char getChar(java.lang.Object key, char defaultValue)
StoreReader
key
or defaultValue
if not found.getChar
in interface StoreReader
key
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic char getChar(java.lang.Object key) throws NotFoundException
StoreReader
key
.getChar
in interface StoreReader
key
- key to fetchNotFoundException
- if not foundpublic <K> K[] getArray(java.lang.Object key)
StoreReader
key
or null if not found.getArray
in interface StoreReader
K
- return typekey
- key to fetchpublic <K> K[] getArray(java.lang.Object key, K[] defaultValue)
StoreReader
key
or defaultValue
if not found.getArray
in interface StoreReader
K
- return typekey
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic int[] getIntArray(java.lang.Object key, int[] defaultValue)
StoreReader
key
or defaultValue
if not found.getIntArray
in interface StoreReader
key
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic int[] getIntArray(java.lang.Object key) throws NotFoundException
StoreReader
key
.getIntArray
in interface StoreReader
key
- key to fetchNotFoundException
- if not foundpublic long[] getLongArray(java.lang.Object key, long[] defaultValue)
StoreReader
key
or defaultValue
if not found.getLongArray
in interface StoreReader
key
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic long[] getLongArray(java.lang.Object key) throws NotFoundException
StoreReader
key
.getLongArray
in interface StoreReader
key
- key to fetchNotFoundException
- if not foundpublic boolean[] getBooleanArray(java.lang.Object key, boolean[] defaultValue)
StoreReader
key
or defaultValue
if not found.getBooleanArray
in interface StoreReader
key
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic boolean[] getBooleanArray(java.lang.Object key) throws NotFoundException
StoreReader
key
.getBooleanArray
in interface StoreReader
key
- key to fetchNotFoundException
- if not foundpublic float[] getFloatArray(java.lang.Object key, float[] defaultValue)
StoreReader
key
or defaultValue
if not found.getFloatArray
in interface StoreReader
key
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic float[] getFloatArray(java.lang.Object key) throws NotFoundException
StoreReader
key
.getFloatArray
in interface StoreReader
key
- key to fetchNotFoundException
- if not foundpublic double[] getDoubleArray(java.lang.Object key, double[] defaultValue)
StoreReader
key
or defaultValue
if not found.getDoubleArray
in interface StoreReader
key
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic double[] getDoubleArray(java.lang.Object key) throws NotFoundException
StoreReader
key
.getDoubleArray
in interface StoreReader
key
- key to fetchNotFoundException
- if not foundpublic short[] getShortArray(java.lang.Object key, short[] defaultValue)
StoreReader
key
or defaultValue
if not found.getShortArray
in interface StoreReader
key
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic short[] getShortArray(java.lang.Object key) throws NotFoundException
StoreReader
key
.getShortArray
in interface StoreReader
key
- key to fetchNotFoundException
- if not foundpublic byte[] getByteArray(java.lang.Object key, byte[] defaultValue)
StoreReader
key
or defaultValue
if not found.getByteArray
in interface StoreReader
key
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic byte[] getByteArray(java.lang.Object key) throws NotFoundException
StoreReader
key
.getByteArray
in interface StoreReader
key
- key to fetchNotFoundException
- if not foundpublic java.lang.String[] getStringArray(java.lang.Object key, java.lang.String[] defaultValue)
StoreReader
key
or defaultValue
if not found.getStringArray
in interface StoreReader
key
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic java.lang.String[] getStringArray(java.lang.Object key)
StoreReader
key
or null if not found.getStringArray
in interface StoreReader
key
- key to fetchpublic char[] getCharArray(java.lang.Object key, char[] defaultValue)
StoreReader
key
or defaultValue
if not found.getCharArray
in interface StoreReader
key
- key to fetchdefaultValue
- default valuedefaultValue
if not foundpublic char[] getCharArray(java.lang.Object key) throws NotFoundException
StoreReader
key
.getCharArray
in interface StoreReader
key
- key to fetchNotFoundException
- if not foundpublic <K,V> java.lang.Iterable<java.util.Map.Entry<K,V>> iterable()
StoreReader
Note that entry objects are reused.
iterable
in interface StoreReader
K
- key typeV
- value typepublic <K> java.lang.Iterable<K> keys()
StoreReader
keys
in interface StoreReader
K
- key type