public class MemoryDiskList<T extends Serializable> extends Object implements AppendList<T>
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 to release file descriptor.
User should provide fileName in constructor and only one file is used to store data.
AppendList.State| Constructor and Description |
|---|
MemoryDiskList()
Default constructor.
|
MemoryDiskList(List<T> delegationList)
Constructor with only memory
delegationList. |
MemoryDiskList(long maxSize)
Constructor with only memory bytes size limit.
|
MemoryDiskList(long maxSize,
List<T> delegationList)
Constructor with max bytes size of memory and
delegationList. |
MemoryDiskList(long maxSize,
List<T> delegationList,
String fileName)
Constructor with max bytes size of memory and
delegationList and disk file name in current working dir. |
MemoryDiskList(long maxSize,
String fileName)
Constructor with max bytes size of memory and disk file name in current working dir.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
append(T t)
Append object to this list
|
void |
clear()
Clear all elements.
|
void |
close()
Close disk stream.
|
Iterator<T> |
iterator() |
void |
reOpen()
Reopen stream for iteration.
|
int |
size()
Return size of this list.
|
void |
switchState()
After appending, switch state from WRITE to READ to allow iterating.
|
public MemoryDiskList(long maxSize,
List<T> delegationList)
delegationList. Disk file name is random filename in
current working dir.public MemoryDiskList(List<T> delegationList)
delegationList. By default no limit of bytes size in memory.public MemoryDiskList(long maxSize,
List<T> delegationList,
String fileName)
delegationList and disk file name in current working dir.public MemoryDiskList(long maxSize,
String fileName)
LinkedList is used for memory list.public MemoryDiskList(long maxSize)
public MemoryDiskList()
LinkedList and random file name.public boolean append(T t)
AppendListappend in interface AppendList<T extends Serializable>t - the object to appendpublic void close()
MemoryDiskList.public void reOpen()
public Iterator<T> iterator()
iterator in interface Iterable<T extends Serializable>public void switchState()
AppendListswitchState in interface AppendList<T extends Serializable>public int size()
AppendListsize in interface AppendList<T extends Serializable>public void clear()
AppendListclear in interface AppendList<T extends Serializable>Copyright © 2015. All Rights Reserved.