ml.shifu.guagua.util
类 DiskList<T extends Serializable>

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

public class DiskList<T extends Serializable>
extends Object
implements AppendList<T>

A list wrapper to implement store 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.

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

嵌套类摘要
 
从接口 ml.shifu.guagua.util.AppendList 继承的嵌套类/接口
AppendList.State
 
构造方法摘要
DiskList(String fileName)
          Constructor with file name in current working dir.
 
方法摘要
 boolean append(T t)
          Append object to this list
 void clear()
          Clear all elements.
 void close()
          This method should be called at the end of DiskList usage to release file descriptors.
 ObjectSerializer<T> getSerializer()
           
 Iterator<T> iterator()
           
 void reOpen()
          Re-open stream for iterators.
 void setSerializer(ObjectSerializer<T> serializer)
           
 long size()
          Return size of this list.
 void switchState()
          Switch state from WRITE to READ
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

DiskList

public DiskList(String fileName)
Constructor with file name in current working dir.

方法详细信息

switchState

public void switchState()
Switch state from WRITE to READ

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

reOpen

public void reOpen()
Re-open stream for iterators.


append

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

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

close

public void close()
This method should be called at the end of DiskList usage to release file descriptors.


iterator

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

getSerializer

public ObjectSerializer<T> getSerializer()
返回:
the serializer

setSerializer

public void setSerializer(ObjectSerializer<T> serializer)
参数:
serializer - the serializer to set

size

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

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

clear

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

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


Copyright © 2015. All Rights Reserved.