|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.essex.common.io.FileOp<T>
uk.ac.essex.common.io.FileOpImpl<ImageFile>
uk.ac.essex.ia.imageview.ImageFileOp
public class ImageFileOp
Handles reading and writing image data to/from files TODO: Tidy up this class
Field Summary |
---|
Fields inherited from class uk.ac.essex.common.io.FileOpImpl |
---|
currentCaller, fileChooser, LAST_DIR, lastDir |
Fields inherited from class uk.ac.essex.common.io.FileOp |
---|
file |
Constructor Summary | |
---|---|
ImageFileOp()
The file fileChooser is just a plain old JFileChooser . |
Method Summary | |
---|---|
java.lang.String |
getDefaultEnding()
Gets the default file ending to postfix to the file name, this is only used if the file to save to has not been given by the user. |
java.lang.String |
getWriteParam(java.lang.String s)
Returns the string needed by the "filestore" and "encode" operations is also used to check users have entered a valid filetype ending ie/ it returns null for invalid file endings. |
void |
main(java.lang.String[] args)
Test method - Should test this class by opening an image file from disk then saving it under another name. |
ImageFile |
openFile(java.io.File fileToOpen)
Opens the file specied by fname and returns this as type RenderedImage |
void |
save(ImageFile toBeSaved)
Saves an image to file the first parameter should be a RenderedImage or this will do
nothing. |
boolean |
saveAs(ImageFile toBeSaved,
java.awt.Component caller)
Saves an image file under a new name. |
protected void |
saveFile()
Saves the image stored in source, in the File stored in file. |
Methods inherited from class uk.ac.essex.common.io.FileOpImpl |
---|
getFileChooser, hasEnding, open, setFileChooser |
Methods inherited from class uk.ac.essex.common.io.FileOp |
---|
getFile |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ImageFileOp()
JFileChooser
.
Method Detail |
---|
public java.lang.String getWriteParam(java.lang.String s)
s
- - The file ending to check
public boolean saveAs(ImageFile toBeSaved, java.awt.Component caller)
ImageJFileChooser
where users can select the
new file name. The first parameter should be a
RenderedImage
or this will fail.
Users can select the encoding of data(ie/.jpg, .gif etc) either by
entering it in box they put the name in or by selecting it from the drop
down box
saveAs
in class FileOpImpl<ImageFile>
toBeSaved
- - the Object to savecaller
- - The GUI that called this function
FileOp.save(T)
public ImageFile openFile(java.io.File fileToOpen)
RenderedImage
openFile
in class FileOpImpl<ImageFile>
fileToOpen
- - The file to openpublic java.lang.String getDefaultEnding()
getDefaultEnding
in class FileOpImpl<ImageFile>
public void save(ImageFile toBeSaved)
RenderedImage
or this will do
nothing.
save
in class FileOp<ImageFile>
toBeSaved
- - The Object to be savedprotected void saveFile()
public void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |