Cytoscape 2.8.0 API

cytoscape.util
Class FileUtil

java.lang.Object
  extended by cytoscape.util.FileUtil

public abstract class FileUtil
extends Object

Provides a platform-dependent way to open files. Mainly because Mac would prefer that you use java.awt.FileDialog instead of the Swing FileChooser.


Field Summary
static int CUSTOM
           
static int LOAD
           
protected static CyLogger logger
           
static int SAVE
           
static String urlPattern
          A string that defines a simplified java regular expression for a URL.
 
Constructor Summary
FileUtil()
           
 
Method Summary
static File getFile(String title, int load_save_custom)
          Returns a File object, this method should be used instead of rolling your own JFileChooser.
static File getFile(String title, int load_save_custom, CyFileFilter[] filters)
          Returns a File object, this method should be used instead of rolling your own JFileChooser.
static File getFile(String title, int load_save_custom, CyFileFilter[] filters, String start_dir, String custom_approve_text)
          Returns a File object, this method should be used instead of rolling your own JFileChooser.
static File getFile(String title, int load_save_custom, CyFileFilter filter, File selectedFile)
          Returns a File object, this method should be used instead of rolling your own JFileChooser.
static File[] getFiles(Component parent, String title, int load_save_custom, CyFileFilter[] filters)
          Returns an array of File objects, this method should be used instead of rolling your own JFileChooser.
static File[] getFiles(Component parent, String title, int load_save_custom, CyFileFilter[] filters, String start_dir, String custom_approve_text, boolean multiselect)
          Returns a list of File objects, this method should be used instead of rolling your own JFileChooser.
static File[] getFiles(Component parent, String title, int load_save_custom, CyFileFilter[] filters, String start_dir, String custom_approve_text, boolean multiselect, File[] selectedFiles)
          Returns a list of File objects, this method should be used instead of rolling your own JFileChooser.
static File[] getFiles(String title, int load_save_custom, CyFileFilter[] filters)
          Returns an array of File objects, this method should be used instead of rolling your own JFileChooser.
static File[] getFiles(String title, int load_save_custom, CyFileFilter[] filters, String start_dir, String custom_approve_text)
          Returns a list of File objects, this method should be used instead of rolling your own JFileChooser.
static File[] getFiles(String title, int load_save_custom, CyFileFilter[] filters, String start_dir, String custom_approve_text, boolean multiselect)
          Returns a list of File objects, this method should be used instead of rolling your own JFileChooser.
static InputStream getInputStream(String name)
          DOCUMENT ME!
static InputStream getInputStream(String name, TaskMonitor monitor)
          DOCUMENT ME!
static String getInputString(InputStream inputStream)
           
static String getInputString(String filename)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static CyLogger logger

LOAD

public static int LOAD

SAVE

public static int SAVE

CUSTOM

public static int CUSTOM

urlPattern

public static final String urlPattern
A string that defines a simplified java regular expression for a URL. This may need to be updated to be more precise.

See Also:
Constant Field Values
Constructor Detail

FileUtil

public FileUtil()
Method Detail

getFile

public static File getFile(String title,
                           int load_save_custom)
Returns a File object, this method should be used instead of rolling your own JFileChooser.

Parameters:
title - the title of the dialog box
load_save_custom - a flag for the type of file dialog
Returns:
the location of the selcted file

getFile

public static File getFile(String title,
                           int load_save_custom,
                           CyFileFilter[] filters)
Returns a File object, this method should be used instead of rolling your own JFileChooser.

Parameters:
title - the title of the dialog box
load_save_custom - a flag for the type of file dialog
filters - an array of CyFileFilters that let you filter based on extension
Returns:
the location of the selected file

getFile

public static File getFile(String title,
                           int load_save_custom,
                           CyFileFilter filter,
                           File selectedFile)
Returns a File object, this method should be used instead of rolling your own JFileChooser.

Parameters:
title - the title of the dialog box
load_save_custom - a flag for the type of file dialog
filters - an array of CyFileFilters that let you filter based on extension
selectedFile - selectedFile
Returns:
the location of the selected file

getFile

public static File getFile(String title,
                           int load_save_custom,
                           CyFileFilter[] filters,
                           String start_dir,
                           String custom_approve_text)
Returns a File object, this method should be used instead of rolling your own JFileChooser.

Parameters:
title - the title of the dialog box
load_save_custom - a flag for the type of file dialog
filters - an array of CyFileFilters that let you filter based on extension
start_dir - an alternate start dir, if null the default cytoscape MUD will be used
custom_approve_text - if this is a custom dialog, then custom text should be on the approve button.
Returns:
the location of the selcted file

getFiles

