FileSvc.I Interface

com.bea.ide.filesystem
FileSvc.I Interface

public static interface FileSvc.I
Enclosing class

FileSvc

Method Summary

public boolean
canWrite(URI uri)
Checks the writable state of the specified URI.
public boolean
copyFile(URI uriFrom, URI uriTo, boolean overwrite)
Copies the file specified by uriFrom to the file or directory specified by uriTo.
public boolean
copyFile(URI uriFrom, URI uriTo)
Copy the file specified by uriFrom to the file or directory specified by uriTo.
public boolean
copyPath(URI uriFrom, URI uriTo, boolean overwrite)
Copies the files and subdirectories of the directory specified by uriFrom to the directory specified by uriTo.
public boolean
copyPath(URI uriFrom, URI uriTo)
Copies the files and subdirectories of the directory specified by uriFrom to the directory specified by uriTo.
public boolean
copyPathDialog(URI uriFrom, URI uriTo, boolean overwrite, String title, boolean showDetailMsg)
Copies the files and subdirectories of the directory specified by uriFrom to the directory specified by uriTo.
public boolean
createDirs(IFile f)
Creates the directory structure specified by the IFile.
public boolean
createFile(IFile f)
Creates the file specified by the IFile.
public URI
createTempDir(String sPrefix)
Creates a temporary directory with the given prefix.
public URI
createTempFile(String sExtension)
Creates a temporary file with the given file extension.
public URI
createTempFile(String sExtension, URI uriParent)
Creates a temporary file with the given file extension in the directory specified.
public URI
createUniqueFile(URI uriFrom)
Creates a unique file in the same directory as the file described by the given URI.
public boolean
deleteFile(URI uri)
Deletes the file specified by the uri.
public boolean
deletePath(URI uri)
Deletes the directory and all it's contents specified by the given URI.
public boolean
deletePathDialog(URI uri, String title, boolean showDetailMsg)
Deletes the directory and all it's contents specified by the given URI.
public boolean
exists(URI uri)
Checks for the existence of the file specified by the uri.
public FileSvc.IFileSaver
getFileSaver(URI uriToSave, boolean allowOverwrite, boolean allowReadOnly)
Obtain a new FileSvc.IFileSaver object for saving to the given URI with the given options.
public FileSvc.IFileSaver
getFileSaver(URI uriToSave, boolean allowOverwrite)
Obtain a new FileSvc.IFileSaver object for saving to the given URI with the given options.
public FileSvc.IFileSaver
getFileSaver(URI uriToSave)
Obtain a new FileSvc.IFileSaver object for saving to the given URI with the given options.
public IFile
getIFile(URI uri)
Obtain an IFile object for the given URI.
public IFile
getIFile(IFile fParent, String name)
Obtain an IFile object for the given filename, with the given parent.
public Reader
getReader(IFile file)
Get a Reader interface for the given IFile.
public Reader
getReaderDialog(IFile file)
Get a Reader interface for the given IFile.
public Reader
getReaderFromStream(InputStream in, String filename)
Returns a Reader for the InputStream with the best possible encoding.
public Reader
getReaderFromStream(InputStream in)
Returns a Reader for this InputStream.
public Reader
getReaderFromStreamDialog(InputStream in, String filename)
Returns a Reader for the InputStream with the best possible encoding.
public Reader
getReaderFromStreamDialog(InputStream in)
Returns a Reader for the InputStream with the best possible encoding.
public String
getRelativePath(IFile file1, IFile file2)
Returns a relative path from the first IFile to the second IFile.
public URI
getUniqueURI(URI uriFrom)
Returns a unique (at the time the method is called) URI derived from the given URI.
public String
invalidPathCheck(URI uriParent, String sName, boolean isDirectory)
Determine whether the given filename is valid in the given parent directory.
public boolean
isPlatformCaseSensitive()
Informational method indicating whether or not the platform the IDE is currently running on is case-sensitive or not.
public boolean
isValidURI(URI uri, boolean isDirectory)
Determine whether the given URI is valid.
public boolean
isValidURIDialog(URI uri, boolean isDirectory)
Determine whether the given URI is valid.
public boolean
isValidURIDialog(URI uri, boolean isDirectory, Component component)
Determine whether the given URI is valid.
public boolean
moveFile(URI uriFrom, URI uriTo, boolean overwrite)
Moves the file specified by uriFrom to the file or directory specified by uriTo.
public boolean
moveFile(URI uriFrom, URI uriTo)
Moves the file specified by uriFrom to the file or directory specified by uriTo.
public boolean
movePath(URI uriFrom, URI uriTo)
Moves the files and subdirectories of the directory specified by uriFrom to the directory specified by uriTo.
public boolean
movePath(URI uriFrom, URI uriTo, boolean overwrite)
Moves the files and subdirectories of the directory specified by uriFrom to the directory specified by uriTo.
public boolean
newPath(URI uriNew)
Creates the directory specified by uriNew.
public int
refreshFileDialog(URI uri)
Display a dialog prompting the user to refresh the file represented by the given URI
public int
refreshFileDialog(URI uri, Component component)
Display a dialog prompting the user to refresh the file represented by the given URI
public int
refreshFileDialog(URI uri, Component component, String message)
Display a dialog prompting the user to refresh the file represented by the given URI
public boolean
save(FileSvc.IFileSaver fs, Reader in)
Same as saveDialog, but no error information is returned aside from success or failure.
public boolean
save(FileSvc.IFileSaver fs, InputStream in)
Same as saveDialog, but no error information is returned aside from success or failure.
public boolean
saveDialog(FileSvc.IFileSaver fs, Reader in)
Save the data given by the Reader to the file, specified by the file saver object.
public boolean
saveDialog(FileSvc.IFileSaver fs, InputStream in)
Save the data given by the InputStream to the file, specified by the file saver object.
public String
saveWithReporting(FileSvc.IFileSaver fs, Reader in)
Same as saveDialog, but the error information is returned as a string.
public String
saveWithReporting(FileSvc.IFileSaver fs, InputStream in)
Same as saveDialog, but the error information is returned as a string.
public boolean
setWriteable(URI uri, boolean fWriteable)
Sets the writeable state of the given URI to the specified value.
public boolean
setWriteableDialog(URI uri, boolean fWriteable)
Sets the writeable state of the given URI to the specified value.

