Class StorageFile
- Object
-
- StorageFile
-
- All Implemented Interfaces:
Comparable<StorageFile>,FileReader,FileWriter
public final class StorageFile extends Object implements Comparable<StorageFile>, FileWriter
Encapsulates the idea of a file for writing data to and then later updating the original.- Author:
- jesse
-
-
Constructor Summary
Constructors Constructor Description StorageFile(ShpFiles shpFiles, File tempFile, ShpFileType type)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(StorageFile o)Just groups together files that have the same ShpFiles instanceFilegetFile()Returns the storage fileFileChannelgetWriteChannel()Stringid()An id for the writer.voidreplaceOriginal()Replaces the file that the temporary file is acting as a transactional type cache for.static voidreplaceOriginals(StorageFile... storageFiles)Takes a collection of StorageFiles and performs the replace functionality described inreplaceOriginal().StringtoString()
-
-
-
Constructor Detail
-
StorageFile
public StorageFile(ShpFiles shpFiles, File tempFile, ShpFileType type)
-
-
Method Detail
-
getFile
public File getFile()
Returns the storage file- Returns:
- the storage file
-
getWriteChannel
public FileChannel getWriteChannel() throws IOException
- Throws:
IOException
-
replaceOriginal
public void replaceOriginal() throws IOExceptionReplaces the file that the temporary file is acting as a transactional type cache for. Acts similar to a commit.- Throws:
IOException- See Also:
replaceOriginals(StorageFile...)
-
replaceOriginals
public static void replaceOriginals(StorageFile... storageFiles) throws IOException
Takes a collection of StorageFiles and performs the replace functionality described inreplaceOriginal(). However, all files that are part of the sameShpFilesare done within a lock so all of the updates for all the Files of a Shapefile can be updated within a single lock.- Parameters:
storageFiles- files to execute the replace functionality.- Throws:
IOException
-
compareTo
public int compareTo(StorageFile o)
Just groups together files that have the same ShpFiles instance- Specified by:
compareToin interfaceComparable<StorageFile>
-
id
public String id()
Description copied from interface:FileWriterAn id for the writer. This is only used for debugging.- Specified by:
idin interfaceFileReader- Specified by:
idin interfaceFileWriter- Returns:
- id for the writer.
-
-