Class ProdosFileEntry
- java.lang.Object
-
- com.webcodepro.applecommander.storage.os.prodos.ProdosCommonEntry
-
- com.webcodepro.applecommander.storage.os.prodos.ProdosFileEntry
-
- All Implemented Interfaces:
FileEntry
- Direct Known Subclasses:
ProdosDirectoryEntry
public class ProdosFileEntry extends ProdosCommonEntry implements FileEntry
Represents a ProDOS file entry on disk.Date created: Oct 5, 2002 6:01:15 PM
-
-
Field Summary
-
Fields inherited from class com.webcodepro.applecommander.storage.os.prodos.ProdosCommonEntry
ENTRY_LENGTH
-
-
Constructor Summary
Constructors Constructor Description ProdosFileEntry(ProdosFormatDisk disk, int block, int offset)
Constructor for ProdosFileEntry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canCompile()
Indicates that this filetype can be compiled.void
delete()
Delete the file.int
getAddress()
Get the address that this file loads at.int
getAuxiliaryType()
Get the auxiliary type for this file.int
getBlocksUsed()
Get the number of blocks used.int
getEofPosition()
Get the EOF position.java.util.List<java.lang.String>
getFileColumnData(int displayMode)
Get the standard file column header information.byte[]
getFileData()
Get file data.java.lang.String
getFilename()
Return the name of this file.java.lang.String
getFiletype()
Return the filetype of this file.int
getFiletypeByte()
java.lang.String
getFileTypeString()
Return the ProDOS file type as a hex string.int
getHeaderPointer()
Get the block number of the key block for the directory which describes this file.int
getKeyPointer()
Get the key pointer.java.util.Date
getLastModificationDate()
Get the last modification date.int
getMaximumFilenameLength()
Return the maximum filename length.int
getSize()
Compute the size of this file (in bytes).FileFilter
getSuggestedFilter()
Get the suggested FileFilter.boolean
isAppleWorksFile()
Indicate if this is an AppleWorks file.boolean
isDeleted()
Identify if this file has been deleted.boolean
isDirectory()
Identify if this is a directory file.boolean
isForkedFile()
Indicate if this is a GEOS file.boolean
isGEOSFile()
Indicate if this is a GEOS file.boolean
isLocked()
Identify if this file is locked.boolean
needsAddress()
Indicates if this filetype requires an address component.void
setAddress(int address)
Set the address that this file loads at.void
setAuxiliaryType(byte[] entry, byte low, byte high)
Set the auxiliary type for this file.void
setAuxiliaryType(byte[] entry, int auxiliaryType)
Set the auxiliary type for this file.void
setAuxiliaryType(int auxiliaryType)
Set the auxiliary type for this file.void
setBlocksUsed(int blocksUsed)
Set the number of blocks used.void
setEofPosition(int eofPosition)
Set the EOF position.void
setFileData(byte[] data)
Set the file data.void
setFileData(byte[] dataFork, byte[] resourceFork)
Set the file data, with the expectation that both data and resource forks are present (storage type $05).void
setFilename(java.lang.String filename)
Set the name of this file.void
setFiletype(long fileType)
Set the filetype based on a long - thunk into a bytevoid
setFiletype(java.lang.String filetype)
Set the filetype based on a string value.void
setGEOSMeta(byte[] metaData)
Copy GEOS-specific metadata to the directory entry verbatim: Bytes $00-$10 ($11 bytes) Bytes $18-$1d ($06 bytes) Bytes $21-$24 ($04 bytes)void
setHeaderPointer(int headerPointer)
Set the block number of the block for the directory which describes this file.void
setKeyPointer(int keyPointer)
Set the key pointer.void
setLastModificationDate(java.util.Date date)
Set the last modification date.void
setLocked(boolean lock)
Set the lock indicator.-
Methods inherited from class com.webcodepro.applecommander.storage.os.prodos.ProdosCommonEntry
canDestroy, canRead, canRename, canWrite, getAccess, getCreationDate, getDisk, getFileEntryBlock, getFormattedDisk, getMinimumProdosVersion, getProdosVersion, getStorageType, hasChanged, isEmpty, isSaplingFile, isSeedlingFile, isSubdirectory, isSubdirectoryHeader, isTreeFile, isVolumeHeader, readFileEntry, setAccess, setCanDestroy, setCanRead, setCanRename, setCanWrite, setCreationDate, setHasChanged, setMinimumProdosVersion, setProdosVersion, setSaplingFile, setSeedlingFile, setStorageType, setSubdirectory, setSubdirectoryHeader, setTreeFile, setVolumeHeader, writeFileEntry
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.webcodepro.applecommander.storage.FileEntry
getFormattedDisk
-
-
-
-
Constructor Detail
-
ProdosFileEntry
public ProdosFileEntry(ProdosFormatDisk disk, int block, int offset)
Constructor for ProdosFileEntry.
-
-
Method Detail
-
getFilename
public java.lang.String getFilename()
Return the name of this file. This handles normal files, deleted files, and AppleWorks files - which use the AUXTYPE attribute to indicate upper/lowercase in the filename.- Specified by:
getFilename
in interfaceFileEntry
-
getMaximumFilenameLength
public int getMaximumFilenameLength()
Return the maximum filename length.- Specified by:
getMaximumFilenameLength
in interfaceFileEntry
-
setFilename
public void setFilename(java.lang.String filename)
Set the name of this file.- Specified by:
setFilename
in interfaceFileEntry
-
setGEOSMeta
public void setGEOSMeta(byte[] metaData)
Copy GEOS-specific metadata to the directory entry verbatim: Bytes $00-$10 ($11 bytes) Bytes $18-$1d ($06 bytes) Bytes $21-$24 ($04 bytes)
-
getFiletype
public java.lang.String getFiletype()
Return the filetype of this file. This will be three characters, according to ProDOS - a "$xx" if unknown.- Specified by:
getFiletype
in interfaceFileEntry
-
getFiletypeByte
public int getFiletypeByte()
-
setFiletype
public void setFiletype(java.lang.String filetype)
Set the filetype based on a string value.- Specified by:
setFiletype
in interfaceFileEntry
-
setFiletype
public void setFiletype(long fileType)
Set the filetype based on a long - thunk into a byte
-
isAppleWorksFile
public boolean isAppleWorksFile()
Indicate if this is an AppleWorks file. Intended to force upper/lowercase into the filename.
-
isGEOSFile
public boolean isGEOSFile()
Indicate if this is a GEOS file.
-
isForkedFile
public boolean isForkedFile()
Indicate if this is a GEOS file.
-
getKeyPointer
public int getKeyPointer()
Get the key pointer. This is either the data block (seedling), index block (sapling), or master index block (tree).
-
setKeyPointer
public void setKeyPointer(int keyPointer)
Set the key pointer. This is either the data block (seedling), index block (sapling), or master index block (tree).
-
getBlocksUsed
public int getBlocksUsed()
Get the number of blocks used.
-
setBlocksUsed
public void setBlocksUsed(int blocksUsed)
Set the number of blocks used.
-
getEofPosition
public int getEofPosition()
Get the EOF position. This can indicate the length of a file.
-
setEofPosition
public void setEofPosition(int eofPosition)
Set the EOF position.
-
getAuxiliaryType
public int getAuxiliaryType()
Get the auxiliary type for this file. TXT - random access record length. BIN - load address for binary image. BAS - load address for program image. VAR - address of compressed variables image. SYS - load address for system program (usually 0x2000). AWP/ADB/ASP - upper/lowercase flags
-
setAuxiliaryType
public void setAuxiliaryType(int auxiliaryType)
Set the auxiliary type for this file.
-
setAuxiliaryType
public void setAuxiliaryType(byte[] entry, byte low, byte high)
Set the auxiliary type for this file.
-
setAuxiliaryType
public void setAuxiliaryType(byte[] entry, int auxiliaryType)
Set the auxiliary type for this file.
-
getLastModificationDate
public java.util.Date getLastModificationDate()
Get the last modification date.
-
setLastModificationDate
public void setLastModificationDate(java.util.Date date)
Set the last modification date.
-
getHeaderPointer
public int getHeaderPointer()
Get the block number of the key block for the directory which describes this file.
-
setHeaderPointer
public void setHeaderPointer(int headerPointer)
Set the block number of the block for the directory which describes this file.
-
isLocked
public boolean isLocked()
Identify if this file is locked.
-
setLocked
public void setLocked(boolean lock)
Set the lock indicator.
-
getSize
public int getSize()
Compute the size of this file (in bytes).
-
isDirectory
public boolean isDirectory()
Identify if this is a directory file.- Specified by:
isDirectory
in interfaceFileEntry
-
isDeleted
public boolean isDeleted()
Identify if this file has been deleted.
-
getFileColumnData
public java.util.List<java.lang.String> getFileColumnData(int displayMode)
Get the standard file column header information. This default implementation is intended only for standard mode. displayMode is specified in FormattedDisk.- Specified by:
getFileColumnData
in interfaceFileEntry
-
getFileTypeString
public java.lang.String getFileTypeString()
Return the ProDOS file type as a hex string.
-
getFileData
public byte[] getFileData()
Get file data. This handles any operating-system specific issues. Currently, the disk itself handles this.- Specified by:
getFileData
in interfaceFileEntry
-
setFileData
public void setFileData(byte[] data) throws DiskFullException
Set the file data. This is essentially the save operation. Specifically, if the filetype is binary, the length and address need to be set. If the filetype is applesoft or integer basic, the start address needs to be set.- Specified by:
setFileData
in interfaceFileEntry
- Throws:
DiskFullException
-
setFileData
public void setFileData(byte[] dataFork, byte[] resourceFork) throws DiskFullException
Set the file data, with the expectation that both data and resource forks are present (storage type $05). See: http://www.1000bit.it/support/manuali/apple/technotes/pdos/tn.pdos.25.html- Throws:
DiskFullException
-
getSuggestedFilter
public FileFilter getSuggestedFilter()
Get the suggested FileFilter. This appears to be operating system specific, so each operating system needs to implement some manner of guessing the appropriate filter.- Specified by:
getSuggestedFilter
in interfaceFileEntry
-
needsAddress
public boolean needsAddress()
Indicates if this filetype requires an address component. Note that the FormattedDisk also has this method - normally, this will defer to the method on FormattedDisk, as it will be more generic.- Specified by:
needsAddress
in interfaceFileEntry
-
setAddress
public void setAddress(int address)
Set the address that this file loads at.- Specified by:
setAddress
in interfaceFileEntry
-
getAddress
public int getAddress()
Get the address that this file loads at.- Specified by:
getAddress
in interfaceFileEntry
-
canCompile
public boolean canCompile()
Indicates that this filetype can be compiled.- Specified by:
canCompile
in interfaceFileEntry
-
-