Method Detail

canWrite(URI) Method

public boolean canWrite(URI uri)
Checks the writable state of the specified URI. Note that this method does not verify authentication for network shares (due to java limitations).

Parameters

uri
URI describing the file to check

Returns

true if the URI describes a file to which the user has permission to write, false if the file does not exist or the user does not have write permission

copyFile(URI, URI, boolean) Method

public boolean copyFile(URI uriFrom, 
                        URI uriTo, 
                        boolean overwrite)
Copies the file specified by uriFrom to the file or directory specified by uriTo. The original file is left unchanged. If uriTo exists and is a directory, the file's name is derived using uriFrom. If uriTo does not exist, or is a file, the new filename is that given by uriTo. If uriFrom specifies a directory or does not exist, this method fails.

Parameters

uriFrom
file to copy
uriTo
file or directory specifying the destination
overwrite
if true and uriTo specifies an existing file, the file will be overwritten. if false, an existing file will not be overwritten. if uriTo does not exist or is a directory, this parameter is ignored.

Returns

true if the file was successfully moved, false if an error occured

copyFile(URI, URI) Method

public boolean copyFile(URI uriFrom, 
                        URI uriTo)
Copy the file specified by uriFrom to the file or directory specified by uriTo. This method is identical to FileSvc.I.moveFile(URI, URI, boolean) with a value of false passed for the overwrite parameter.

Parameters

uriFrom
file to copy
uriTo
file or directory specifying the destination

Returns

true if the file was successfully moved, false if an error occured

copyPath(URI, URI, boolean) Method

public boolean copyPath(URI uriFrom, 
                        URI uriTo, 
                        boolean overwrite)
Copies the files and subdirectories of the directory specified by uriFrom to the directory specified by uriTo. If the final component of uriTo does not exist, it is created. If uriFrom does not exist, this method fails. Note that on failure, one or more of the files may have been copied. This is not an atomic operation. The overwrite flag governs the behavior of overwritting only if the destination artifact is of the same type as the source. This method will always fail when attempting to copy a directory onto a file, or vice-versa.

Parameters

uriFrom
directory to copy
uriTo
directory specifying the destination
overwrite
if true and any file or directory in uriFrom already exists in the destination it is overwritten. if false, the method will fail if a file or directory already exists in the destination

Returns

true if the directory contents were successfully copied, false if an error occured

copyPath(URI, URI) Method

public boolean copyPath(URI uriFrom, 
                        URI uriTo)
Copies the files and subdirectories of the directory specified by uriFrom to the directory specified by uriTo. This method is identical to FileSvc.I.copyPath(URI, URI, boolean) with a value of false passed for the overwrite parameter.

Parameters

uriFrom
directory to copy
uriTo
directory specifying the destination

Returns

true if the directory contents were successfully copied, false if an error occured

copyPathDialog(URI, URI, boolean, String, boolean) Method

public boolean copyPathDialog(URI uriFrom, 
                              URI uriTo, 
                              boolean overwrite, 
                              String title, 
                              boolean showDetailMsg)
Copies the files and subdirectories of the directory specified by uriFrom to the directory specified by uriTo. This method is identical to FileSvc.I.copyPath(URI, URI, boolean) but will display a progress dialog. This method should be used anytime the copy is performed on the AWT thread and could take a long time.

Parameters

uriFrom
directory to copy
uriTo
directory specifying the destination
overwrite
if true and any file or directory in uriFrom already exists in the destination it is overwritten. if false, the method will fail if a file or directory already exists in the destination
title
An optional dialog box title, can be null in which case a default title will be used.
showDetailMsg
If true will show the source and destination folders of the file being copied.

Returns

true if the directory contents were successfully copied, false if an error occured

createDirs(IFile) Method

public boolean createDirs(IFile f)
Creates the directory structure specified by the IFile. This will create any directories that do not exist in the path specified by the IFile. The final path element is also assumed to specify a directory name (rather than a file).

Parameters

f
IFile specifying (via URI) the directory structure to be created

Returns

true if the last directory specified by the IFile is successfully created, false if a failure occurs creating it, or any non-existent directories in it's parent hierarchy. If the directory already exists, or is a file, this method returns false.

createFile(IFile) Method

public boolean createFile(IFile f)
Creates the file specified by the IFile. Returns true if the file was created, false if was not created for any reason.

Parameters

f
IFile specifying (via URI) the file to be created

Returns

true if the file is created by this call, false otherwise

createTempDir(String) Method

public URI createTempDir(String sPrefix)
Creates a temporary directory with the given prefix. The directory is created in the temp directory space that is deleted when the IDE shuts down normally.

Parameters

sPrefix
Prefix string to use when creating the temp directory. A uniquifier will be appended to prevent collisions with existing directories.

Returns

URI of the temporary directory created

createTempFile(String) Method

public URI createTempFile(String sExtension)
Creates a temporary file with the given file extension. This will be created in a temporary directory that is deleted when the IDE shuts down normally.

Parameters

sExtension
file extension for the temporary file

Returns

URI of the temporary file created or null if the file could not be created

createTempFile(String, URI) Method

public URI createTempFile(String sExtension, 
                          URI uriParent)
Creates a temporary file with the given file extension in the directory specified.

Parameters

sExtension
parent directory
uriParent
file extension for the temporary file

Returns

URI of the temporary file created

createUniqueFile(URI) Method

public URI createUniqueFile(URI uriFrom)
Creates a unique file in the same directory as the file described by the given URI. If the given URI does not exist, the exact URI will be used to create the file. If the given URI does exist, the URI will be pulled apart to isolate the base name of the existing file and a uniquifier string will be appended to it to derive a new unique filename. This filename will be atomically created. The directory and file extension will be the same as the original file.

Parameters

uriFrom
initial URI to use for derivation of the unique filename

Returns

URI of an newly created file that was guaranteed to be created by this method and guaranteed not to conflict with any existing file.

deleteFile(URI) Method

public boolean deleteFile(URI uri)
Deletes the file specified by the uri.

Parameters

uri
URI specifying the file to delete

Returns

true if the file was deleted, false if the URI did not exist, was a directory or an error occurred

deletePath(URI) Method

public boolean deletePath(URI uri)
Deletes the directory and all it's contents specified by the given URI. If the URI does not exist, or specifies a file, the method fails

Parameters

