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

## toxi.util
Class FileUtils

    java.lang.Object
      toxi.util.FileUtils

    public class FileUtils

extends java.lang.Object

A collection of file handling utilities.

Constructor Summary
`FileUtils()`

Method Summary
`static void` | `createDirectories(java.io.File file)`
`static java.io.InputStream` | `createInputStream(java.io.File file)`
`static java.io.OutputStream` | `createOutputStream(java.io.File file)`
`static java.io.BufferedReader` | `createReader(java.io.File file)`
`static java.io.BufferedReader` | `createReader(java.io.InputStream input)`
`static java.io.BufferedReader` | `createReader(java.io.InputStream input, java.lang.String encoding)`
`static java.io.PrintWriter` | `createWriter(java.io.File file)`
`static java.io.PrintWriter` | `createWriter(java.io.OutputStream out)`
`static java.io.PrintWriter` | `createWriter(java.io.OutputStream out, java.lang.String encoding)`
`static FileSequenceDescriptor` | `getFileSequenceDescriptorFor(java.lang.String path)` Analyses the given file path for a file sequence pattern and returns a `FileSequenceDescriptor` instance for further use to handle this sequence.
`static byte[]` | `loadBytes(java.io.InputStream stream)`
`static java.lang.String` | `loadText(java.io.BufferedReader r)`
`static java.lang.String` | `loadText(java.io.InputStream input)`
`static java.lang.String` | `loadText(java.io.InputStream input, java.lang.String encoding)`
`static void` | `saveText(java.io.OutputStream output, java.lang.String string)`
`static void` | `saveText(java.io.PrintWriter writer, java.lang.String string)`
`static java.lang.String` | `showFileDialog(java.awt.Frame frame, java.lang.String title, java.lang.String path, java.lang.String[] formats, int mode)` Displays a standard AWT file dialog for choosing a file for loading or saving.

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

Constructor Detail

### FileUtils

    public FileUtils()

Method Detail

### createDirectories

    public static void createDirectories(java.io.File file)

### createInputStream

    public static java.io.InputStream createInputStream(java.io.File file)
                                                 throws java.io.IOException

  Throws:
    `java.io.IOException`

### createOutputStream

    public static java.io.OutputStream createOutputStream(java.io.File file)
                                                   throws java.io.IOException

  Throws:
    `java.io.IOException`

### createReader

    public static java.io.BufferedReader createReader(java.io.File file)
                                               throws java.io.IOException

  Throws:
    `java.io.IOException`

### createReader

    public static java.io.BufferedReader createReader(java.io.InputStream input)

### createReader

    public static java.io.BufferedReader createReader(java.io.InputStream input,
                                                      java.lang.String encoding)

### createWriter

    public static java.io.PrintWriter createWriter(java.io.File file)
                                            throws java.io.IOException

  Throws:
    `java.io.IOException`

### createWriter

    public static java.io.PrintWriter createWriter(java.io.OutputStream out)

### createWriter

    public static java.io.PrintWriter createWriter(java.io.OutputStream out,
                                                   java.lang.String encoding)

### getFileSequenceDescriptorFor

    public static FileSequenceDescriptor getFileSequenceDescriptorFor(java.lang.String path)

  Analyses the given file path for a file sequence pattern and returns a `FileSequenceDescriptor` instance for further use to handle this sequence. The file pattern should be in one of these formats:

  - base_path-00001.ext
  - base_path001.ext

  The sequence index should be using leading zeros, but the number of digits will be identified automatically.

  Parameters:
    `path` - file path of the first file in the sequence
  Returns:
    descriptor, or null, if the path could not be analysed

### loadBytes

    public static byte[] loadBytes(java.io.InputStream stream)
                            throws java.io.IOException

  Throws:
    `java.io.IOException`

### loadText

    public static java.lang.String loadText(java.io.BufferedReader r)
                                     throws java.io.IOException

  Throws:
    `java.io.IOException`

### loadText

    public static java.lang.String loadText(java.io.InputStream input)
                                     throws java.io.IOException

  Throws:
    `java.io.IOException`

### loadText

    public static java.lang.String loadText(java.io.InputStream input,
                                            java.lang.String encoding)
                                     throws java.io.IOException

  Throws:
    `java.io.IOException`

### saveText

    public static void saveText(java.io.OutputStream output,
                                java.lang.String string)

### saveText

    public static void saveText(java.io.PrintWriter writer,
                                java.lang.String string)

### showFileDialog

    public static java.lang.String showFileDialog(java.awt.Frame frame,
                                                  java.lang.String title,
                                                  java.lang.String path,
                                                  java.lang.String[] formats,
                                                  int mode)

  Displays a standard AWT file dialog for choosing a file for loading or saving.

  Parameters:
    `frame` - parent frame
    `title` - dialog title
    `path` - base directory (or null)
    `formats` - an array of allowed file extensions (or null to allow all)
    `mode` - either FileDialog.LOAD or FileDialog.SAVE
  Returns:
    path to chosen file or null, if user has cancelled

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