public static File[] getFiles(String title,
                              int load_save_custom,
                              CyFileFilter[] filters)
Returns an array of File objects, this method should be used instead of rolling your own JFileChooser.

Parameters:
title - the title of the dialog box
load_save_custom - a flag for the type of file dialog
filters - an array of CyFileFilters that let you filter based on extension
Returns:
the location of the selcted file

getFiles

public static File[] getFiles(Component parent,
                              String title,
                              int load_save_custom,
                              CyFileFilter[] filters)
Returns an array of File objects, this method should be used instead of rolling your own JFileChooser.

Parameters:
parent - the parent component of the JFileChooser dialog
title - the title of the dialog box
load_save_custom - a flag for the type of file dialog
filters - an array of CyFileFilters that let you filter based on extension
Returns:
the location of the selcted file

getFiles

public static File[] getFiles(String title,
                              int load_save_custom,
                              CyFileFilter[] filters,
                              String start_dir,
                              String custom_approve_text)
Returns a list of File objects, this method should be used instead of rolling your own JFileChooser.

Parameters:
title - the title of the dialog box
load_save_custom - a flag for the type of file dialog
filters - an array of CyFileFilters that let you filter based on extension
start_dir - an alternate start dir, if null the default cytoscape MUD will be used
custom_approve_text - if this is a custom dialog, then custom text should be on the approve button.
Returns:
and array of selected files, or null if none are selected

getFiles

public static File[] getFiles(String title,
                              int load_save_custom,
                              CyFileFilter[] filters,
                              String start_dir,
                              String custom_approve_text,
                              boolean multiselect)
Returns a list of File objects, this method should be used instead of rolling your own JFileChooser.

Parameters:
title - the title of the dialog box
load_save_custom - a flag for the type of file dialog
filters - an array of CyFileFilters that let you filter based on extension
start_dir - an alternate start dir, if null the default cytoscape MUD will be used
custom_approve_text - if this is a custom dialog, then custom text should be on the approve button.
multiselect - Enable selection of multiple files (Macs are still limited to a single file because we use FileDialog there -- is this fixed in Java 1.5?)
Returns:
and array of selected files, or null if none are selected

getFiles

public static File[] getFiles(Component parent,
                              String title,
                              int load_save_custom,
                              CyFileFilter[] filters,
                              String start_dir,
                              String custom_approve_text,
                              boolean multiselect)
Returns a list of File objects, this method should be used instead of rolling your own JFileChooser.

Parameters:
parent - the parent of the JFileChooser dialog
title - the title of the dialog box
load_save_custom - a flag for the type of file dialog
filters - an array of CyFileFilters that let you filter based on extension
start_dir - an alternate start dir, if null the default cytoscape MUD will be used
custom_approve_text - if this is a custom dialog, then custom text should be on the approve button.
multiselect - Enable selection of multiple files (Macs are still limited to a single file because we use FileDialog there -- is this fixed in Java 1.5?)
Returns:
and array of selected files, or null if none are selected

getFiles

public static File[] getFiles(Component parent,
                              String title,
                              int load_save_custom,
                              CyFileFilter[] filters,
                              String start_dir,
                              String custom_approve_text,
                              boolean multiselect,
                              File[] selectedFiles)
Returns a list of File objects, this method should be used instead of rolling your own JFileChooser.

Parameters:
parent - the parent of the JFileChooser dialog
title - the title of the dialog box
load_save_custom - a flag for the type of file dialog
filters - an array of CyFileFilters that let you filter based on extension
start_dir - an alternate start dir, if null the default cytoscape MUD will be used
custom_approve_text - if this is a custom dialog, then custom text should be on the approve button.
multiselect - Enable selection of multiple files (Macs are still limited to a single file because we use FileDialog there -- is this fixed in Java 1.5?)
selectedFiles - The list of selected files
Returns:
and array of selected files, or null if none are selected

getInputStream

public static InputStream getInputStream(String name)
DOCUMENT ME!

Parameters:
name - DOCUMENT ME!
Returns:
DOCUMENT ME!

getInputStream

public static InputStream getInputStream(String name,
                                         TaskMonitor monitor)
DOCUMENT ME!

Parameters:
name - DOCUMENT ME!
monitor - DOCUMENT ME!
Returns:
DOCUMENT ME!

getInputString

public static String getInputString(String filename)
Parameters:
filename - File to read in
Returns:
The contents of the given file as a string.

getInputString

public static String getInputString(InputStream inputStream)
                             throws IOException
Parameters:
inputStream - An InputStream
Returns:
The contents of the given file as a string.
Throws:
IOException

Cytoscape 2.8.0 API

Copyright 2010 Cytoscape Consortium. All rights reserved.