uri
URI specifying the directory to delete

Returns

true if the uri was deleted, false if an error occurs

deletePathDialog(URI, String, boolean) Method

public boolean deletePathDialog(URI uri, 
                                String title, 
                                boolean showDetailMsg)
Deletes the directory and all it's contents specified by the given URI. This method is identical to FileSvc.I.deletePath(URI) but will display a progress dialog. This method should be used anytime the delete is performed on the AWT thread and could take a long time.

Parameters

uri
URI specifying the directory to delete
title
An optional dialog box title, can be null in which case a default title will be used.
showDetailMsg
If true will show the name of the folder of the file being deleted.

Returns

true if the uri was deleted, false if an error occurs

exists(URI) Method

public boolean exists(URI uri)
Checks for the existence of the file specified by the uri. This check has the case-sensitivity of the underlying platform as specified by FileSvc.I.isPlatformCaseSensitive().

Parameters

uri
URI describing the file to check for existence

Returns

true if the file or directory specified by uri exists, false if it does not

getFileSaver(URI, boolean, boolean) Method

public FileSvc.IFileSaver getFileSaver(URI uriToSave, 
                                       boolean allowOverwrite, 
                                       boolean allowReadOnly)
Obtain a new FileSvc.IFileSaver object for saving to the given URI with the given options.

Parameters

uriToSave
URI that data will be saved to
allowOverwrite
true indicates that any existing file represented by the given URI will be overwritten, false results in an error if the file exists
allowReadOnly
true indicates that an existing read only file will be overwritten if allowOverwrite is also true, while a value of false will cause an error if an existing file is read-only

Returns

an implementation of the IFileSaver object for saving the given file

getFileSaver(URI, boolean) Method

public FileSvc.IFileSaver getFileSaver(URI uriToSave, 
                                       boolean allowOverwrite)
Obtain a new FileSvc.IFileSaver object for saving to the given URI with the given options. This method is identical to FileSvc.I.getFileSaver(URI, boolean, boolean), however a default value of false is passed for allowReadOnly

Parameters

uriToSave
URI that data will be saved to
allowOverwrite
true indicates that any existing file represented by the given URI will be overwritten, false results in an error if the file exists

Returns

an implementation of the IFileSaver object for saving the given file

getFileSaver(URI) Method

public FileSvc.IFileSaver getFileSaver(URI uriToSave)
Obtain a new FileSvc.IFileSaver object for saving to the given URI with the given options. This method is identical to FileSvc.I.getFileSaver(URI, boolean, boolean), however a default value of false is passed for allowOverwrite and allowReadOnly

Parameters

uriToSave
URI that data will be saved to

Returns

an implementation of the IFileSaver object for saving the given file

getIFile(URI) Method

public IFile getIFile(URI uri)
Obtain an IFile object for the given URI.

Parameters

uri
URI describing the file location

Returns

IFile object representing the given URI

getIFile(IFile, String) Method

public IFile getIFile(IFile fParent, 
                      String name)
Obtain an IFile object for the given filename, with the given parent.

Parameters

fParent
IFile object describing the parent directory to search for the given filename
name
Name of the file within the given parent directory

Returns

IFile object representing the file described by the two parameters

getReader(IFile) Method

public Reader getReader(IFile file)
Get a Reader interface for the given IFile. This will take care of examining the file to determine the correct character encoding. If the encoding is not supported, the method returns null. The default encoding is the platform encoding.

Parameters

file
IFile object describing the file to be opened

Returns

a reader object for reading the contents of the file or null if a valid reader cannot be obtained

getReaderDialog(IFile) Method

public Reader getReaderDialog(IFile file)
Get a Reader interface for the given IFile. This method is just like FileSvc.I.getReader(IFile), however it will display an error dialog if the encoding is not supported.

Parameters

file
IFile object describing the file to be opened

Returns

a reader object for reading the contents of the file or null if a valid reader cannot be obtained

getReaderFromStream(InputStream, String) Method

public Reader getReaderFromStream(InputStream in, 
                                  String filename)
Returns a Reader for the InputStream with the best possible encoding. The filename can be used to select decoders; for instance, .properties files have only one encoding that should be used. The filename can also be a file path or just a file extension (dotted).

