public class BytableDiskList<T extends Bytable> extends Object implements AppendList<T>
Bytable data into disk.
No size limit for this list but user should make sure valid fileName when constructing.
Only two stages support in such kind of list. The first one is WRITE, the next is read. So far random WRITE and READ are not supported in this list.
WARNING: close() should be called at last if use such List.
AppendList.State| Constructor and Description |
|---|
BytableDiskList(String fileName,
String className)
Constructor with file name in current working dir and instance class name.
|
BytableDiskList(String fileName,
String className,
BytableSerializer<T> serializer)
Constructor with file name in current working dir, class name and serializer instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
append(T t)
Append object to this list
|
void |
clear()
Delete file to store elements.
|
void |
close()
This method should be called at the end of
BytableDiskList usage to release file descriptors. |
BytableSerializer<T> |
getSerializer() |
Iterator<T> |
iterator() |
void |
reOpen()
Re-open stream for iterators.
|
void |
setSerializer(BytableSerializer<T> serializer) |
int |
size()
Return size of this list.
|
void |
switchState()
Switch state from WRITE to READ
|
public BytableDiskList(String fileName, String className)
public BytableDiskList(String fileName, String className, BytableSerializer<T> serializer)
public void switchState()
switchState in interface AppendList<T extends Bytable>public void reOpen()
public boolean append(T t)
AppendListappend in interface AppendList<T extends Bytable>t - the object to appendpublic void close()
BytableDiskList usage to release file descriptors.public BytableSerializer<T> getSerializer()
public void setSerializer(BytableSerializer<T> serializer)
serializer - the serializer to setpublic int size()
AppendListsize in interface AppendList<T extends Bytable>public void clear()
clear in interface AppendList<T extends Bytable>Copyright © 2015. All Rights Reserved.