Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.borg.common
Class IOHelper

    java.lang.Object
      net.sf.borg.common.IOHelper

    public class IOHelper

extends Object

standard routines for file I/O with prompting

Constructor Summary
`IOHelper()`

Method Summary
`static boolean` | `checkOverwrite(String fname)` displays an overwrite confirm dialog if a file exists
`static OutputStream` | `createOutputStream(String file)` create an output stream to a file, creating parent dirs as needed
`static OutputStream` | `createOutputStream(URL url)` Creates an output stream to a URL
`static InputStream` | `fileOpen(String startDirectory, String title)` Prompt the user to choose a file to open
`static void` | `fileSave(String startDirectory, InputStream istr, String defaultFilename)` prompt the user to pick a file for saving and save date to the file

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### IOHelper

    public IOHelper()

Method Detail

### fileOpen

    public static InputStream fileOpen(String startDirectory,
                                       String title)
                                throws Exception

  Prompt the user to choose a file to open

  Parameters:
    `startDirectory` - the start directory
    `title` - the window title
  Returns:
    the input stream
  Throws:
    `Exception` - the exception

### fileSave

    public static void fileSave(String startDirectory,
                                InputStream istr,
                                String defaultFilename)
                         throws Exception

  prompt the user to pick a file for saving and save date to the file

  Parameters:
    `startDirectory` - the start directory
    `istr` - the stream to write out to the file
    `defaultFilename` - the default filename
  Throws:
    `Exception` - the exception

### createOutputStream

    public static OutputStream createOutputStream(URL url)
                                           throws Exception

  Creates an output stream to a URL

  Parameters:
    `url` - the url
  Returns:
    the output stream
  Throws:
    `Exception` - the exception

### createOutputStream

    public static OutputStream createOutputStream(String file)
                                           throws Exception

  create an output stream to a file, creating parent dirs as needed

  Parameters:
    `file` - the file
  Returns:
    the output stream
  Throws:
    `Exception` - the exception

### checkOverwrite

    public static boolean checkOverwrite(String fname)

  displays an overwrite confirm dialog if a file exists

  Parameters:
    `fname` - the filename
  Returns:
    true, if the user says it's ok to overwrite

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Generated September 24 2010 by mbb using Apache Ant version 1.7.1 compiled on June 27 2008 and Java version 1.6.0_20 from Sun Microsystems Inc. on Linux i386 2.6.24-28-generic