If you have an IFile, use it's getReader() instead. This method is useful if you have an InputStream and a filename but not the actual file on disk, like an InputStream from a classloader or a Zip file.

Parameters

in
InputStream for which to create a Reader
filename
The filename or extension (including '.') that the InputStream represents

Returns

valid Reader for stream, or null if one cannot be created.

getReaderFromStream(InputStream) Method

public Reader getReaderFromStream(InputStream in)
Returns a Reader for this InputStream. This form is only used if you do not have any filename or knowledge of the file type for the InputStream. This should only be used if neither an IFile (URI) or filename are available.

Parameters

in
InputStream for which to create a Reader

Returns

valid Reader for stream, or null if one cannot be created.

getReaderFromStreamDialog(InputStream, String) Method

public Reader getReaderFromStreamDialog(InputStream in, 
                                        String filename)
Returns a Reader for the InputStream with the best possible encoding. This method is just like FileSvc.I.getReaderFromStream(InputStream, String), however it will display an error dialog if the encoding is not supported.

Parameters

in
InputStream for which to create a Reader
filename
The filename or extension (including '.') that the InputStream represents

Returns

valid Reader for stream, or null if one cannot be created.

getReaderFromStreamDialog(InputStream) Method

public Reader getReaderFromStreamDialog(InputStream in)
Returns a Reader for the InputStream with the best possible encoding. This method is just like FileSvc.I.getReaderFromStream(InputStream), however it will display an error dialog if the encoding is not supported.

Parameters

in
InputStream for which to create a Reader

Returns

valid Reader for stream, or null if one cannot be created.

getRelativePath(IFile, IFile) Method

public String getRelativePath(IFile file1, 
                              IFile file2)
Returns a relative path from the first IFile to the second IFile. If no relative path is possible (e.g. the two IFiles are on different drives), then null is returned.

If a relative path is returned, it will look like the following: "../../x/y/z" Using '/' as a file separator on all platforms.

Given two IFile, file1 and file2, the following is true:

String relativePath = FileSvc.get().getRelativePath(file1, file2); IFile newFile = FileSvc.get().getIFile(file1, relativePath); newFile.equals(file2) == true;


getUniqueURI(URI) Method

public URI getUniqueURI(URI uriFrom)
Returns a unique (at the time the method is called) URI derived from the given URI. This method uses the same algorithm as FileSvc.I.createUniqueFile(URI) but it does not actually create the file. Thus, between the time the "unique" URI is generated and the time the method returns (or anytime thereafter) a file with a conflicting URI may be created. The directory and file extension will be the same as the original file.

Parameters

uriFrom
initial URI to use for derivation of the unique filename

Returns

URI derived from the initial URI that did not refer to an existing file at the instant in time when the method checks for a conflict

invalidPathCheck(URI, String, boolean) Method

public String invalidPathCheck(URI uriParent, 
                               String sName, 
                               boolean isDirectory)
Determine whether the given filename is valid in the given parent directory. While similar to isValidURI this method merely determines if the operating system will allow the creation of the specified file. It does not check naming conventions for document types, project directories, or other semantic checks.

Parameters

uriParent
URI describing the parent directory of the new file/directory
sName
name for the new file/directory
isDirectory
indicates whether the name is intended to be created as a directory

Returns

an error string if there was an error, null if the path is valid

isPlatformCaseSensitive() Method

public boolean isPlatformCaseSensitive()
Informational method indicating whether or not the platform the IDE is currently running on is case-sensitive or not.

Returns

true if files differing only in their case are considered different in the file system, false otherwise

isValidURI(URI, boolean) Method

public boolean isValidURI(URI uri, 
                          boolean isDirectory)
Determine whether the given URI is valid. This tests numerous aspects of the URI including directory and file names, naming conventions for file types, operating system limitations etc...

Parameters

uri
URI to check for validity
isDirectory
whether the URI is intended to represent a directory

Returns

true if the URI is valid, false if any part of it is invalid

isValidURIDialog(URI, boolean) Method

public boolean isValidURIDialog(URI uri, 
                                boolean isDirectory)
Determine whether the given URI is valid. This method is identical to FileSvc.I.isValidURI(URI, boolean), however it displays a dialog describing the error if one occurs.

Parameters

