| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes and flushes the file.
|
static FatFile |
create(com.github.mjdev.libaums.fs.fat32.FatLfnDirectoryEntry entry,
BlockDeviceDriver blockDevice,
FAT fat,
com.github.mjdev.libaums.fs.fat32.Fat32BootSector bootSector,
FatDirectory parent)
Creates a new file with the given information.
|
long |
createdAt()
Returns the time this directory or file was created.
|
UsbFile |
createDirectory(java.lang.String name)
This methods creates a new directory with the given name and returns it.
|
UsbFile |
createFile(java.lang.String name)
This methods creates a new file with the given name and returns it.
|
void |
delete()
Deletes this file or directory from the parent directory.
|
void |
flush()
Forces a write.
|
long |
getLength()
Returns the file length or throws an exception if called on a directory.
|
java.lang.String |
getName() |
UsbFile |
getParent()
Returns the parent directory for the file or directory or null if this is
the root directory.
|
boolean |
isDirectory() |
boolean |
isRoot() |
long |
lastAccessed()
Returns the time this directory or file was last accessed.
|
long |
lastModified()
Returns the time this directory or file was last modified.
|
java.lang.String[] |
list()
Lists all files in the directory.
|
UsbFile[] |
listFiles()
Lists all files in the directory.
|
void |
moveTo(UsbFile destination)
This methods moves THIS item to the destination directory.
|
void |
read(long offset,
java.nio.ByteBuffer destination)
Reads from a file or throws an exception if called on a directory.
|
UsbFile |
search(java.lang.String path)
Tries to search a corresponding entry associated with the path parameter.
|
void |
setLength(long newLength)
Sets the new file length.
|
void |
setName(java.lang.String newName)
Set a new name for this file or directory.
|
void |
write(long offset,
java.nio.ByteBuffer source)
Writes to a file or throws an exception if called on a directory.
|
public static FatFile create(com.github.mjdev.libaums.fs.fat32.FatLfnDirectoryEntry entry, BlockDeviceDriver blockDevice, FAT fat, com.github.mjdev.libaums.fs.fat32.Fat32BootSector bootSector, FatDirectory parent) throws java.io.IOException
entry - The corresponding entry in a FAT directory.blockDevice - The device where the file system is located.fat - The FAT used to follow cluster chains.bootSector - The boot sector of the file system.parent - The parent directory of the newly created file.java.io.IOException - If reading from device fails.public UsbFile search(java.lang.String path)
UsbFilepublic boolean isDirectory()
isDirectory in interface UsbFilepublic java.lang.String getName()
public void setName(java.lang.String newName)
throws java.io.IOException
UsbFilepublic long createdAt()
UsbFilepublic long lastModified()
UsbFilelastModified in interface UsbFilepublic long lastAccessed()
UsbFilelastAccessed in interface UsbFilepublic UsbFile getParent()
UsbFilepublic java.lang.String[] list()
UsbFilepublic UsbFile[] listFiles() throws java.io.IOException
UsbFilepublic long getLength()
UsbFilepublic void setLength(long newLength)
throws java.io.IOException
UsbFileIf the space is not allocated before writing the space must be exceeded every time a new write occurs. This can sometimes be less efficient.
public void read(long offset,
java.nio.ByteBuffer destination)
throws java.io.IOException
UsbFilepublic void write(long offset,
java.nio.ByteBuffer source)
throws java.io.IOException
UsbFilepublic void flush()
throws java.io.IOException
UsbFilepublic void close()
throws java.io.IOException
UsbFilepublic UsbFile createDirectory(java.lang.String name) throws java.io.IOException
UsbFilecreateDirectory in interface UsbFilename - The name of the new directory.java.io.IOException - If writing to the disk fails or a item with the same name
already exists.public UsbFile createFile(java.lang.String name) throws java.io.IOException
UsbFilecreateFile in interface UsbFilename - The name of the new file.java.io.IOException - If writing to the disk fails or a item with the same name
already exists.public void moveTo(UsbFile destination) throws java.io.IOException
UsbFilepublic void delete()
throws java.io.IOException
UsbFile