Top Fields Constructors Methods
org.jruby.util

public Class JRubyNonExistentFile

extends JRubyFile
Class Inheritance
Annotations
@Deprecated
Imports
java.io.File, .FileFilter, .FileNotFoundException, .FilenameFilter, .IOException

Deprecated

Field Summary

Modifier and TypeField and Description
pack-priv static final JRubyNonExistentFile
NOT_EXIST

References Deprecated JRubyNonExistentFile is deprecated or references (maybe indirectly) at least one deprecated element.
Inherited from org.jruby.util.JRubyFile:
DUMMY

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static File
createTempFile(String
The prefix string to be used in generating the file's name; must be at least three characters long
prefix
,
String
The suffix string to be used in generating the file's name; may be null, in which case the suffix ".tmp" will be used
suffix
,
File
The directory in which the file is to be created, or null if the default temporary-file directory is to be used
directory
)

Hides org.jruby.util.JRubyFile.createTempFile.

Creates a new empty file in the specified directory, using the given prefix and suffix strings to generate its name.

public static File
createTempFile(String
The prefix string to be used in generating the file's name; must be at least three characters long
prefix
,
String
The suffix string to be used in generating the file's name; may be null, in which case the suffix ".tmp" will be used
suffix
)

Hides org.jruby.util.JRubyFile.createTempFile.

Creates an empty file in the default temporary-file directory, using the given prefix and suffix to generate its name.

public boolean
exists()

Overrides jnr.posix.JavaSecuredFile.exists.

Tests whether the file or directory denoted by this abstract pathname exists.

public File
getAbsoluteFile()

Overrides org.jruby.util.JRubyFile.getAbsoluteFile.

Returns the absolute form of this abstract pathname.

public String
getAbsolutePath()

Overrides org.jruby.util.JRubyFile.getAbsolutePath.

Returns the absolute pathname string of this abstract pathname.

public File
getCanonicalFile()

Overrides org.jruby.util.JRubyFile.getCanonicalFile.

Returns the canonical form of this abstract pathname.

public String
getCanonicalPath()

Overrides org.jruby.util.JRubyFile.getCanonicalPath.

Returns the canonical pathname string of this abstract pathname.

public String
getParent()

Overrides org.jruby.util.JRubyFile.getParent.

Returns the pathname string of this abstract pathname's parent, or null if this pathname does not name a parent directory.

public File
getParentFile()

Overrides org.jruby.util.JRubyFile.getParentFile.

Returns the abstract pathname of this abstract pathname's parent, or null if this pathname does not name a parent directory.

public String
getPath()

Overrides org.jruby.util.JRubyFile.getPath.

Converts this abstract pathname into a pathname string.

public boolean
isDirectory()

Overrides jnr.posix.JavaSecuredFile.isDirectory.

Tests whether the file denoted by this abstract pathname is a directory.

public String[]
list(FilenameFilter
A filename filter
filter
)

Overrides org.jruby.util.JRubyFile.list.

Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter.

public File[]
listFiles()

Overrides org.jruby.util.JRubyFile.listFiles.

Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname.

public File[]
listFiles(final FileFilter
A file filter
filter
)

Overrides org.jruby.util.JRubyFile.listFiles.

Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter.

public File[]
listFiles(final FilenameFilter
A filename filter
filter
)

Overrides org.jruby.util.JRubyFile.listFiles.

Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter.

public static File[]
listRoots()

Hides org.jruby.util.JRubyFile.listRoots.

List the available filesystem roots.

public String
toString()

Overrides org.jruby.util.JRubyFile.toString.

Returns the pathname string of this abstract pathname.

Inherited from org.jruby.util.JRubyFile:
createcreateResourcecreateResourcecreateResourcecreateResourceAsFilecreateRestrictedResourcegetFilePropertygetPathDefaultisComPortisResourceRegularFilenormalizeSeps

Field Detail

NOT_EXISTback to summary
pack-priv static final JRubyNonExistentFile NOT_EXIST

References Deprecated

JRubyNonExistentFile is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Constructor Detail

JRubyNonExistentFileback to summary
private JRubyNonExistentFile()

