T
- the type of local featurepublic class StreamLocalFeatureList<T extends LocalFeature<?,?>> extends AbstractStreamBackedList<T> implements LocalFeatureList<T>
LocalFeature
s backed by an input stream. The list is
read-only, and can only be read in order (i.e. random access is not
possible).clz, consumed, headerLength, isBinary, recordLength, size
modCount
BINARY_HEADER
Modifier | Constructor and Description |
---|---|
protected |
StreamLocalFeatureList(InputStream stream,
int size,
boolean isBinary,
int headerLength,
int recordLength,
int veclen,
Class<T> clz) |
Modifier and Type | Method and Description |
---|---|
String |
asciiHeader()
Header for ascii output.
|
<Q> Q[] |
asDataArray(Q[] a)
Get the feature-vector data of the list as a two-dimensional array of
data.
|
byte[] |
binaryHeader()
Header for binary output.
|
protected T |
newElementInstance()
Override this id your instances can't be constructed with a no-args ctr
|
static <T extends LocalFeature<?,?>> |
read(BufferedInputStream stream,
Class<T> clz)
Construct a new StreamLocalFeatureList from the given input stream.
|
static <T extends LocalFeature<?,?>> |
read(InputStream stream,
Class<T> clz)
Construct a new StreamLocalFeatureList from the given input stream.
|
MemoryLocalFeatureList<T> |
subList(int fromIndex,
int toIndex) |
int |
vecLength()
Get the length of the feature-vectors of each local feature if they are
constant.
|
void |
writeASCII(PrintWriter out)
Write the content of this as ascii to out.
|
void |
writeBinary(DataOutput out)
Write the content of this as binary to out.
|
consumed, listIterator, randomSubList, readRecord, readRecordASCII, remaining, size
add, addAll, get, iterator, remove, set
add, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, removeRange
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
randomSubList
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, toArray, toArray
parallelStream, removeIf, stream
protected StreamLocalFeatureList(InputStream stream, int size, boolean isBinary, int headerLength, int recordLength, int veclen, Class<T> clz)
public static <T extends LocalFeature<?,?>> StreamLocalFeatureList<T> read(InputStream stream, Class<T> clz) throws IOException
T
- the type of local featurestream
- the input streamclz
- the class of local feature to readIOException
- if an error occurs reading from the streampublic static <T extends LocalFeature<?,?>> StreamLocalFeatureList<T> read(BufferedInputStream stream, Class<T> clz) throws IOException
T
- the type of local featurestream
- the input streamclz
- the class of local feature to readIOException
- if an error occurs reading from the streampublic <Q> Q[] asDataArray(Q[] a)
LocalFeatureList
asDataArray
in interface LocalFeatureList<T extends LocalFeature<?,?>>
Q
- the data typea
- the array to fillpublic int vecLength()
LocalFeatureList
vecLength
in interface LocalFeatureList<T extends LocalFeature<?,?>>
public void writeBinary(DataOutput out) throws IOException
WriteableBinary
writeBinary
in interface WriteableBinary
out
- sink to write toIOException
- an error writing to outpublic void writeASCII(PrintWriter out) throws IOException
WriteableASCII
writeASCII
in interface WriteableASCII
out
- sink to write toIOException
- an error writing to outpublic byte[] binaryHeader()
WriteableBinary
binaryHeader
in interface WriteableBinary
public String asciiHeader()
WriteableASCII
asciiHeader
in interface WriteableASCII
protected T newElementInstance()
AbstractStreamBackedList
newElementInstance
in class AbstractStreamBackedList<T extends LocalFeature<?,?>>
public MemoryLocalFeatureList<T> subList(int fromIndex, int toIndex)
subList
in interface List<T extends LocalFeature<?,?>>
subList
in interface LocalFeatureList<T extends LocalFeature<?,?>>
subList
in class AbstractList<T extends LocalFeature<?,?>>