Package org.jruby.util
Class JarFileResource
java.lang.Object
org.jruby.util.JarResource
org.jruby.util.JarFileResource
- All Implemented Interfaces:
DummyResourceStat.FileResourceExt,FileResource
Represents a file in a jar.
Note: while directories can be contained within a jar, they're still represented by JarDirectoryResource, since Ruby expects a directory to exist as long as any files in that directory do, or Dir.glob would break.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJarFileResource(String jarPath, boolean rootSlashPrefix, JarCache.JarIndex index, JarEntry entry) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanisFile()longlength()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, lastModified, 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
-
index
-
entry
-
-
Constructor Details
-
JarFileResource
JarFileResource(String jarPath, boolean rootSlashPrefix, JarCache.JarIndex index, JarEntry entry)
-
-
Method Details
-
entryName
- Specified by:
entryNamein classJarResource
-
isDirectory
public boolean isDirectory() -
isFile
public boolean isFile() -
length
public long length() -
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:
-
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:
IOException
-
unwrap
Description copied from interface:FileResourceUnwrap the resource backend (replacement forFileResource.hackyGetJRubyFile()).- Returns:
- backend if supported
-