Method Detail

createTempFileback to summary
public static File createTempFile(String prefix, String suffix, File directory) throws IOException

Hides org.jruby.util.JRubyFile.createTempFile.

Doc from java.io.File.createTempFile.

Creates a new empty file in the specified directory, using the given prefix and suffix strings to generate its name. If this method returns successfully then it is guaranteed that:

  1. The file denoted by the returned abstract pathname did not exist before this method was invoked, and
  2. Neither this method nor any of its variants will return the same abstract pathname again in the current invocation of the virtual machine.
This method provides only part of a temporary-file facility. To arrange for a file created by this method to be deleted automatically, use the deleteOnExit method.

The prefix argument must be at least three characters long. It is recommended that the prefix be a short, meaningful string such as "hjb" or "mail". The suffix argument may be null, in which case the suffix ".tmp" will be used.

To create the new file, the prefix and the suffix may first be adjusted to fit the limitations of the underlying platform. If the prefix is too long then it will be truncated, but its first three characters will always be preserved. If the suffix is too long then it too will be truncated, but if it begins with a period character ('.') then the period and the first three characters following it will always be preserved. Once these adjustments have been made the name of the new file will be generated by concatenating the prefix, five or more internally-generated characters, and the suffix.

If a file with the generated name cannot be created by the underlying platform, then an IOException will be thrown. This could occur for example if the supplied prefix or suffix contains one or more characters not supported by the underlying file system.

If the directory argument is null then the system-dependent default temporary-file directory will be used. The default temporary-file directory is specified by the system property java.io.tmpdir. On UNIX systems the default value of this property is typically "/tmp" or "/var/tmp"; on Microsoft Windows systems it is typically "C:\\WINNT\\TEMP". A different value may be given to this system property when the Java virtual machine is invoked, but programmatic changes to this property are not guaranteed to have any effect upon the temporary directory used by this method.

If the directory argument is not null and its abstract pathname is valid and denotes an existing, writable directory, then the file will be created in that directory. Otherwise the file will not be created and an IOException will be thrown. Under no circumstances will a directory be created at the location specified by the directory argument.

Parameters
prefix:String

The prefix string to be used in generating the file's name; must be at least three characters long

suffix:String

The suffix string to be used in generating the file's name; may be null, in which case the suffix ".tmp" will be used

directory:File

The directory in which the file is to be created, or null if the default temporary-file directory is to be used

Returns:File

An abstract pathname denoting a newly-created empty file

Exceptions
IOException:
If a file could not be created
createTempFileback to summary
public static File createTempFile(String prefix, String suffix) throws IOException

Hides org.jruby.util.JRubyFile.createTempFile.

Doc from java.io.File.createTempFile.

Creates an empty file in the default temporary-file directory, using the given prefix and suffix to generate its name. Invoking this method is equivalent to invoking createTempFile(prefix, suffix, null).

The Files.createTempFile method provides an alternative method to create an empty file in the temporary-file directory. Files created by that method may have more restrictive access permissions to files created by this method and so may be more suited to security-sensitive applications.

Parameters
prefix:String

The prefix string to be used in generating the file's name; must be at least three characters long

suffix:String

The suffix string to be used in generating the file's name; may be null, in which case the suffix ".tmp" will be used

Returns:File

An abstract pathname denoting a newly-created empty file

Exceptions
IOException:
If a file could not be created
existsback to summary
public boolean exists()

Overrides jnr.posix.JavaSecuredFile.exists.

Doc from java.io.File.exists.

Tests whether the file or directory denoted by this abstract pathname exists.

Returns:boolean

true if and only if the file or directory denoted by this abstract pathname exists; false otherwise

Annotations
@Override
getAbsoluteFileback to summary
public File getAbsoluteFile()

Overrides org.jruby.util.JRubyFile.getAbsoluteFile.

Doc from java.io.File.getAbsoluteFile.

Returns the absolute form of this abstract pathname. Equivalent to new File(this.getAbsolutePath).

Returns:File

The absolute abstract pathname denoting the same file or directory as this abstract pathname

Annotations
@Override
getAbsolutePathback to summary
public String getAbsolutePath()

Overrides org.jruby.util.JRubyFile.getAbsolutePath.

Doc from java.io.File.getAbsolutePath.

Returns the absolute pathname string of this abstract pathname.

If this abstract pathname is already absolute, then the pathname string is simply returned as if by the getPath method. If this abstract pathname is the empty abstract pathname then the pathname string of the current user directory, which is named by the system property user.dir, is returned. Otherwise this pathname is resolved in a system-dependent way. On UNIX systems, a relative pathname is made absolute by resolving it against the current user directory. On Microsoft Windows systems, a relative pathname is made absolute by resolving it against the current directory of the drive named by the pathname, if any; if not, it is resolved against the current user directory.

Returns:String

The absolute pathname string denoting the same file or directory as this abstract pathname

Annotations
@Override
getCanonicalFileback to summary
public File getCanonicalFile() throws IOException

Overrides org.jruby.util.JRubyFile.getCanonicalFile.

Doc from java.io.File.getCanonicalFile.

Returns the canonical form of this abstract pathname. Equivalent to new File(this.getCanonicalPath).

Returns:File

The canonical pathname string denoting the same file or directory as this abstract pathname

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs, which is possible because the construction of the canonical pathname may require filesystem queries
getCanonicalPathback to summary
public String getCanonicalPath() throws IOException

Overrides org.jruby.util.JRubyFile.getCanonicalPath.

Doc from java.io.File.getCanonicalPath.

Returns the canonical pathname string of this abstract pathname.

A canonical pathname is both absolute and unique. The precise definition of canonical form is system-dependent. This method first converts this pathname to absolute form if necessary, as if by invoking the getAbsolutePath method, and then maps it to its unique form in a system-dependent way. This typically involves removing redundant names such as "." and ".." from the pathname, resolving symbolic links (on UNIX platforms), and converting drive letters to a standard case (on Microsoft Windows platforms).

Every pathname that denotes an existing file or directory has a unique canonical form. Every pathname that denotes a nonexistent file or directory also has a unique canonical form. The canonical form of the pathname of a nonexistent file or directory may be different from the canonical form of the same pathname after the file or directory is created. Similarly, the canonical form of the pathname of an existing file or directory may be different from the canonical form of the same pathname after the file or directory is deleted.

Returns:String

The canonical pathname string denoting the same file or directory as this abstract pathname

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs, which is possible because the construction of the canonical pathname may require filesystem queries
getParentback to summary
public String getParent()

Overrides org.jruby.util.JRubyFile.getParent.

Doc from java.io.File.getParent.

Returns the pathname string of this abstract pathname's parent, or null if this pathname does not name a parent directory.

The parent of an abstract pathname consists of the pathname's prefix, if any, and each name in the pathname's name sequence except for the last. If the name sequence is empty then the pathname does not name a parent directory.

Returns:String

The pathname string of the parent directory named by this abstract pathname, or null if this pathname does not name a parent

Annotations
@Override
getParentFileback to summary
public File getParentFile()

Overrides org.jruby.util.JRubyFile.getParentFile.

Doc from java.io.File.getParentFile.

Returns the abstract pathname of this abstract pathname's parent, or null if this pathname does not name a parent directory.

The parent of an abstract pathname consists of the pathname's prefix, if any, and each name in the pathname's name sequence except for the last. If the name sequence is empty then the pathname does not name a parent directory.

Returns:File

The abstract pathname of the parent directory named by this abstract pathname, or null if this pathname does not name a parent

Annotations
@Override
getPathback to summary
public String getPath()

Overrides org.jruby.util.JRubyFile.getPath.

Doc from java.io.File.getPath.

Converts this abstract pathname into a pathname string. The resulting string uses the default name-separator character to separate the names in the name sequence.

Returns:String

The string form of this abstract pathname

Annotations
@Override
isDirectoryback to summary
public boolean isDirectory()

Overrides jnr.posix.JavaSecuredFile.isDirectory.

Doc from java.io.File.isDirectory.

