|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.io.Writer
org.apache.commons.io.output.LockableFileWriter
FileWriter that will create and honor lock files to allow simple
cross thread file lock handling. If Writer attributes
are unspecified, the default behavior is to overwrite (rather than
to append), and to use the value of the system property
java.io.tmpdir for the lock file directory.
| Field Summary | |
private boolean |
append
|
private static java.lang.String |
LCK
|
private java.io.File |
lockFile
|
private java.io.FileWriter |
writer
|
| Fields inherited from class java.io.Writer |
lock |
| Constructor Summary | |
LockableFileWriter(java.io.File file)
Constructs a LockableFileWriter. |
|
LockableFileWriter(java.io.File file,
boolean append)
Constructs a LockableFileWriter. |
|
LockableFileWriter(java.io.File file,
boolean append,
java.lang.String lockDir)
Constructs a LockableFileWriter. |
|
LockableFileWriter(java.lang.String fileName)
Constructs a LockableFileWriter. |
|
LockableFileWriter(java.lang.String fileName,
boolean append)
Constructs a LockableFileWriter. |
|
LockableFileWriter(java.lang.String fileName,
boolean append,
java.lang.String lockDir)
Constructs a LockableFileWriter. |
|
| Method Summary | |
void |
close()
|
private void |
createLock()
|
void |
flush()
|
private void |
testLockDir(java.io.File lockDir)
|
void |
write(char[] cbuf,
int off,
int len)
|
| Methods inherited from class java.io.Writer |
write, write, write, write |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static final java.lang.String LCK
private java.io.File lockFile
private java.io.FileWriter writer
private boolean append
| Constructor Detail |
public LockableFileWriter(java.lang.String fileName)
throws java.io.IOException
fileName - file to write to
java.io.IOException - in case of an I/O error
public LockableFileWriter(java.lang.String fileName,
boolean append)
throws java.io.IOException
fileName - file to write toappend - true if content should be appended (default is to overwrite).
java.io.IOException - in case of an I/O error
public LockableFileWriter(java.lang.String fileName,
boolean append,
java.lang.String lockDir)
throws java.io.IOException
fileName - file to write toappend - true if content should be appended (default is to overwrite).lockDir - Specifies the directory in which the lock file should be held.
java.io.IOException - in case of an I/O error
public LockableFileWriter(java.io.File file)
throws java.io.IOException
file - file to write to
java.io.IOException - in case of an I/O error
public LockableFileWriter(java.io.File file,
boolean append)
throws java.io.IOException
file - file to write toappend - true if content should be appended (default is to overwrite).
java.io.IOException - in case of an I/O error
public LockableFileWriter(java.io.File file,
boolean append,
java.lang.String lockDir)
throws java.io.IOException
file - file to write toappend - true if content should be appended (default is to overwrite).lockDir - Specifies the directory in which the lock file should be held.
java.io.IOException - in case of an I/O error| Method Detail |
private void testLockDir(java.io.File lockDir)
throws java.io.IOException
java.io.IOException
private void createLock()
throws java.io.IOException
java.io.IOException
public void close()
throws java.io.IOException
java.io.IOExceptionWriter.close()
public void write(char[] cbuf,
int off,
int len)
throws java.io.IOException
java.io.IOExceptionWriter.write(char[], int, int)
public void flush()
throws java.io.IOException
java.io.IOExceptionWriter.flush()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||