Package thredds.inventory.zarr
Class MFileZip
- java.lang.Object
-
- thredds.inventory.zarr.MFileZip
-
- All Implemented Interfaces:
Comparable<MFile>
,MFile
public class MFileZip extends Object implements MFile
Implements thredds.inventory.MFile for ZipFiles and ZipEntries
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MFileZip.Provider
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(MFile o)
boolean
exists()
Check if the MFile existsObject
getAuxInfo()
MFileZip
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 createdList<ZipEntry>
getLeafEntries()
long
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 /Path
getRelativePath()
Path
getRootPath()
boolean
isDirectory()
boolean
isReadable()
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
-
-
-
Constructor Detail
-
MFileZip
public MFileZip(ZipFile file) throws IOException
- Throws:
IOException
-
MFileZip
public MFileZip(String filename) throws IOException
- Throws:
IOException
-
-
Method Detail
-
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
-
isZipFile
public boolean isZipFile()
Description copied from interface:MFile
Check if this MFile is a zip file
-
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.
-
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 info)
- Specified by:
setAuxInfo
in interfaceMFile
-
exists
public boolean exists()
Description copied from interface:MFile
Check if the MFile exists
-
getInputStream
public InputStream getInputStream()
Description copied from interface:MFile
Get the MFile InputStream- Specified by:
getInputStream
in interfaceMFile
- Returns:
- the MFile InputStream
-
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 MFileZip getChild(String newFilename)
Description copied from interface:MFile
Get child MFile of this MFile
-
getRootPath
public Path getRootPath()
-
getRelativePath
public Path getRelativePath()
-
-