Package org.jruby.util
Class URLResource
java.lang.Object
org.jruby.util.URLResource
- All Implemented Interfaces:
DummyResourceStat.FileResourceExt,FileResource
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescription(package private)URLResource(String uri, ClassLoader cl, String pathname, String[] files) privateURLResource(String uri, URL url, ClassLoader cl, String pathname, String[] files) (package private)URLResource(String uri, URL url, String[] files) -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleanaddDirectoriesFromClassloader(ClassLoader cl, Set<String> list, String pathname, boolean isDirectory) private static booleanaddDirectoryEntries(Set<String> entries, URL url, boolean isDirectory) booleanbooleancanRead()booleancanWrite()private static voidstatic FileResourcestatic FileResourcecreateClassloaderURI(Ruby runtime, String pathname, boolean asFile) private static FileResourcecreateRegularURI(String pathname, boolean asFile) booleaninterrno()booleanexists()static URLgetResourceURL(Ruby runtime, String location) inthashCode()booleanbooleanisFile()booleanlonglonglength()String[]list()private static String[]listClassLoaderFiles(ClassLoader classloader, String pathname) private static String[]private static String[]jnr.posix.FileStatlstat()openChannel(int flags, int perm) Opens a new input stream to read the contents of a resource and returns it.path()jnr.posix.FileStatstat()toString()<T> TUnwrap the resource backend (replacement forFileResource.hackyGetJRubyFile()).Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jruby.util.FileResource
hackyGetJRubyFile, inputStream, isNull, openChannel
-
Field Details
-
URI
- See Also:
-
CLASSLOADER
- See Also:
-
URI_CLASSLOADER
- See Also:
-
uri
-
list
-
url
-
pathname
-
cl
-
-
Constructor Details
-
URLResource
-
URLResource
URLResource(String uri, ClassLoader cl, String pathname, String[] files) -
URLResource
-
-
Method Details
-
absolutePath
- Specified by:
absolutePathin interfaceFileResource
-
canonicalPath
- Specified by:
canonicalPathin interfaceFileResource
-
path
- Specified by:
pathin interfaceFileResource
-
exists
public boolean exists()- Specified by:
existsin interfaceFileResource
-
isDirectory
public boolean isDirectory()- Specified by:
isDirectoryin interfaceFileResource
-
isFile
public boolean isFile()- Specified by:
isFilein interfaceFileResource
-
length
public long length()- Specified by:
lengthin interfaceFileResource
-
canRead
public boolean canRead()- Specified by:
canReadin interfaceFileResource
-
canWrite
public boolean canWrite()- Specified by:
canWritein interfaceFileResource
-
canExecute
public boolean canExecute()- Specified by:
canExecutein interfaceFileResource
-
list
- Specified by:
listin interfaceFileResource- See Also:
-
isSymLink
public boolean isSymLink()- Specified by:
isSymLinkin interfaceFileResource
-
lastModified
public long lastModified()- Specified by:
lastModifiedin interfaceFileResource
-
lastModifiedTime
- Specified by:
lastModifiedTimein interfaceDummyResourceStat.FileResourceExt
-
lastAccessTime
- Specified by:
lastAccessTimein interfaceDummyResourceStat.FileResourceExt
-
creationTime
- Specified by:
creationTimein interfaceDummyResourceStat.FileResourceExt
-
errno
public int errno()- Specified by:
errnoin interfaceFileResource
-
stat
public jnr.posix.FileStat stat()- Specified by:
statin interfaceFileResource
-
lstat
public jnr.posix.FileStat lstat()- Specified by:
lstatin interfaceFileResource
-
unwrap
Description copied from interface:FileResourceUnwrap the resource backend (replacement forFileResource.hackyGetJRubyFile()).- Specified by:
unwrapin interfaceFileResource- Returns:
- backend if supported
- Throws:
UnsupportedOperationException
-
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.- Specified by:
openInputStreamin interfaceFileResource- Returns:
- InputStream
- Throws:
IOException
-
openChannel
- Specified by:
openChannelin interfaceFileResource- Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
toString
-
createClassloaderURI
-
addDirectoriesFromClassloader
private static boolean addDirectoriesFromClassloader(ClassLoader cl, Set<String> list, String pathname, boolean isDirectory) throws IOException - Throws:
IOException
-
addDirectoryEntries
-
create
-
createRegularURI
-
listFilesFromInputStream
-
listClassLoaderFiles
-
listFiles
-
close
-
getResourceURL
-