ml.shifu.guagua.util
类 BytableMemoryDiskList<T extends Bytable>

java.lang.Object
  继承者 ml.shifu.guagua.util.BytableMemoryDiskList<T>
所有已实现的接口:
Iterable<T>, AppendList<T>

public class BytableMemoryDiskList<T extends Bytable>
extends Object
implements AppendList<T>

A list to store Bytable data firstly into memory then into disk if over threshold.

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.

作者:
Zhang David (pengzhang@paypal.com)

嵌套类摘要
 
从接口 ml.shifu.guagua.util.AppendList 继承的嵌套类/接口
AppendList.State
 
构造方法摘要
BytableMemoryDiskList(List<T> delegationList, String className)
          Constructor with only memory delegationList.
BytableMemoryDiskList(long maxSize, BytableDiskList<T> bytableDiskList)
          Constructor with memory bytes size limit and bytableDiskList setting.
BytableMemoryDiskList(long maxSize, List<T> delegationList, String className)
          Constructor with max bytes size of memory and delegationList.
BytableMemoryDiskList(long maxSize, List<T> delegationList, String fileName, String className)
          Constructor with max bytes size of memory and delegationList and disk file name in current working dir.
BytableMemoryDiskList(long maxSize, String className)
          Constructor with only memory bytes size limit and className.
BytableMemoryDiskList(long maxSize, String fileName, String className)
          Constructor with max bytes size of memory and disk file name in current working dir.
BytableMemoryDiskList(String className)
          Default constructor.
 
方法摘要
 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.
 long size()
          Return size of this list.
 void switchState()
          After appending, switch state from WRITE to READ to allow iterating.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

BytableMemoryDiskList

public BytableMemoryDiskList(long maxSize,
                             List<T> delegationList,
                             String className)
Constructor with max bytes size of memory and delegationList. Disk file name is random filename in current working dir.


BytableMemoryDiskList

public BytableMemoryDiskList(List<T> delegationList,
                             String className)
Constructor with only memory delegationList. By default no limit of bytes size in memory.


BytableMemoryDiskList

public BytableMemoryDiskList(long maxSize,
                             List<T> delegationList,
                             String fileName,
                             String className)
Constructor with max bytes size of memory and delegationList and disk file name in current working dir.


BytableMemoryDiskList

public BytableMemoryDiskList(long maxSize,
                             String fileName,
                             String className)
Constructor with max bytes size of memory and disk file name in current working dir. By default LinkedList is used for memory list.


BytableMemoryDiskList

public BytableMemoryDiskList(long maxSize,
                             BytableDiskList<T> bytableDiskList)
Constructor with memory bytes size limit and bytableDiskList setting.


BytableMemoryDiskList

public BytableMemoryDiskList(long maxSize,
                             String className)
Constructor with only memory bytes size limit and className.


BytableMemoryDiskList

public BytableMemoryDiskList(String className)
Default constructor. By default no memory limit, LinkedList and random file name.

方法详细信息

append

public boolean append(T t)
从接口 AppendList 复制的描述
Append object to this list

指定者:
接口 AppendList<T extends Bytable> 中的 append
参数:
t - the object to append
返回:
whether appending object successful

close

public void close()
Close disk stream. Should be called at the end of usage of BytableMemoryDiskList.


reOpen

public void reOpen()
Reopen stream for iteration.


iterator

public Iterator<T> iterator()
指定者:
接口 Iterable<T extends Bytable> 中的 iterator

switchState

public void switchState()
从接口 AppendList 复制的描述
After appending, switch state from WRITE to READ to allow iterating.

指定者:
接口 AppendList<T extends Bytable> 中的 switchState

size

public long size()
从接口 AppendList 复制的描述
Return size of this list.

指定者:
接口 AppendList<T extends Bytable> 中的 size

clear

public void clear()
从接口 AppendList 复制的描述
Clear all elements.

指定者:
接口 AppendList<T extends Bytable> 中的 clear


Copyright © 2015. All Rights Reserved.