Package org.jruby.util
Class JarDirectoryResource
java.lang.Object
org.jruby.util.JarResource
org.jruby.util.JarDirectoryResource
- All Implemented Interfaces:
DummyResourceStat.FileResourceExt,FileResource
Represents a directory in a jar.
Jars do not necessarily have to contain entries for a directory. However, from ruby's point of view, if a jar contains entry /foo/bar, it already contains /foo directory. This resource permits just that.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJarDirectoryResource(String jarPath, boolean rootSlashPrefix, String path, String[] contents) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanisFile()booleanisRoot()longlonglength()String[]list()openChannel(int flags, int perm) Opens a new input stream to read the contents of a resource and returns it.<T> TUnwrap the resource backend (replacement forFileResource.hackyGetJRubyFile()).Methods inherited from class org.jruby.util.JarResource
absolutePath, canExecute, canonicalPath, canRead, canWrite, create, equals, errno, exists, hashCode, isNull, isSymLink, lstat, path, removeJarResource, stat, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jruby.util.FileResource
hackyGetJRubyFile, inputStream, openChannel
-
Field Details
-
path
-
contents
-
-
Constructor Details
-
JarDirectoryResource
-
-
Method Details
-
entryName
- Specified by:
entryNamein classJarResource
-
isDirectory
public boolean isDirectory() -
isFile
public boolean isFile() -
length
public long length() -
lastModified
public long lastModified()- Specified by:
lastModifiedin interfaceFileResource- Overrides:
lastModifiedin classJarResource
-
creationTime
- Specified by:
creationTimein interfaceDummyResourceStat.FileResourceExt- Specified by:
creationTimein classJarResource
-
lastAccessTime
- Specified by:
lastAccessTimein interfaceDummyResourceStat.FileResourceExt- Specified by:
lastAccessTimein classJarResource
-
lastModifiedTime
- Specified by:
lastModifiedTimein interfaceDummyResourceStat.FileResourceExt- Specified by:
lastModifiedTimein classJarResource
-
list
- See Also:
-
isRoot
public boolean isRoot() -
openInputStream
Description copied from interface:FileResourceOpens a new input stream to read the contents of a resource and returns it. Note that implementations may be allocating native memory for the stream, so callers need to close this when they are done with it. users of this method should follow the pattern: close the stream where you open it.- Returns:
- InputStream
- Throws:
IOException
-
openChannel
- Throws:
ResourceException
-
unwrap
Description copied from interface:FileResourceUnwrap the resource backend (replacement forFileResource.hackyGetJRubyFile()).- Returns:
- backend if supported
-