public class FileIO extends Object
Taken from Java Cookbook, by Ian F. Darwin
MOVES Institute
Naval Postgraduate School, Monterey, CA
www.nps.edu
Constructor and Description |
---|
FileIO() |
Modifier and Type | Method and Description |
---|---|
static void |
copyFile(BufferedReader is,
PrintWriter os,
boolean close)
Copies a file from one location to another directory
|
static void |
copyFile(File infile,
File outfile,
boolean close)
Copies a file from one location to another directory
|
static void |
moveFile(File from,
File to)
Move a file from one location (directory) to another
|
public static void copyFile(File infile, File outfile, boolean close) throws IOException
infile
- file to copyoutfile
- file name/path to copy toclose
- flag to indicate closing the WriterIOException
- if something goes wrongpublic static void copyFile(BufferedReader is, PrintWriter os, boolean close) throws IOException
is
- the input stream reader of the inFileos
- the output stream that will write to the copied fileclose
- flag to indicate closing the WriterIOException
- if something goes wrongpublic static void moveFile(File from, File to) throws IOException
from
- the file to moveto
- the location (path/name) to move toIOException
- if something goes wrong