Package org.jruby.util
Class URLResource
java.lang.Object
org.jruby.util.URLResource
- All Implemented Interfaces:
FileResource
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
canRead()
boolean
canWrite()
static FileResource
static FileResource
createClassloaderURI
(Ruby runtime, String pathname, boolean asFile) boolean
int
errno()
boolean
exists()
static URL
getResourceURL
(Ruby runtime, String location) int
hashCode()
boolean
boolean
isFile()
boolean
long
long
length()
String[]
list()
jnr.posix.FileStat
lstat()
openChannel
(int flags, int perm) Opens a new input stream to read the contents of a resource and returns it.path()
jnr.posix.FileStat
stat()
toString()
<T> T
Unwrap the resource backend (replacement forFileResource.hackyGetJRubyFile()
).Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jruby.util.FileResource
hackyGetJRubyFile, inputStream, isNull, openChannel
-
Field Details
-
URI
- See Also:
-
CLASSLOADER
- See Also:
-
URI_CLASSLOADER
- See Also:
-
-
Method Details
-
absolutePath
- Specified by:
absolutePath
in interfaceFileResource
-
canonicalPath
- Specified by:
canonicalPath
in interfaceFileResource
-
path
- Specified by:
path
in interfaceFileResource
-
exists
public boolean exists()- Specified by:
exists
in interfaceFileResource
-
isDirectory
public boolean isDirectory()- Specified by:
isDirectory
in interfaceFileResource
-
isFile
public boolean isFile()- Specified by:
isFile
in interfaceFileResource
-
length
public long length()- Specified by:
length
in interfaceFileResource
-
canRead
public boolean canRead()- Specified by:
canRead
in interfaceFileResource
-
canWrite
public boolean canWrite()- Specified by:
canWrite
in interfaceFileResource
-
canExecute
public boolean canExecute()- Specified by:
canExecute
in interfaceFileResource
-
list
- Specified by:
list
in interfaceFileResource
- See Also:
-
isSymLink
public boolean isSymLink()- Specified by:
isSymLink
in interfaceFileResource
-
lastModified
public long lastModified()- Specified by:
lastModified
in interfaceFileResource
-
lastModifiedTime
-
lastAccessTime
-
creationTime
-
errno
public int errno()- Specified by:
errno
in interfaceFileResource
-
stat
public jnr.posix.FileStat stat()- Specified by:
stat
in interfaceFileResource
-
lstat
public jnr.posix.FileStat lstat()- Specified by:
lstat
in interfaceFileResource
-
unwrap
Description copied from interface:FileResource
Unwrap the resource backend (replacement forFileResource.hackyGetJRubyFile()
).- Specified by:
unwrap
in interfaceFileResource
- Type Parameters:
T
-- Parameters:
type
-- Returns:
- backend if supported
- Throws:
UnsupportedOperationException
-
openInputStream
Description copied from interface:FileResource
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.- Specified by:
openInputStream
in interfaceFileResource
- Returns:
- InputStream
- Throws:
IOException
-
openChannel
- Specified by:
openChannel
in interfaceFileResource
- Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
toString
-
createClassloaderURI
-
create
-
getResourceURL
-