uri
URI to check for validity
isDirectory
whether the URI is intended to represent a directory

Returns

true if the URI is valid, false if any part of it is invalid

isValidURIDialog(URI, boolean, Component) Method

public boolean isValidURIDialog(URI uri, 
                                boolean isDirectory, 
                                Component component)
Determine whether the given URI is valid. This method is identical to FileSvc.I.isValidURIDialog(URI, boolean), however it allows the use of a Component as a parent of the dialog.

Parameters

uri
URI to check for validity
isDirectory
whether the URI is intended to represent a directory
component
AWT component to use as the parent of the error dialog if it displayed

Returns

true if the URI is valid, false if any part of it is invalid

moveFile(URI, URI, boolean) Method

public boolean moveFile(URI uriFrom, 
                        URI uriTo, 
                        boolean overwrite)
Moves the file specified by uriFrom to the file or directory specified by uriTo. If uriTo exists and is a directory, the file's name is derived using uriFrom. If uriTo does not exist, or is a file, the filename is changed to match that given by uriTo. If uriFrom specifies a directory or does not exist, this method fails. The overwrite flag governs the behavior of overwritting only if the destination artifact is of the same type as the source. This method will always fail when attempting to move a directory onto a file, or vice-versa.

Parameters

uriFrom
file to move
uriTo
file or directory specifying the destination
overwrite
if true and uriTo specifies an existing file, the file will be overwritten. if false, an existing file will not be overwritten. if uriTo does not exist or is a directory, this parameter is ignored.

Returns

true if the file was successfully moved, false if an error occured

moveFile(URI, URI) Method

public boolean moveFile(URI uriFrom, 
                        URI uriTo)
Moves the file specified by uriFrom to the file or directory specified by uriTo. This method is identical to FileSvc.I.moveFile(URI, URI, boolean) with a value of false passed for the overwrite parameter.

Parameters

uriFrom
file to move
uriTo
file or directory specifying the destination

Returns

true if the file was successfully moved, false if an error occured

movePath(URI, URI) Method

public boolean movePath(URI uriFrom, 
                        URI uriTo)
Moves the files and subdirectories of the directory specified by uriFrom to the directory specified by uriTo. If the final component of uriTo does not exist, it is created. If uriFrom does not exist, this method fails. Note that on failure, one or more of the files may have moved. This is not an atomic operation. The overwrite flag governs the behavior of overwritting only if the destination artifact is of the same type as the source. This method will always fail when attempting to move a directory onto a file, or vice-versa.

Parameters

uriFrom
directory to move
uriTo
directory specifying the destination

Returns

true if the directory contents were successfully moved, false if an error occured

movePath(URI, URI, boolean) Method

public boolean movePath(URI uriFrom, 
                        URI uriTo, 
                        boolean overwrite)
Moves the files and subdirectories of the directory specified by uriFrom to the directory specified by uriTo. This method is identical to FileSvc.I.movePath(URI, URI, boolean) with a value of false passed for the overwrite parameter.

Parameters

uriFrom
directory to move
uriTo
directory specifying the destination

Returns

true if the directory contents were successfully moved, false if an error occured

newPath(URI) Method

public boolean newPath(URI uriNew)
Creates the directory specified by uriNew. This differs from FileSvc.I.createDirs(IFile) in that only the final element of the URI is created. if any parent directories do not exist, this method will fail

Parameters

uriNew
URI describing the directory to create

Returns

true if the directory was created, false if it described an existing file or directory, or if an error occurred

refreshFileDialog(URI) Method

public int refreshFileDialog(URI uri)
Display a dialog prompting the user to refresh the file represented by the given URI

Parameters

uri
URI describing the file to refresh

Returns

one of FileSvc.I.REFRESH_STATUS_CANCEL, FileSvc.I.REFRESH_STATUS_RELOAD, FileSvc.I.REFRESH_STATUS_SAVE indicating the selection the user made in the dialog.

refreshFileDialog(URI, Component) Method

public int refreshFileDialog(URI uri, 
                             Component component)
Display a dialog prompting the user to refresh the file represented by the given URI

Parameters

uri
URI describing the file to refresh
component

Returns

one of FileSvc.I.REFRESH_STATUS_CANCEL, FileSvc.I.REFRESH_STATUS_RELOAD, FileSvc.I.REFRESH_STATUS_SAVE indicating the selection the user made in the dialog.

