|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectno.sintef.file.IOUtils
IO utility class.
Method Summary | |
static java.io.File |
getDefaultDir()
Get current default directory. |
static javax.swing.filechooser.FileFilter[] |
mergeFilters(javax.swing.filechooser.FileFilter[] f1,
javax.swing.filechooser.FileFilter[] f2)
Merge two FileFilter arrays. |
static byte[] |
readFully(java.io.File file)
Read complete File contents into byte array. |
static byte[] |
readFully(java.io.InputStream is)
Read contents of InputStream into byte array. |
static byte[] |
readFully(java.net.URL url)
Read contents of URL into byte array. |
static void |
saveFile(byte[] bytes,
java.io.File file)
Save contents of byte array to the specified file. |
static void |
setDefaultDir(java.io.File dir)
Set current default directory. |
static java.io.File |
showOpenDialog(java.lang.String defaultFilename,
javax.swing.filechooser.FileFilter[] filters,
java.awt.Component parent)
Show file dialog to ask user to select a file to open. |
static java.io.File |
showSaveDialog(java.lang.String defaultFilename,
java.awt.Component parent)
Show file dialog requesting user to choose file to save to. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static java.io.File getDefaultDir()
public static void setDefaultDir(java.io.File dir)
dir
- new current default directory.public static byte[] readFully(java.io.File file) throws java.io.IOException
file
- File to read from
java.io.IOException
- if IO error occurspublic static byte[] readFully(java.net.URL url) throws java.io.IOException
url
- URL to read from
java.io.IOException
- if IO error occurspublic static byte[] readFully(java.io.InputStream is) throws java.io.IOException
is
- InputStream to read from
java.io.IOException
- if IO error occurspublic static void saveFile(byte[] bytes, java.io.File file) throws java.io.IOException
bytes
- byte array with contents to savefile
- file to save to
java.io.IOException
- if IO error occurspublic static java.io.File showSaveDialog(java.lang.String defaultFilename, java.awt.Component parent)
defaultFilename
- default file name for dialogparent
- parent Component to align the dialog to
public static java.io.File showOpenDialog(java.lang.String defaultFilename, javax.swing.filechooser.FileFilter[] filters, java.awt.Component parent)
defaultFilename
- default file name for dialogfilters
- array of filename filtersparent
- parent Component to align the dialog to
public static javax.swing.filechooser.FileFilter[] mergeFilters(javax.swing.filechooser.FileFilter[] f1, javax.swing.filechooser.FileFilter[] f2)
f1
- the first FileFilter arrayf2
- the second FileFilter array
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |