Package org.jruby.util
Interface FileResource
- All Known Implementing Classes:
URLResource
public interface FileResource
-
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
canRead()
boolean
canWrite()
int
errno()
boolean
exists()
default JRubyFile
Deprecated.default InputStream
Deprecated.Opens a new input stream to read the contents of a resource and returns it.boolean
boolean
isFile()
default boolean
isNull()
boolean
long
long
length()
String[]
list()
jnr.posix.FileStat
lstat()
openChannel
(int flags, int perm) default Channel
openChannel
(ModeFlags flags, int perm) Deprecated.useopenChannel(int, int)
insteadOpens a new input stream to read the contents of a resource and returns it.path()
jnr.posix.FileStat
stat()
<T> T
Unwrap the resource backend (replacement forhackyGetJRubyFile()
).static FileResource
-
Method Details
-
wrap
-
absolutePath
String absolutePath() -
canonicalPath
String canonicalPath() -
path
String path() -
exists
boolean exists() -
isDirectory
boolean isDirectory() -
isFile
boolean isFile() -
canExecute
boolean canExecute() -
errno
int errno() -
lastModified
long lastModified() -
length
long length() -
canRead
boolean canRead() -
canWrite
boolean canWrite() -
isNull
default boolean isNull()- Returns:
- is this a NUL device?
-
list
String[] list()- See Also:
-
isSymLink
boolean isSymLink() -
stat
jnr.posix.FileStat stat() -
lstat
jnr.posix.FileStat lstat() -
unwrap
Unwrap the resource backend (replacement forhackyGetJRubyFile()
).- Type Parameters:
T
-- Parameters:
type
-- Returns:
- backend if supported
- Throws:
UnsupportedOperationException
-
hackyGetJRubyFile
Deprecated. -
inputStream
Deprecated.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:
- just opened InputStream
- Throws:
ResourceException
- is the file does not exists or if the resource is a directory
-
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
- Throws:
IOException
-
openChannel
@Deprecated(since="9.4-") default Channel openChannel(ModeFlags flags, int perm) throws ResourceException Deprecated.useopenChannel(int, int)
instead- Parameters:
flags
-perm
-- Returns:
- channel
- Throws:
ResourceException
-
openChannel
- Throws:
IOException
-