Package thredds.filesystem
Class MFileOS7
- java.lang.Object
-
- thredds.filesystem.MFileOS7
-
- All Implemented Interfaces:
Comparable<MFile>
,MFile
@ThreadSafe public class MFileOS7 extends Object implements MFile
Use Java 7 nio Paths- Since:
- 11/16/13
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(MFile o)
boolean
exists()
Check if the MFile existsObject
getAuxInfo()
MFileOS7
getChild(String newFilename)
Get child MFile of this MFilestatic MFileOS7
getExistingFile(String filename)
Make MFileOS7 if file exists, otherwise return nullFileInputStream
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.Path
getNioPath()
MFile
getParent()
Get the parent of thisString
getPath()
Get full path name, replace \\ with /boolean
isDirectory()
boolean
isReadable()
void
setAuxInfo(Object auxInfo)
String
toString()
void
writeToStream(OutputStream outputStream)
Write the MFile to an OutputStreamvoid
writeToStream(OutputStream outputStream, long offset, long maxBytes)
Write the MFile to an OutputStream
-
-
-
Constructor Detail
-
MFileOS7
public MFileOS7(Path path) throws IOException
- Throws:
IOException
-
MFileOS7
public MFileOS7(Path path, BasicFileAttributes attr)
-
MFileOS7
public MFileOS7(String filename) throws IOException
- Throws:
IOException
-
-
Method Detail
-
getExistingFile
public static MFileOS7 getExistingFile(String filename) throws IOException
Make MFileOS7 if file exists, otherwise return null- Parameters:
filename
- full path name- Returns:
- MFileOS or null
- Throws:
IOException
-
getLastModified
public long getLastModified()
Description copied from interface:MFile
Get time of last modification at the time the MFile object was created- Specified by:
getLastModified
in interfaceMFile
- Returns:
- time of last modification in Unix time (msecs since reference), or -1 if unknown
-
getLength
public long getLength()
Description copied from interface:MFile
Size of file in bytes
-
isDirectory
public boolean isDirectory()
- Specified by:
isDirectory
in interfaceMFile
-
isReadable
public boolean isReadable()
- Specified by:
isReadable
in interfaceMFile
-
getPath
public String getPath()
Description copied from interface:MFile
Get full path name, replace \\ with /
-
getName
public String getName()
Description copied from interface:MFile
The name is the farthest element from the root in the directory hierarchy.
-
getParent
public MFile getParent() throws IOException
Description copied from interface:MFile
Get the parent of this- Specified by:
getParent
in interfaceMFile
- Returns:
- the parent or null
- Throws:
IOException
-
compareTo
public int compareTo(MFile o)
- Specified by:
compareTo
in interfaceComparable<MFile>
- Specified by:
compareTo
in interfaceMFile
-
getAuxInfo
public Object getAuxInfo()
- Specified by:
getAuxInfo
in interfaceMFile
-
setAuxInfo
public void setAuxInfo(Object auxInfo)
- Specified by:
setAuxInfo
in interfaceMFile
-
exists
public boolean exists()
Description copied from interface:MFile
Check if the MFile exists
-
getInputStream
public FileInputStream getInputStream() throws FileNotFoundException
Description copied from interface:MFile
Get the MFile InputStream- Specified by:
getInputStream
in interfaceMFile
- Returns:
- the MFile InputStream
- Throws:
FileNotFoundException
-
writeToStream
public void writeToStream(OutputStream outputStream) throws IOException
Description copied from interface:MFile
Write the MFile to an OutputStream- Specified by:
writeToStream
in interfaceMFile
- Parameters:
outputStream
- the OutputStream the MFile contents should be written to- Throws:
IOException
-
writeToStream
public void writeToStream(OutputStream outputStream, long offset, long maxBytes) throws IOException
Description copied from interface:MFile
Write the MFile to an OutputStream- Specified by:
writeToStream
in interfaceMFile
- 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
-
getChild
public MFileOS7 getChild(String newFilename)
Description copied from interface:MFile
Get child MFile of this MFile
-
getNioPath
public Path getNioPath()
-
-