|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<T>
org.simantics.databoard.file.RandomAccessBinaryList<T>
public class RandomAccessBinaryList<T>
BlobList is a RandomAccessBinary
backend implementation of a List
collection. add() and get() operations serialize and deserialize objects
from binary format.
Set, remove, insert and add operations flush() modifications to before return.
Each operation may throw RuntimeIOException
, if there is IOException
in the RandomAccessBinary
Entry position index is on open if the file has variable width data type (eg. String). The entire file is scanned through.
TODO lazy index. Append alone (add()) doesn't require scan.
File based implementation
Constructor Summary | |
---|---|
RandomAccessBinaryList(RandomAccessBinary blob,
Binding binding,
long startPos,
SerializerScheme format)
Create new random access list backed by a file |
Method Summary | |
---|---|
void |
add(int index,
T element)
|
boolean |
addAll(java.util.Collection<? extends T> c)
|
boolean |
addAll(int index,
java.util.Collection<? extends T> c)
|
void |
close()
Flushes the caches and closes the file handle. |
T |
get(int index)
|
Binding |
getBinding()
Get class-data type binding |
java.io.File |
getFile()
Get the mapped file |
boolean |
isOpen()
|
T |
remove(int index)
|
void |
removeRange(int fromIndex,
int toIndex)
Removes from this list all of the elements whose index is between fromIndex , inclusive, and toIndex , exclusive. |
T |
set(int index,
T element)
|
void |
setAll(java.util.Collection<? extends T> c)
Replace the whole content with the content of another collection |
int |
size()
|
Methods inherited from class java.util.AbstractList |
---|
add, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, subList |
Methods inherited from class java.util.AbstractCollection |
---|
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
add, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, retainAll, subList, toArray, toArray |
Constructor Detail |
---|
public RandomAccessBinaryList(RandomAccessBinary blob, Binding binding, long startPos, SerializerScheme format) throws java.io.IOException, SerializerConstructionException, SerializationException
blob
- blobbinding
- startPos
- The position of the first sample in fileformat
- serialization format
java.io.IOException
SerializerConstructionException
- could not create serializer, never thrown with BinarySerializationFormat
SerializationException
- Error with the file, could not build entry indexMethod Detail |
---|
public int size() throws RuntimeIOException
size
in interface java.util.Collection<T>
size
in interface java.util.List<T>
size
in class java.util.AbstractCollection<T>
RuntimeIOException
public boolean isOpen()
public void close()
close
in interface IFileList<T>
public Binding getBinding()
IFileList
getBinding
in interface IFileList<T>
public T get(int index) throws RuntimeIOException
get
in interface java.util.List<T>
get
in class java.util.AbstractList<T>
RuntimeIOException
public void add(int index, T element) throws RuntimeIOException, RuntimeBindingException
add
in interface java.util.List<T>
add
in class java.util.AbstractList<T>
RuntimeIOException
RuntimeBindingException
public void setAll(java.util.Collection<? extends T> c) throws RuntimeIOException
c
- collection
RuntimeIOException
public T set(int index, T element) throws RuntimeIOException, RuntimeBindingException
set
in interface java.util.List<T>
set
in class java.util.AbstractList<T>
RuntimeIOException
RuntimeBindingException
public void removeRange(int fromIndex, int toIndex) throws RuntimeIOException
IFileList
fromIndex
, inclusive, and toIndex
, exclusive.
Shifts any succeeding elements to the left (reduces their index). This
call shortens the List by (toIndex - fromIndex)
elements.
(If toIndex==fromIndex
, this operation has no effect.)
removeRange
in interface IFileList<T>
removeRange
in class java.util.AbstractList<T>
fromIndex
- the index of the first element to removed.toIndex
- index after last element to be removed (exculsive).
RuntimeIOException
public T remove(int index) throws RuntimeIOException
remove
in interface java.util.List<T>
remove
in class java.util.AbstractList<T>
RuntimeIOException
public boolean addAll(java.util.Collection<? extends T> c) throws RuntimeIOException
addAll
in interface java.util.Collection<T>
addAll
in interface java.util.List<T>
addAll
in class java.util.AbstractCollection<T>
RuntimeIOException
public boolean addAll(int index, java.util.Collection<? extends T> c) throws RuntimeIOException, RuntimeBindingException
addAll
in interface java.util.List<T>
addAll
in class java.util.AbstractList<T>
RuntimeIOException
RuntimeBindingException
public java.io.File getFile()
IFileList
getFile
in interface IFileList<T>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |