Top Description Fields Constructors Methods
org.jruby.util

pack-priv Class JarFileResource

extends JarResource
Class Inheritance
Imports
java.io.IOException, .InputStream, java.nio.channels.Channel, .Channels, java.nio.file.attribute.FileTime, java.util.jar.JarEntry

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

Modifier and TypeField and Description
private final JarEntry
private final JarCache.JarIndex

Constructor Summary

AccessConstructor and Description
pack-priv
JarFileResource(String jarPath, boolean rootSlashPrefix, JarCache.JarIndex index, JarEntry entry)

Method Summary

Modifier and TypeMethod and Description
public FileTime
public String
public boolean
public boolean
public FileTime
public FileTime
public long
public String[]
public Channel
openChannel(int flags, int perm)

Implements org.jruby.util.FileResource.openChannel.

public InputStream
openInputStream()

Implements org.jruby.util.FileResource.openInputStream.

Opens a new input stream to read the contents of a resource and returns it.

public <T> T
unwrap(Class<T> type)

Implements org.jruby.util.FileResource.unwrap.

Unwrap the resource backend (replacement for hackyGetJRubyFile()).

Inherited from org.jruby.util.JarResource:
absolutePathcanExecutecanonicalPathcanReadcanWritecreateequalserrnoexistshashCodeisNullisSymLinklastModifiedlstatpathremoveJarResourcestattoString

Field Detail

entryback to summary
private final JarEntry entry
indexback to summary
private final JarCache.JarIndex index

Constructor Detail

JarFileResourceback to summary
pack-priv JarFileResource(String jarPath, boolean rootSlashPrefix, JarCache.JarIndex index, JarEntry entry)

Method Detail

creationTimeback to summary
public FileTime creationTime()

Implements abstract org.jruby.util.JarResource.creationTime.

Implements org.jruby.util.DummyResourceStat.FileResourceExt.creationTime.

entryNameback to summary
public String entryName()

Implements abstract org.jruby.util.JarResource.entryName.

Annotations
@Override
isDirectoryback to summary
public boolean isDirectory()

Implements org.jruby.util.FileResource.isDirectory.

Annotations
@Override
isFileback to summary
public boolean isFile()

Implements org.jruby.util.FileResource.isFile.

Annotations
@Override
lastAccessTimeback to summary
public FileTime lastAccessTime()

Implements abstract org.jruby.util.JarResource.lastAccessTime.

Implements org.jruby.util.DummyResourceStat.FileResourceExt.lastAccessTime.

lastModifiedTimeback to summary
public FileTime lastModifiedTime()

Implements abstract org.jruby.util.JarResource.lastModifiedTime.

Implements org.jruby.util.DummyResourceStat.FileResourceExt.lastModifiedTime.

lengthback to summary
public long length()

Implements org.jruby.util.FileResource.length.

Annotations
@Override
listback to summary
public String[] list()

Implements org.jruby.util.FileResource.list.

Annotations
@Override
openChannelback to summary
public Channel openChannel(int flags, int perm) throws IOException

Implements org.jruby.util.FileResource.openChannel.

Annotations
@Override
openInputStreamback to summary
public InputStream openInputStream() throws IOException

Implements org.jruby.util.FileResource.openInputStream.

Doc from org.jruby.util.FileResource.openInputStream.

Opens 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

InputStream

Annotations
@Override
unwrapback to summary
public <T> T unwrap(Class<T> type)

Implements org.jruby.util.FileResource.unwrap.

Doc from org.jruby.util.FileResource.unwrap.

Unwrap the resource backend (replacement for hackyGetJRubyFile()).

Returns:T

backend if supported

Annotations
@Override