Top Description Fields Constructors Methods
org.jruby.util

pack-priv Class RegularFileResource

extends Object
implements FileResource
Class Inheritance
All Implemented Interfaces
org.jruby.util.FileResource
Imports
java.nio.channels.SeekableByteChannel, .Channel, .FileChannel, jnr.constants.platform.Errno, .Fcntl, jnr.enxio.channels.NativeDeviceChannel, jnr.posix.FileStat, .POSIX, java.io.File, .FileInputStream, .FileNotFoundException, .FileOutputStream, .InputStream, .IOException, .RandomAccessFile, java.nio.file.*, java.nio.file.attribute.BasicFileAttributes, .FileTime, org.jruby.ext.fcntl.FcntlLibrary, org.jruby.RubyFile, org.jruby.platform.Platform, org.jruby.util.io.ModeFlags, .PosixShim

Represents a "regular" file, backed by regular file system.

Field Summary

Modifier and TypeField and Description
private final JRubyFile
private transient BasicFileAttributes
private final String
private final POSIX

Constructor Summary

AccessConstructor and Description
pack-priv
RegularFileResource(POSIX posix, JRubyFile file, String filePath)

protected
RegularFileResource(POSIX posix, String filename)

Method Summary

Modifier and TypeMethod and Description
public String
public boolean
public String
public boolean
public boolean
private Channel
public FileTime
public int
public boolean
public boolean
public boolean
public FileTime
public long
public FileTime
public long
public String[]
public FileStat
pack-priv static IOException
public Channel
openChannel(final 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 String
private BasicFileAttributes
public FileStat
private void
throwFromErrno(final int err)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

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

Implements org.jruby.util.FileResource.unwrap.

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

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

fileback to summary
private final JRubyFile file
fileAttributesback to summary
private transient BasicFileAttributes fileAttributes
filePathback to summary
private final String filePath
posixback to summary
private final POSIX posix

Constructor Detail

RegularFileResourceback to summary
pack-priv RegularFileResource(POSIX posix, JRubyFile file, String filePath)
RegularFileResourceback to summary
protected RegularFileResource(POSIX posix, String filename)

Method Detail

absolutePathback to summary
public String absolutePath()

Implements org.jruby.util.FileResource.absolutePath.

Annotations
@Override
canExecuteback to summary
public boolean canExecute()

Implements org.jruby.util.FileResource.canExecute.

Annotations
@Override
canonicalPathback to summary
public String canonicalPath()

Implements org.jruby.util.FileResource.canonicalPath.

Annotations
@Override
canReadback to summary
public boolean canRead()

Implements org.jruby.util.FileResource.canRead.

Annotations
@Override
canWriteback to summary
public boolean canWrite()

Implements org.jruby.util.FileResource.canWrite.

Annotations
@Override
createChannelback to summary
private Channel createChannel(ModeFlags flags) throws IOException
creationTimeback to summary
public FileTime creationTime() throws IOException
errnoback to summary
public int errno()

Implements org.jruby.util.FileResource.errno.

existsback to summary
public boolean exists()

Implements org.jruby.util.FileResource.exists.

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() throws IOException
lastModifiedback to summary
public long lastModified()

Implements org.jruby.util.FileResource.lastModified.

Annotations
@Override
lastModifiedTimeback to summary
public FileTime lastModifiedTime() throws IOException
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
lstatback to summary
public FileStat lstat()

Implements org.jruby.util.FileResource.lstat.

Annotations
@Override
mapFileNotFoundOnGetChannelback to summary
pack-priv static IOException mapFileNotFoundOnGetChannel(final FileResource file, final FileNotFoundException ex)
openChannelback to summary
public Channel openChannel(final 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
pathback to summary
public String path()

Implements org.jruby.util.FileResource.path.

Annotations
@Override
readAttributesback to summary
private BasicFileAttributes readAttributes() throws IOException
statback to summary
public FileStat stat()

Implements org.jruby.util.FileResource.stat.

Annotations
@Override
throwFromErrnoback to summary
private void throwFromErrno(final int err) throws IOException
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

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