public abstract class AbstractEntityFile<T> extends Object implements EntityFile<T>
| Modifier and Type | Field and Description |
|---|---|
protected int |
batchLength |
protected File |
file |
protected FileAccess |
fileAccess |
protected int |
firstRecord |
protected ReadWriteLock |
lock |
protected long |
offset |
protected int |
recordLength |
| Constructor and Description |
|---|
AbstractEntityFile(File file) |
| Modifier and Type | Method and Description |
|---|---|
void |
batchWrite(List<T> entities) |
void |
close() |
void |
createNewFile() |
void |
delete() |
boolean |
exists() |
void |
flush() |
File |
getAbsoluteFile() |
String |
getAbsolutePath() |
int |
getBatchLength() |
ReadWriteLock |
getLock() |
String |
getName() |
long |
getOffset() |
long |
length() |
void |
open() |
T |
read() |
protected abstract T |
read(DataInputStream stream) |
protected void |
readHeader() |
protected abstract void |
readMetaData(DataInputStream srteam) |
void |
seek(long value) |
void |
setBatchLength(int value) |
void |
setLength(long value) |
protected abstract void |
write(DataOutputStream stream,
T entity) |
void |
write(T entity) |
protected abstract void |
writeEOF(DataOutputStream stream) |
protected void |
writeHeader() |
protected abstract void |
writeMetaData(DataOutputStream stream) |
protected int recordLength
protected int firstRecord
protected long offset
protected File file
protected FileAccess fileAccess
protected ReadWriteLock lock
protected int batchLength
public AbstractEntityFile(File file)
public long getOffset()
throws IOException
getOffset in interface EntityFile<T>IOExceptionpublic String getName()
getName in interface EntityFile<T>public void setBatchLength(int value)
setBatchLength in interface EntityFile<T>public int getBatchLength()
getBatchLength in interface EntityFile<T>public File getAbsoluteFile()
getAbsoluteFile in interface EntityFile<T>public String getAbsolutePath()
getAbsolutePath in interface EntityFile<T>public void createNewFile()
throws IOException
createNewFile in interface EntityFile<T>IOExceptionprotected void writeHeader()
throws IOException
IOExceptionprotected abstract void writeMetaData(DataOutputStream stream) throws IOException
IOExceptionpublic void open()
throws IOException
open in interface EntityFile<T>IOExceptionprotected void readHeader()
throws IOException
IOExceptionprotected abstract void readMetaData(DataInputStream srteam) throws IOException
IOExceptionpublic void seek(long value)
throws IOException
seek in interface EntityFile<T>IOExceptionpublic void batchWrite(List<T> entities) throws IOException
batchWrite in interface EntityFile<T>IOExceptionpublic void write(T entity) throws IOException
write in interface EntityFile<T>IOExceptionprotected abstract void writeEOF(DataOutputStream stream) throws IOException
IOExceptionprotected abstract void write(DataOutputStream stream, T entity) throws IOException
IOExceptionpublic T read() throws IOException
read in interface EntityFile<T>IOExceptionprotected abstract T read(DataInputStream stream) throws IOException
IOExceptionpublic long length()
throws IOException
length in interface EntityFile<T>IOExceptionpublic void setLength(long value)
throws IOException
setLength in interface EntityFile<T>IOExceptionpublic void flush()
throws IOException
IOExceptionpublic void close()
throws IOException
close in interface EntityFile<T>IOExceptionpublic void delete()
throws IOException
IOExceptionpublic boolean exists()
exists in interface EntityFile<T>public ReadWriteLock getLock()
getLock in interface EntityFile<T>Copyright © 2016. All rights reserved.