|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.horstmann.violet.framework.FileService
public abstract class FileService
Nested Class Summary | |
---|---|
static interface |
FileService.Open
An Open object encapsulates the stream and name of the file that the user selected for opening. |
static interface |
FileService.Save
A Save object encapsulates the stream and name of the file that the user selected for saving. |
Constructor Summary | |
---|---|
FileService()
|
Method Summary | |
---|---|
static java.lang.String |
editExtension(java.lang.String original,
java.lang.String toBeRemoved,
java.lang.String desired)
Edits the file path so that it ends in the desired extension. |
static FileService |
getInstance(java.io.File initialDirectory)
Gets a service that is appropriate for the mode in which this program works. |
abstract boolean |
isWebStart()
Tests whether the service is provided by WebStart |
abstract FileService.Open |
open(java.lang.String defaultDirectory,
java.lang.String defaultFile,
ExtensionFilter extensions)
Gets an Open object that encapsulates the stream and name of the file that the user selected |
abstract FileService.Save |
save(java.lang.String defaultDirectory,
java.lang.String defaultFile,
ExtensionFilter extensions,
java.lang.String removeExtension,
java.lang.String addExtension)
Gets a Save object that encapsulates the stream and name of the file that the user selected (or will select) |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileService()
Method Detail |
---|
public static FileService getInstance(java.io.File initialDirectory)
public abstract boolean isWebStart()
public abstract FileService.Open open(java.lang.String defaultDirectory, java.lang.String defaultFile, ExtensionFilter extensions) throws java.io.IOException
defaultDirectory
- the default directory for the file chooserdefaultFile
- the default file for the file chooserextensions
- the extension filter
java.io.IOException
public abstract FileService.Save save(java.lang.String defaultDirectory, java.lang.String defaultFile, ExtensionFilter extensions, java.lang.String removeExtension, java.lang.String addExtension) throws java.io.IOException
defaultDirectory
- the default directory for the file chooserdefaultFile
- the default file for the file chooserextensions
- the extension filterremoveExtension
- the extension to remove from the default file nameaddExtension
- the extension to add to the file name
java.io.IOException
public static java.lang.String editExtension(java.lang.String original, java.lang.String toBeRemoved, java.lang.String desired)
original
- the file to use as a starting pointtoBeRemoved
- the extension that is to be
removed before adding the desired extension. Use
null if nothing needs to be removed.desired
- the desired extension (e.g. ".png"),
or a | separated list of extensions
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |