Module com.aoapps.hodgepodge
Package com.aoapps.hodgepodge.io
Class FileList<T extends FileListObject>
java.lang.Object
java.util.AbstractCollection<T>
java.util.AbstractList<T>
com.aoapps.hodgepodge.io.FileList<T>
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Iterable<T>
,Collection<T>
,List<T>
,RandomAccess
public class FileList<T extends FileListObject>
extends AbstractList<T>
implements RandomAccess, Closeable
A
FileList
is a List that stores its objects in
a fixed-record-size file.- Author:
- AO Industries, Inc.
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorDescriptionFileList
(String filenamePrefix, String filenameExtension, int objectLength, FileListObjectFactory<T> objectFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
addAll
(int index, Collection<? extends T> collection) boolean
addAll
(Collection<? extends T> collection) void
clear()
void
close()
get
(int index) int
static File
getTempFile
(String prefix, String extension) Deprecated.remove
(int index) int
size()
void
swap
(int index1, int index2) Methods inherited from class java.util.AbstractList
add, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
Constructor Details
-
FileList
public FileList(String filenamePrefix, String filenameExtension, int objectLength, FileListObjectFactory<T> objectFactory) throws IOException - Throws:
IOException
-
-
Method Details
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<T extends FileListObject>
- Specified by:
clear
in interfaceList<T extends FileListObject>
- Overrides:
clear
in classAbstractList<T extends FileListObject>
-
get
- Specified by:
get
in interfaceList<T extends FileListObject>
- Specified by:
get
in classAbstractList<T extends FileListObject>
-
swap
public void swap(int index1, int index2) -
size
public int size()- Specified by:
size
in interfaceCollection<T extends FileListObject>
- Specified by:
size
in interfaceList<T extends FileListObject>
- Specified by:
size
in classAbstractCollection<T extends FileListObject>
-
getRecordLength
public int getRecordLength() -
set
- Specified by:
set
in interfaceList<T extends FileListObject>
- Overrides:
set
in classAbstractList<T extends FileListObject>
-
add
- Specified by:
add
in interfaceList<T extends FileListObject>
- Overrides:
add
in classAbstractList<T extends FileListObject>
-
addAll
- Specified by:
addAll
in interfaceCollection<T extends FileListObject>
- Specified by:
addAll
in interfaceList<T extends FileListObject>
- Overrides:
addAll
in classAbstractCollection<T extends FileListObject>
-
addAll
- Specified by:
addAll
in interfaceList<T extends FileListObject>
- Overrides:
addAll
in classAbstractList<T extends FileListObject>
-
remove
- Specified by:
remove
in interfaceList<T extends FileListObject>
- Overrides:
remove
in classAbstractList<T extends FileListObject>
-
getFilenamePrefix
-
getFilenameExtension
-
getObjectFactory
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
getTempFile
Deprecated.Please useTempFileContext
asFile.deleteOnExit()
is prone to memory leaks in long-running applications.- Throws:
IOException
-
TempFileContext
asFile.deleteOnExit()
is prone to memory leaks in long-running applications.