public class FileHandler extends OutputStreamHandler
Modifier and Type | Field and Description |
---|---|
private boolean |
append |
private java.io.File |
file |
outputLock
handlers, handlersUpdater
Constructor and Description |
---|
FileHandler()
Construct a new instance with no formatter and no output file.
|
FileHandler(java.io.File file)
Construct a new instance with the given output file.
|
FileHandler(java.io.File file,
boolean append)
Construct a new instance with the given output file and append setting.
|
FileHandler(java.util.logging.Formatter formatter)
Construct a new instance with the given formatter and no output file.
|
FileHandler(java.util.logging.Formatter formatter,
java.io.File file)
Construct a new instance with the given formatter and output file.
|
FileHandler(java.util.logging.Formatter formatter,
java.io.File file,
boolean append)
Construct a new instance with the given formatter, output file, and append setting.
|
FileHandler(java.lang.String fileName)
Construct a new instance with the given output file.
|
FileHandler(java.lang.String fileName,
boolean append)
Construct a new instance with the given output file and append setting.
|
Modifier and Type | Method and Description |
---|---|
java.io.File |
getFile()
Get the current output file.
|
void |
setAppend(boolean append)
Specify whether to append to the target file.
|
void |
setFile(java.io.File file)
Set the output file.
|
void |
setFileName(java.lang.String fileName)
Set the output file by name.
|
getEncoding, setEncoding, setOutputStream, setWriter
close, doPublish, flush, preWrite, safeClose
addHandler, checkAccess, checkAccess, clearHandlers, disableAccess, enableAccess, getHandlers, isAutoFlush, isEnabled, protect, publish, publish, removeHandler, setAutoFlush, setEnabled, setErrorManager, setFilter, setFormatter, setHandlers, setLevel, unprotect
public FileHandler()
public FileHandler(java.util.logging.Formatter formatter)
formatter
- the formatterpublic FileHandler(java.util.logging.Formatter formatter, java.io.File file) throws java.io.FileNotFoundException
formatter
- the formatterfile
- the filejava.io.FileNotFoundException
- if the file could not be found on openpublic FileHandler(java.util.logging.Formatter formatter, java.io.File file, boolean append) throws java.io.FileNotFoundException
formatter
- the formatterfile
- the fileappend
- true
to append, false
to overwritejava.io.FileNotFoundException
- if the file could not be found on openpublic FileHandler(java.io.File file) throws java.io.FileNotFoundException
file
- the filejava.io.FileNotFoundException
- if the file could not be found on openpublic FileHandler(java.io.File file, boolean append) throws java.io.FileNotFoundException
file
- the fileappend
- true
to append, false
to overwritejava.io.FileNotFoundException
- if the file could not be found on openpublic FileHandler(java.lang.String fileName) throws java.io.FileNotFoundException
fileName
- the file namejava.io.FileNotFoundException
- if the file could not be found on openpublic FileHandler(java.lang.String fileName, boolean append) throws java.io.FileNotFoundException
fileName
- the file nameappend
- true
to append, false
to overwritejava.io.FileNotFoundException
- if the file could not be found on openpublic void setAppend(boolean append)
append
- true
to append, false
to overwritepublic void setFile(java.io.File file) throws java.io.FileNotFoundException
file
- the filejava.io.FileNotFoundException
- if an error occurs opening the filepublic java.io.File getFile()
public void setFileName(java.lang.String fileName) throws java.io.FileNotFoundException
fileName
- the file namejava.io.FileNotFoundException
- if an error occurs opening the file