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

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

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

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

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

嵌套类摘要
 
从接口 ml.shifu.guagua.util.AppendList 继承的嵌套类/接口
AppendList.State
 
构造方法摘要
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.
 
方法摘要
 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)
           
 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
 

构造方法详细信息

BytableDiskList

public BytableDiskList(String fileName,
                       String className)
Constructor with file name in current working dir and instance class name.


BytableDiskList

public BytableDiskList(String fileName,
                       String className,
                       BytableSerializer<T> serializer)
Constructor with file name in current working dir, class name and serializer instance.

方法详细信息

switchState

public void switchState()
Switch state from WRITE to READ

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

close

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


iterator

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

getSerializer

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

setSerializer

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

size

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

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

clear

public void clear()
Delete file to store elements. After this method call, user cannot use such list. But clear here is used to clear resources used.

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


Copyright © 2015. All Rights Reserved.