Tests whether the file denoted by this abstract pathname is a directory.

Where it is required to distinguish an I/O exception from the case that the file is not a directory, or where several attributes of the same file are required at the same time, then the Files.readAttributes method may be used.

Returns:boolean

true if and only if the file denoted by this abstract pathname exists and is a directory; false otherwise

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

Overrides org.jruby.util.JRubyFile.list.

Doc from java.io.File.list.

Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. The behavior of this method is the same as that of the list() method, except that the strings in the returned array must satisfy the filter. If the given filter is null then all names are accepted. Otherwise, a name satisfies the filter if and only if the value true results when the FilenameFilter.accept(File, String) method of the filter is invoked on this abstract pathname and the name of a file or directory in the directory that it denotes.

Parameters
filter:FilenameFilter

A filename filter

Returns:String[]

An array of strings naming the files and directories in the directory denoted by this abstract pathname that were accepted by the given filter. The array will be empty if the directory is empty or if no names were accepted by the filter. Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.

Annotations
@Override
listFilesback to summary
public File[] listFiles()

Overrides org.jruby.util.JRubyFile.listFiles.

Doc from java.io.File.listFiles.

Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname.

If this abstract pathname does not denote a directory, then this method returns null. Otherwise an array of File objects is returned, one for each file or directory in the directory. Pathnames denoting the directory itself and the directory's parent directory are not included in the result. Each resulting abstract pathname is constructed from this abstract pathname using the File(File, String) constructor. Therefore if this pathname is absolute then each resulting pathname is absolute; if this pathname is relative then each resulting pathname will be relative to the same directory.

There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.

Note that the java.nio.file.Files class defines the newDirectoryStream method to open a directory and iterate over the names of the files in the directory. This may use less resources when working with very large directories.

Returns:File[]

An array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname. The array will be empty if the directory is empty. Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.

Annotations
@Override
listFilesback to summary
public File[] listFiles(final FileFilter filter)

Overrides org.jruby.util.JRubyFile.listFiles.

Doc from java.io.File.listFiles.

Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. The behavior of this method is the same as that of the listFiles() method, except that the pathnames in the returned array must satisfy the filter. If the given filter is null then all pathnames are accepted. Otherwise, a pathname satisfies the filter if and only if the value true results when the FileFilter.accept(File) method of the filter is invoked on the pathname.

Parameters
filter:FileFilter

A file filter

Returns:File[]

An array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname. The array will be empty if the directory is empty. Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.

Annotations
@Override
listFilesback to summary
public File[] listFiles(final FilenameFilter filter)

Overrides org.jruby.util.JRubyFile.listFiles.

Doc from java.io.File.listFiles.

Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. The behavior of this method is the same as that of the listFiles() method, except that the pathnames in the returned array must satisfy the filter. If the given filter is null then all pathnames are accepted. Otherwise, a pathname satisfies the filter if and only if the value true results when the FilenameFilter.accept(File, String) method of the filter is invoked on this abstract pathname and the name of a file or directory in the directory that it denotes.

Parameters
filter:FilenameFilter

A filename filter

Returns:File[]

An array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname. The array will be empty if the directory is empty. Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.

Annotations
@Override
listRootsback to summary
public static File[] listRoots()

Hides org.jruby.util.JRubyFile.listRoots.

Doc from java.io.File.listRoots.

List the available filesystem roots.

A particular Java platform may support zero or more hierarchically-organized file systems. Each file system has a root directory from which all other files in that file system can be reached.

This method returns an array of File objects that denote the root directories of the available filesystem roots. It is guaranteed that the canonical pathname of any file physically present on the local machine will begin with one of the roots returned by this method. There is no guarantee that a root directory can be accessed.

Returns:File[]

An array of File objects denoting the available filesystem roots, or null if the set of roots could not be determined. The array will be empty if there are no filesystem roots.

toStringback to summary
public String toString()

Overrides org.jruby.util.JRubyFile.toString.

Doc from java.io.File.toString.

Returns the pathname string of this abstract pathname. This is just the string returned by the getPath method.

Returns:String

The string form of this abstract pathname

Annotations
@Override