Package thredds.inventory
Interface MFile
-
- All Superinterfaces:
Comparable<MFile>
public interface MFile extends Comparable<MFile>
An abstraction for java.io.File / java.nio.file.Path- Since:
- Jun 30, 2009
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description int
compareTo(MFile o)
boolean
exists()
Check if the MFile existsObject
getAuxInfo()
MFile
getChild(String newFileName)
Get child MFile of this MFileInputStream
getInputStream()
Get the MFile InputStreamlong
getLastModified()
Get time of last modification at the time the MFile object was createdlong
getLength()
Size of file in bytesString
getName()
The name is the farthest element from the root in the directory hierarchy.MFile
getParent()
Get the parent of thisString
getPath()
Get full path name, replace \\ with /boolean
isDirectory()
default boolean
isReadable()
default boolean
isZipFile()
Check if this MFile is a zip filevoid
setAuxInfo(Object info)
void
writeToStream(OutputStream outputStream)
Write the MFile to an OutputStreamvoid
writeToStream(OutputStream outputStream, long offset, long maxBytes)
Write the MFile to an OutputStream
-
-
-
Method Detail
-
getLastModified
long getLastModified()
Get time of last modification at the time the MFile object was created- Returns:
- time of last modification in Unix time (msecs since reference), or -1 if unknown
-
getLength
long getLength()
Size of file in bytes- Returns:
- Size of file in bytes or -1 if unknown
-
isDirectory
boolean isDirectory()
-
isZipFile
default boolean isZipFile()
Check if this MFile is a zip file- Returns:
- true if the MFile is a zip file
-
isReadable
default boolean isReadable()
-
getPath
String getPath()
Get full path name, replace \\ with /- Returns:
- full path name
-
getName
String getName()
The name is the farthest element from the root in the directory hierarchy.- Returns:
- the file name
-
getParent
MFile getParent() throws IOException
Get the parent of this- Returns:
- the parent or null
- Throws:
IOException
-
compareTo
int compareTo(MFile o)
- Specified by:
compareTo
in interfaceComparable<MFile>
-
getAuxInfo
Object getAuxInfo()
-
setAuxInfo
void setAuxInfo(Object info)
-
exists
boolean exists()
Check if the MFile exists- Returns:
- true if the MFile exists, else false
-
getInputStream
InputStream getInputStream() throws FileNotFoundException
Get the MFile InputStream- Returns:
- the MFile InputStream
- Throws:
FileNotFoundException
-
writeToStream
void writeToStream(OutputStream outputStream) throws IOException
Write the MFile to an OutputStream- Parameters:
outputStream
- the OutputStream the MFile contents should be written to- Throws:
IOException
-
writeToStream
void writeToStream(OutputStream outputStream, long offset, long maxBytes) throws IOException
Write the MFile to an OutputStream- Parameters:
outputStream
- the OutputStream the MFile contents should be written tooffset
- the index of the first byte to write outmaxBytes
- the maximum number of bytes to copy- Throws:
IOException
-
-