| java.lang.Object java.io.Writer org.apache.commons.io.output.LockableFileWriter
LockableFileWriter | public class LockableFileWriter extends Writer (Code) | | FileWriter that will create and honor lock files to allow simple
cross thread file lock handling.
This class provides a simple alternative to FileWriter
that will use a lock file to prevent duplicate writes.
By default, the file will be overwritten, but this may be changed to append.
The lock directory may be specified, but defaults to the system property
java.io.tmpdir .
The encoding may also be specified, and defaults to the platform default.
author: Scott Sanders author: Michael Salmon author: Jon S. Stevens author: Daniel Rall author: Stephen Colebourne author: Andy Lehane version: $Id: LockableFileWriter.java 437567 2006-08-28 06:39:07Z bayard $ |
Constructor Summary | |
public | LockableFileWriter(String fileName) Constructs a LockableFileWriter. | public | LockableFileWriter(String fileName, boolean append) Constructs a LockableFileWriter. | public | LockableFileWriter(String fileName, boolean append, String lockDir) Constructs a LockableFileWriter. | public | LockableFileWriter(File file) Constructs a LockableFileWriter. | public | LockableFileWriter(File file, boolean append) Constructs a LockableFileWriter. | public | LockableFileWriter(File file, boolean append, String lockDir) Constructs a LockableFileWriter. | public | LockableFileWriter(File file, String encoding) Constructs a LockableFileWriter with a file encoding. | public | LockableFileWriter(File file, String encoding, boolean append, String lockDir) Constructs a LockableFileWriter with a file encoding. |
Method Summary | |
public void | close() Closes the file writer. | public void | flush() | public void | write(int idx) | public void | write(char[] chr) | public void | write(char[] chr, int st, int end) | public void | write(String str) | public void | write(String str, int st, int end) |
LockableFileWriter | public LockableFileWriter(String fileName) throws IOException(Code) | | Constructs a LockableFileWriter.
If the file exists, it is overwritten.
Parameters: fileName - the file to write to, not null throws: NullPointerException - if the file is null throws: IOException - in case of an I/O error |
LockableFileWriter | public LockableFileWriter(String fileName, boolean append) throws IOException(Code) | | Constructs a LockableFileWriter.
Parameters: fileName - file to write to, not null Parameters: append - true if content should be appended, false to overwrite throws: NullPointerException - if the file is null throws: IOException - in case of an I/O error |
LockableFileWriter | public LockableFileWriter(String fileName, boolean append, String lockDir) throws IOException(Code) | | Constructs a LockableFileWriter.
Parameters: fileName - the file to write to, not null Parameters: append - true if content should be appended, false to overwrite Parameters: lockDir - the directory in which the lock file should be held throws: NullPointerException - if the file is null throws: IOException - in case of an I/O error |
LockableFileWriter | public LockableFileWriter(File file) throws IOException(Code) | | Constructs a LockableFileWriter.
If the file exists, it is overwritten.
Parameters: file - the file to write to, not null throws: NullPointerException - if the file is null throws: IOException - in case of an I/O error |
LockableFileWriter | public LockableFileWriter(File file, boolean append) throws IOException(Code) | | Constructs a LockableFileWriter.
Parameters: file - the file to write to, not null Parameters: append - true if content should be appended, false to overwrite throws: NullPointerException - if the file is null throws: IOException - in case of an I/O error |
LockableFileWriter | public LockableFileWriter(File file, boolean append, String lockDir) throws IOException(Code) | | Constructs a LockableFileWriter.
Parameters: file - the file to write to, not null Parameters: append - true if content should be appended, false to overwrite Parameters: lockDir - the directory in which the lock file should be held throws: NullPointerException - if the file is null throws: IOException - in case of an I/O error |
LockableFileWriter | public LockableFileWriter(File file, String encoding) throws IOException(Code) | | Constructs a LockableFileWriter with a file encoding.
Parameters: file - the file to write to, not null Parameters: encoding - the encoding to use, null means platform default throws: NullPointerException - if the file is null throws: IOException - in case of an I/O error |
LockableFileWriter | public LockableFileWriter(File file, String encoding, boolean append, String lockDir) throws IOException(Code) | | Constructs a LockableFileWriter with a file encoding.
Parameters: file - the file to write to, not null Parameters: encoding - the encoding to use, null means platform default Parameters: append - true if content should be appended, false to overwrite Parameters: lockDir - the directory in which the lock file should be held throws: NullPointerException - if the file is null throws: IOException - in case of an I/O error |
|
|