Package com.gengoai.io.resource
Class ZipResource
- java.lang.Object
-
- com.gengoai.io.resource.BaseResource
-
- com.gengoai.io.resource.ZipResource
-
- All Implemented Interfaces:
ReadOnlyResource
,Resource
,Serializable
public class ZipResource extends BaseResource implements ReadOnlyResource
The type Zip resource.- Author:
- David B. Bracewell
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.gengoai.io.resource.Resource
Resource.Deserializer
-
-
Field Summary
-
Fields inherited from interface com.gengoai.io.resource.Resource
ALL_FILE_PATTERN
-
-
Constructor Summary
Constructors Constructor Description ZipResource(String zipFile, String entry)
Instantiates a new Zip resource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
baseName()
Gets the name (file name or directory name) of this resource.protected InputStream
createInputStream()
Create input stream input stream.String
descriptor()
Descriptor string.boolean
exists()
Exists boolean.Resource
getChild(String relativePath)
Creates a new Resource that is relative to this resource.List<Resource>
getChildren(Pattern pattern, boolean recursive)
Lists all the resources that are directly under this resource.Resource
getParent()
Gets parent.boolean
isDirectory()
Is directory.-
Methods inherited from class com.gengoai.io.resource.BaseResource
asFile, asURI, canRead, canWrite, compressed, createOutputStream, getCharset, inputStream, isCompressed, outputStream, path, setCharset, setCompression, setIsCompressed, toString, uncompressed
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.gengoai.io.resource.ReadOnlyResource
append, canRead, canWrite
-
Methods inherited from interface com.gengoai.io.resource.Resource
append, asFile, asPath, asURI, asURL, childIterator, childIterator, compressed, copy, delete, delete, deleteOnExit, forEach, getCharset, getChildren, getChildren, getChildren, getChildren, inputStream, isCompressed, lines, mkdir, mkdirs, outputStream, path, readBytes, reader, readLines, readObject, readToString, setCharset, setCompression, setIsCompressed, uncompressed, write, write, writeObject, writer
-
-
-
-
Method Detail
-
baseName
public String baseName()
Description copied from interface:Resource
Gets the name (file name or directory name) of this resource.- Specified by:
baseName
in interfaceResource
- Overrides:
baseName
in classBaseResource
- Returns:
- The name of the file or directory
-
createInputStream
protected InputStream createInputStream() throws IOException
Description copied from class:BaseResource
Create input stream input stream.- Overrides:
createInputStream
in classBaseResource
- Returns:
- the input stream
- Throws:
IOException
- the io exception
-
descriptor
public String descriptor()
Description copied from interface:Resource
Descriptor string.- Specified by:
descriptor
in interfaceResource
- Overrides:
descriptor
in classBaseResource
- Returns:
- The string representation of the resource with protocol
-
exists
public boolean exists()
Description copied from interface:Resource
Exists boolean.
-
getChild
public Resource getChild(String relativePath)
Description copied from interface:Resource
Creates a new Resource that is relative to this resource.
-
getChildren
public List<Resource> getChildren(Pattern pattern, boolean recursive)
Description copied from interface:Resource
Lists all the resources that are directly under this resource.
- Specified by:
getChildren
in interfaceResource
- Parameters:
pattern
- The file matching patternrecursive
- Gets all children recursively- Returns:
- A list of all the resources one level under this resource.
-
isDirectory
public boolean isDirectory()
Description copied from interface:Resource
Is directory.- Specified by:
isDirectory
in interfaceResource
- Overrides:
isDirectory
in classBaseResource
- Returns:
- True if the resource is a directory
-
-