Interface MetaFile
public interface MetaFile
Provides an abstraction for a file of a
MetaDirectory.-
Method Summary
Modifier and TypeMethodDescriptionvoidcloseTempFile(boolean discard) Close the previously opened temporary file. ifdiscardisfalse, the contents of the temporary file are copied back to this file.voidCopies the contents of this file to the indicated platform file.voiddelete()Deletes the file from it's meta directoryReturns the meta directory that created this file.Open an input stream to this file.getName()Returns the name of this file.getPath()Returns a path of this file which is composed of the path of the meta directory and the name of this file.Opens a reader using the utf-8 encodinglongReturns the last modified date of this file.longlength()Returns the length in bytes of this filemd5()Returns the MD5 checksum of this file.voidMoves this file to another meta file of the same directoryOpens a temporary file that is tied to this file and initializes it with the same content as this file.
-
Method Details
-
getDirectory
MetaDirectory getDirectory()Returns the meta directory that created this file.- Returns:
- the meta directory.
-
getPath
String getPath()Returns a path of this file which is composed of the path of the meta directory and the name of this file.- Returns:
- the path
-
getName
String getName()Returns the name of this file.- Returns:
- the name of this file.
-
getInputStream
Open an input stream to this file.- Returns:
- an input stream
- Throws:
IOException- if an I/O error occurs
-
getReader
Opens a reader using the utf-8 encoding- Returns:
- a read
- Throws:
IOException- if an I/O error occurs
-
length
long length()Returns the length in bytes of this file- Returns:
- the length.
-
md5
Returns the MD5 checksum of this file. Note that this operation reads the file fully in order to calculate the checksum.- Returns:
- the MD5 checksum.
- Throws:
IOException- if an I/O error occurs
-
lastModified
long lastModified()Returns the last modified date of this file.- Returns:
- the last modified
-
delete
Deletes the file from it's meta directory- Throws:
IOException- if an I/O error occurs
-
openTempFile
Opens a temporary file that is tied to this file and initializes it with the same content as this file.- Returns:
- a temporary file.
- Throws:
IOException- if an I/O error occurs
-
closeTempFile
Close the previously opened temporary file. ifdiscardisfalse, the contents of the temporary file are copied back to this file.- Parameters:
discard-trueto discard the changes to the temp file- Throws:
IOException- if an I/O error occurs
-
moveTo
Moves this file to another meta file of the same directory- Parameters:
dst- destination file- Throws:
IOException- if an I/O error occurs
-
copyTo
Copies the contents of this file to the indicated platform file.- Parameters:
file- destination filepreserveFileDate-trueto update the modification date of the destination file- Throws:
IOException- if an I/O error occurs
-