@NotStorableClass public class FileForStorable extends Object implements IFileForStorable
| Modifier and Type | Field and Description |
|---|---|
protected static String |
FAILED_DELETE_FILE |
protected static String |
FILE_ALREADY_CLOSED |
protected static String |
FILE_NOT_OPENNED |
protected JoafipLogger |
logger |
protected IRandomAccessFile |
randomAccessFile
for random read write file access
|
| Constructor and Description |
|---|
FileForStorable(FileAccessParameter fileAccessParameter)
create a file to read from and write to
IFileStorable object |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
close heap file access operation
|
protected HeapException |
closeAfterIOException(String message,
FileIOException exception)
close after io exception
|
void |
copy(FileForStorable fileForStorable)
copy this file to an other file
|
void |
copy(String fileName)
copy this file to an other file
|
void |
deleteFileIfExists()
delete file if exists
|
void |
deleteFileIfExistsRenaming()
delete file if exists
|
void |
flush()
flush modification to disk
|
int |
getCachePageSize() |
File |
getFile() |
long |
getFileSize()
Returns the size of this file.
|
boolean |
isOpened() |
boolean |
isUseCache() |
void |
open()
open heap file for access operation
|
int |
read(byte[] data)
delegate to
RandomAccessFile.read(byte[]) closing the file in
case of I/O errorReads up to data.length bytes of data from this file into an
array of bytes. |
int |
read(byte[] data,
int offset,
int length) |
void |
resetFileSize() |
void |
seek(long positionInFile)
delegate to
RandomAccessFile.seek(long) closing the file in case
of I/O error |
void |
setFileSize(long newSize)
set the size of this file
|
String |
toString() |
void |
write(byte[] data)
delegate to
RandomAccessFile#write(byte[])) closing the file in
case of I/O error |
void |
write(byte[] data,
int offset,
int length) |
void |
write(ToBackupRecord toBackupRecord) |
protected final JoafipLogger logger
protected static final String FILE_ALREADY_CLOSED
protected static final String FILE_NOT_OPENNED
protected static final String FAILED_DELETE_FILE
protected IRandomAccessFile randomAccessFile
public FileForStorable(FileAccessParameter fileAccessParameter) throws HeapException
IFileStorable objectfileAccessParameter - HeapExceptionpublic boolean isUseCache()
isUseCache in interface IFileForStorablepublic int getCachePageSize()
getCachePageSize in interface IFileForStorablepublic void open()
throws HeapException
IFileForStorableopen in interface IFileForStorableHeapException - if an I/O error occurs while opening filepublic void close()
throws HeapException
IFileForStorableclose in interface IFileForStorableHeapException - if an I/O error occurs while closing the the filepublic void flush()
throws HeapException
IFileForStorableflush in interface IFileForStorableHeapExceptionpublic void resetFileSize()
throws HeapException
resetFileSize in interface IFileForStorableHeapExceptionpublic void deleteFileIfExists()
throws HeapException
IFileForStorabledeleteFileIfExists in interface IFileForStorableHeapExceptionpublic void deleteFileIfExistsRenaming()
throws HeapException
IFileForStorabledeleteFileIfExistsRenaming in interface IFileForStorableHeapExceptionpublic boolean isOpened()
public void seek(long positionInFile)
throws HeapException
IFileForStorableRandomAccessFile.seek(long) closing the file in case
of I/O errorseek in interface IFileForStorableHeapException - if an I/O error occurspublic int read(byte[] data)
throws HeapException
IFileForStorableRandomAccessFile.read(byte[]) closing the file in
case of I/O errordata.length bytes of data from this file into an
array of bytes.read in interface IFileForStorabledata - where store data readHeapException - if an I/O error occurspublic int read(byte[] data,
int offset,
int length)
throws HeapException
read in interface IFileForStorableHeapExceptionpublic void write(byte[] data)
throws HeapException
IFileForStorableRandomAccessFile#write(byte[])) closing the file in
case of I/O errorwrite in interface IFileForStorableHeapException - if an I/O error occurspublic void write(byte[] data,
int offset,
int length)
throws HeapException
write in interface IFileForStorableHeapExceptionpublic void write(ToBackupRecord toBackupRecord) throws HeapException
write in interface IFileForStorableHeapExceptionpublic File getFile()
getFile in interface IFileForStorablepublic long getFileSize()
throws HeapException
IFileForStorablegetFileSize in interface IFileForStorableHeapException - if an I/O error occurs.public void setFileSize(long newSize)
throws HeapException
newSize - the file new sizeHeapException - if an I/O error occurs.public void copy(FileForStorable fileForStorable) throws HeapException
IFileForStorablecopy in interface IFileForStorableHeapExceptionpublic void copy(String fileName) throws FileIOException
IFileForStorablecopy in interface IFileForStorableFileIOExceptionprotected HeapException closeAfterIOException(String message, FileIOException exception) throws HeapException
HeapExceptionCopyright © 2007-2012 Luc Peuvrier. All Rights Reserved.