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
 
 public class LocalDataFile extends LocalFolderItem implements DataFileItem LocalDataFileprovides 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.FolderItemDATABASE_FILE_TYPE, DATAFILE_FILE_TYPE, DEFAULT_CHECKOUT_ID, LATEST_VERSION, UNKNOWN_FILE_TYPE
 
- 
 - 
Constructor SummaryConstructors Constructor Description LocalDataFile(LocalFileSystem fileSystem, PropertyFile propertyFile)LocalDataFile(LocalFileSystem fileSystem, PropertyFile propertyFile, java.io.InputStream istream, java.lang.String contentType, TaskMonitor monitor)Create a new local data file item.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanRecover()Returns true if unsaved file changes can be recovered.intgetCurrentVersion()Return the latest/current version.java.io.InputStreamgetInputStream()Open the current version of this item for reading.java.io.InputStreamgetInputStream(int version)Open a specific version of this item for reading.java.io.OutputStreamgetOutputStream()Open a new version of this item for writing.longlength()Returns the length of this domain file.voidoutput(java.io.File outputFile, int version, TaskMonitor monitor)Serialize (i.e., pack) this item into the specified outputFile.voidupdateCheckout(FolderItem versionedFolderItem, boolean updateItem, TaskMonitor monitor)Update this non-versioned item with the latest version of the specified versioned item.voidupdateCheckout(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.LocalFolderItemcheckout, 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.Objectclone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface ghidra.framework.store.FolderItemcheckout, 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 Detail- 
LocalDataFilepublic LocalDataFile(LocalFileSystem fileSystem, PropertyFile propertyFile) throws java.io.IOException - Throws:
- java.io.IOException
 
 - 
LocalDataFilepublic LocalDataFile(LocalFileSystem fileSystem, PropertyFile propertyFile, java.io.InputStream istream, java.lang.String contentType, TaskMonitor monitor) throws java.io.IOException, CancelledException Create a new local data file item.- Parameters:
- fileSystem- file system
- propertyFile- serialized data property file
- istream- 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 type
- monitor- progress monitor (used for cancel support, progress not used since length of input stream is unknown)
- Throws:
- java.io.IOException- if an IO Error occurs
- CancelledException- if monitor cancels operation
 
 
- 
 - 
Method Detail- 
lengthpublic long length() throws java.io.IOExceptionDescription copied from interface:FolderItemReturns 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:
- lengthin interface- FolderItem
- Returns:
- file length
- Throws:
- java.io.IOException- thrown if IO or access error occurs
 
 - 
getInputStreampublic java.io.InputStream getInputStream() throws java.io.FileNotFoundExceptionDescription copied from interface:DataFileItemOpen the current version of this item for reading.- Specified by:
- getInputStreamin interface- DataFileItem
- Returns:
- input stream
- Throws:
- java.io.FileNotFoundException
 
 - 
getInputStreampublic java.io.InputStream getInputStream(int version) throws java.io.FileNotFoundExceptionDescription copied from interface:DataFileItemOpen a specific version of this item for reading.- Specified by:
- getInputStreamin interface- DataFileItem
- Returns:
- input stream
- Throws:
- java.io.FileNotFoundException
 
 - 
getOutputStreampublic java.io.OutputStream getOutputStream() throws java.io.FileNotFoundExceptionDescription copied from interface:DataFileItemOpen a new version of this item for writing.- Specified by:
- getOutputStreamin interface- DataFileItem
- Returns:
- output stream.
- Throws:
- java.io.FileNotFoundException
 
 - 
updateCheckoutpublic void updateCheckout(FolderItem versionedFolderItem, boolean updateItem, TaskMonitor monitor) throws java.io.IOException Description copied from class:LocalFolderItemUpdate this non-versioned item with the latest version of the specified versioned item.- Specified by:
- updateCheckoutin class- LocalFolderItem
- Parameters:
- versionedFolderItem- versioned item which corresponds to this non-versioned item.
- updateItem- if true this items content is updated using the versionedFolderItem
- monitor- progress monitor for update
- Throws:
- java.io.IOException- if this file is not a checked-out non-versioned file or an IO error occurs.
 
 - 
updateCheckoutpublic void updateCheckout(FolderItem item, int checkoutVersion) throws java.io.IOException Description copied from class:LocalFolderItemUpdate 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:
- updateCheckoutin class- LocalFolderItem
- Throws:
- java.io.IOException- if this file is not a checked-out non-versioned file or an IO error occurs.
 
 - 
outputpublic void output(java.io.File outputFile, int version, TaskMonitor monitor) throws java.io.IOExceptionDescription copied from interface:FolderItemSerialize (i.e., pack) this item into the specified outputFile.- Specified by:
- outputin interface- FolderItem
- Parameters:
- outputFile- packed output file to be created
- version- if this item is versioned, specifies the version to be output, otherwise -1 should be specified.
- monitor- progress monitor
- Throws:
- java.io.IOException
 
 - 
getCurrentVersionpublic int getCurrentVersion() Description copied from interface:FolderItemReturn the latest/current version.- Specified by:
- getCurrentVersionin interface- FolderItem
 
 - 
canRecoverpublic boolean canRecover() Description copied from interface:FolderItemReturns true if unsaved file changes can be recovered.- Specified by:
- canRecoverin interface- FolderItem
 
 
- 
 
-