Package ghidra.framework.store.local
Class LocalDataFile
java.lang.Object
ghidra.framework.store.local.LocalFolderItem
ghidra.framework.store.local.LocalDataFile
- All Implemented Interfaces:
DataFileItem
,FolderItem
LocalDataFile
provides a FolderItem implementation
for a local serialized data file. This implementation supports
a non-versioned file-system only.
This item utilizes a data directory for storing the serialized data file.
-
Field Summary
Fields inherited from interface ghidra.framework.store.FolderItem
DATABASE_FILE_TYPE, DATAFILE_FILE_TYPE, DEFAULT_CHECKOUT_ID, LATEST_VERSION, UNKNOWN_FILE_TYPE
-
Constructor Summary
ConstructorDescriptionLocalDataFile
(LocalFileSystem fileSystem, PropertyFile propertyFile) LocalDataFile
(LocalFileSystem fileSystem, PropertyFile propertyFile, InputStream istream, String contentType, TaskMonitor monitor) Create a new local data file item. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if unsaved file changes can be recovered.int
Return the latest/current version.Open the current version of this item for reading.getInputStream
(int version) Open a specific version of this item for reading.Open a new version of this item for writing.long
length()
Returns the length of this domain file.void
output
(File outputFile, int version, TaskMonitor monitor) Serialize (i.e., pack) this item into the specified outputFile.void
updateCheckout
(FolderItem versionedFolderItem, boolean updateItem, TaskMonitor monitor) Update this non-versioned item with the latest version of the specified versioned item.void
updateCheckout
(FolderItem item, int checkoutVersion) Update this non-versioned item with the contents of the specified item which must be within the same non-versioned fileSystem.Methods inherited from class ghidra.framework.store.local.LocalFolderItem
checkout, clearCheckout, delete, equals, getCheckout, getCheckoutId, getCheckouts, getCheckoutVersion, getContentType, getContentTypeVersion, getFileID, getLocalCheckoutVersion, getName, getParentPath, getPathName, getVersions, hasCheckouts, isCheckedOut, isCheckedOutExclusive, isCheckinActive, isReadOnly, isVersioned, lastModified, refresh, resetFileID, setCheckout, setContentTypeVersion, setReadOnly, terminateCheckout, updateCheckoutVersion
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ghidra.framework.store.FolderItem
checkout, clearCheckout, delete, getCheckout, getCheckoutId, getCheckouts, getCheckoutVersion, getContentType, getContentTypeVersion, getFileID, getLocalCheckoutVersion, getName, getParentPath, getPathName, getVersions, hasCheckouts, isCheckedOut, isCheckedOutExclusive, isCheckinActive, isReadOnly, isVersioned, lastModified, refresh, resetFileID, setCheckout, setContentTypeVersion, setReadOnly, terminateCheckout, updateCheckoutVersion
-
Constructor Details
-
LocalDataFile
- Throws:
IOException
-
LocalDataFile
public LocalDataFile(LocalFileSystem fileSystem, PropertyFile propertyFile, InputStream istream, String contentType, TaskMonitor monitor) throws IOException, CancelledException Create a new local data file item.- Parameters:
fileSystem
- file systempropertyFile
- serialized data property fileistream
- data source input stream (should be a start of data and will be read to end of file). The invoker of this constructor is responsible for closing istream.contentType
- user content typemonitor
- progress monitor (used for cancel support, progress not used since length of input stream is unknown)- Throws:
IOException
- if an IO Error occursCancelledException
- if monitor cancels operation
-
-
Method Details
-
length
Description copied from interface:FolderItem
Returns the length of this domain file. This size is the minimum disk space used for storing this file, but does not account for additional storage space used to tracks changes, etc.- Specified by:
length
in interfaceFolderItem
- Returns:
- file length
- Throws:
IOException
- thrown if IO or access error occurs
-
getInputStream
Description copied from interface:DataFileItem
Open the current version of this item for reading.- Specified by:
getInputStream
in interfaceDataFileItem
- Returns:
- input stream
- Throws:
FileNotFoundException
-
getInputStream
Description copied from interface:DataFileItem
Open a specific version of this item for reading.- Specified by:
getInputStream
in interfaceDataFileItem
- Returns:
- input stream
- Throws:
FileNotFoundException
-
getOutputStream
Description copied from interface:DataFileItem
Open a new version of this item for writing.- Specified by:
getOutputStream
in interfaceDataFileItem
- Returns:
- output stream.
- Throws:
FileNotFoundException
-
updateCheckout
public void updateCheckout(FolderItem versionedFolderItem, boolean updateItem, TaskMonitor monitor) throws IOException Description copied from class:LocalFolderItem
Update this non-versioned item with the latest version of the specified versioned item.- Specified by:
updateCheckout
in classLocalFolderItem
- Parameters:
versionedFolderItem
- versioned item which corresponds to this non-versioned item.updateItem
- if true this items content is updated using the versionedFolderItemmonitor
- progress monitor for update- Throws:
IOException
- if this file is not a checked-out non-versioned file or an IO error occurs.
-
updateCheckout
Description copied from class:LocalFolderItem
Update this non-versioned item with the contents of the specified item which must be within the same non-versioned fileSystem. If successful, the specified item will be removed after its content has been moved into this item.- Specified by:
updateCheckout
in classLocalFolderItem
- Parameters:
item
-checkoutVersion
-- Throws:
IOException
- if this file is not a checked-out non-versioned file or an IO error occurs.
-
output
Description copied from interface:FolderItem
Serialize (i.e., pack) this item into the specified outputFile.- Specified by:
output
in interfaceFolderItem
- Parameters:
outputFile
- packed output file to be createdversion
- if this item is versioned, specifies the version to be output, otherwise -1 should be specified.monitor
- progress monitor- Throws:
IOException
-
getCurrentVersion
public int getCurrentVersion()Description copied from interface:FolderItem
Return the latest/current version.- Specified by:
getCurrentVersion
in interfaceFolderItem
-
canRecover
public boolean canRecover()Description copied from interface:FolderItem
Returns true if unsaved file changes can be recovered.- Specified by:
canRecover
in interfaceFolderItem
-