refreshFileDialog(URI, Component, String) Method

public int refreshFileDialog(URI uri, 
                             Component component, 
                             String message)
Display a dialog prompting the user to refresh the file represented by the given URI

Parameters

uri
URI describing the file to refresh

Returns

one of FileSvc.I.REFRESH_STATUS_CANCEL, FileSvc.I.REFRESH_STATUS_RELOAD, FileSvc.I.REFRESH_STATUS_SAVE indicating the selection the user made in the dialog.

save(FileSvc.IFileSaver, Reader) Method

public boolean save(FileSvc.IFileSaver fs, 
                    Reader in)
Same as saveDialog, but no error information is returned aside from success or failure.

Parameters

fs
IFileSaver interface (usually obtained by getFileSaver()) that specifies the file to be saved
in
Reader object containing the data to be saved

Returns

true if the save was successful, false otherwise

save(FileSvc.IFileSaver, InputStream) Method

public boolean save(FileSvc.IFileSaver fs, 
                    InputStream in)
Same as saveDialog, but no error information is returned aside from success or failure.

Parameters

fs
IFileSaver interface (usually obtained by getFileSaver()) that specifies the file to be saved
in
InputStream object containing the data to be saved

Returns

true if the save was successful, false otherwise

saveDialog(FileSvc.IFileSaver, Reader) Method

public boolean saveDialog(FileSvc.IFileSaver fs, 
                          Reader in)
Save the data given by the Reader to the file, specified by the file saver object. This will display a dialog with any error information. This will use the EncodingDetector facility to attempt to properly encode the data in the reader when writing to the file. Information such as the extension on the file as well as the contents of the Reader object will be used to determine the correct encoding. Any encoding errors (data incompatibilites or invalid encodings) will be displayed to the user.

Parameters

fs
IFileSaver interface (usually obtained by getFileSaver()) that specifies the file to be saved
in
Reader object containing the data to be saved

Returns

true if the save was successful, false otherwise

saveDialog(FileSvc.IFileSaver, InputStream) Method

public boolean saveDialog(FileSvc.IFileSaver fs, 
                          InputStream in)
Save the data given by the InputStream to the file, specified by the file saver object. This will display a dialog with any error information.

Parameters

fs
IFileSaver interface (usually obtained by getFileSaver()) that specifies the file to be saved
in
InputStream object containing the data to be saved

Returns

true if the save was successful, false otherwise

saveWithReporting(FileSvc.IFileSaver, Reader) Method

public String saveWithReporting(FileSvc.IFileSaver fs, 
                                Reader in)
Same as saveDialog, but the error information is returned as a string.

Parameters

fs
IFileSaver interface (usually obtained by getFileSaver()) that specifies the file to be saved
in
Reader object containing the data to be saved

Returns

null if the save was successful, otherwise, a String containing the error information

saveWithReporting(FileSvc.IFileSaver, InputStream) Method

public String saveWithReporting(FileSvc.IFileSaver fs, 
                                InputStream in)
Same as saveDialog, but the error information is returned as a string.

Parameters

fs
IFileSaver interface (usually obtained by getFileSaver()) that specifies the file to be saved
in
InputStream object containing the data to be saved

Returns

null if the save was successful, otherwise, a String containing the error information

setWriteable(URI, boolean) Method

public boolean setWriteable(URI uri, 
                            boolean fWriteable)
Sets the writeable state of the given URI to the specified value. If it already matches no change is made. This method may fail if the user does not have permission to alter the state of the file.

Parameters

uri
URI describing the file to change
fWriteable
indicates the new desired state, true for writeable, false for read-only

Returns

true if the writeable state is successfully changed, false otherwise

setWriteableDialog(URI, boolean) Method

public boolean setWriteableDialog(URI uri, 
                                  boolean fWriteable)
Sets the writeable state of the given URI to the specified value. This method is the same as FileSvc.I.setWriteable(URI, boolean), however an error dialog is displayed if an error occurs.

Parameters

uri
URI describing the file to change
fWriteable
indicates the new desired state, true for writeable, false for read-only

Returns

true if the writeable state is successfully changed, false if an error occurred or the file does not exist.