Class JavaAgent.agent.FileIO
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class JavaAgent.agent.FileIO

java.lang.Object
   |
   +----JavaAgent.agent.FileIO

public class FileIO
extends Object
Static class which provides functionality for copying remote files to local files, creating directories, writing byte arrays to local files and reading byte arrays from remote files.


Copyright (c) 1995, H. Robert Frost, Stanford University. All rights reserved.

Copyright (c) 1996, H. Robert Frost, Enterprise Integration Technologies, Inc. All rights reserved.

RESTRICTED RIGHTS LEGEND: Use, duplication or disclosure by the Government is subject to restrictions as set forth in subparagraph(c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 and in similar clauses in the FAR and NASA FAR supplement.

This software is bound by the terms and conditions listed in the attached LICENSE file.



Constructor Index

 o FileIO()

Method Index

 o copy_to_file(URL, File, boolean)
Copy to a new or existing file.
 o mk_local_dir(String)
Creates the specified local directory.
 o read_from_URL(URL)
Reads a bite array from a URL.
 o remote_copy(URL, File, String, int)
Make a local copy of a remote file.
 o write_to_file(byte[], File, String, boolean)
Writes a bite array to a local file.

Constructors

 o FileIO
  public FileIO()

Methods

 o mk_local_dir
  public static File mk_local_dir(String path) throws IOException
Creates the specified local directory.
Parameters:
path - Absolute path for directory.
Returns:
File object if successful or null
 o remote_copy
  public static File remote_copy(URL remote_file,
                                 File path,
                                 String name,
                                 int exists_action) throws IOException
Make a local copy of a remote file. If the local file exists, will either ignore the copy request, overwrite the file or append depending on the exists_action parameter which will have the values "leave", "overwrite" or "append". If "overwrite", the file is first deleted then recreated with the remote contents.
Parameters:
remote_file - URL of the remote file, includes remote file name.
path - Absolute path for local destination.
name - File name.
exists_action - Action if local file already exists.
Returns:
File object if successful or null.
 o copy_to_file
  protected static File copy_to_file(URL remote_file,
                                     File f,
                                     boolean append) throws IOException
Copy to a new or existing file.
 o write_to_file
  public static File write_to_file(byte data[],
                                   File path,
                                   String name,
                                   boolean append) throws IOException
Writes a bite array to a local file. Returns a reference to the file.
Parameters:
data - Bytes to write
path - Absolute path of local file.
name - Name of file
append - If the file already exists, should data be appended?
Returns:
Destination file.
 o read_from_URL
  public static byte[] read_from_URL(URL source) throws IOException
Reads a bite array from a URL.
Parameters:
source - URL to read from.
Returns:
bytes read.

All Packages  Class Hierarchy  This Package  Previous  Next  Index