|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
java.io.FilterOutputStream
de.schlichtherle.io.FileOutputStream
public class FileOutputStream
A drop-in replacement for FileOutputStream
which
provides transparent write access to archive entries as if they were
(virtual) files.
All file system operations in this class are
virtually atomic.
To prevent exceptions to be thrown subsequently, client applications should always close their streams using the following idiom:
FileOutputStream fos = new FileOutputStream(file);
try {
// access fos here
} finally {
fos.close();
}
Note that for various (mostly archive driver specific) reasons, the
close()
method may throw an IOException
, too.
Client applications need to deal with this appropriately, for example
by enclosing the entire block with another try-catch
-block.
Client applications cannot write to an entry in an archive file if an
automatic update is required but cannot get performed because other
FileInputStream
or FileOutputStream
instances
haven't been closed or garbage collected yet.
A FileBusyException
is thrown by the constructors of this class
in this case.
Whether or not a client application can write to more than one entry in the same archive archive file concurrently is an implementation detail of the respective archive driver. As of version 6.5, all archive drivers provided by TrueZIP don't restrict this. However, custom archive drivers provided by third parties may do so.
If a client application tries to exceed the number of entry streams
supported to operate on the same archive file concurrently, a
FileBusyException
is thrown by the constructors of this class.
If you would like to use this class in order to copy files,
please consider using the *copy*
methods in the File
class instead.
These methods provide ease of use, enhanced features, superior performance
and require less space in the temp file folder.
FileBusyException
,
File.cat(java.io.InputStream, java.io.OutputStream)
,
File.umount()
,
File.update()
,
File.setLenient(boolean)
Field Summary |
---|
Fields inherited from class java.io.FilterOutputStream |
---|
out |
Constructor Summary | |
---|---|
FileOutputStream(File file)
Behaves like the super class, but also supports archive entry files. |
|
FileOutputStream(File file,
boolean append)
Behaves like the super class, but also supports archive entry files. |
|
FileOutputStream(FileDescriptor fd)
Behaves like the super class. |
|
FileOutputStream(String name)
Behaves like the super class, but also supports archive entry files. |
|
FileOutputStream(String name,
boolean append)
Behaves like the super class, but also supports archive entry files. |
Method Summary | |
---|---|
void |
write(byte[] buf,
int off,
int len)
|
Methods inherited from class java.io.FilterOutputStream |
---|
close, flush, write, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileOutputStream(String name) throws FileNotFoundException
FileBusyException
- If the path denotes an archive entry and the
archive driver does not support to create an additional output
stream for the archive file.
FileNotFoundException
- On any other I/O related issue.public FileOutputStream(String name, boolean append) throws FileNotFoundException
FileBusyException
- If the path denotes an archive entry and the
archive driver does not support to create an additional output
stream for the archive file.
FileNotFoundException
- On any other I/O related issue.public FileOutputStream(File file) throws FileNotFoundException
FileBusyException
- If the path denotes an archive entry and the
archive driver does not support to create an additional output
stream for the archive file.
FileNotFoundException
- On any other I/O related issue.public FileOutputStream(File file, boolean append) throws FileNotFoundException
FileBusyException
- If the path denotes an archive entry and the
archive driver does not support to create an additional output
stream for the archive file.
FileNotFoundException
- On any other I/O related issue.public FileOutputStream(FileDescriptor fd)
FileBusyException
- If the path denotes an archive entry and the
archive driver does not support to create an additional output
stream for the archive file.Method Detail |
---|
public void write(byte[] buf, int off, int len) throws IOException
write
in class FilterOutputStream
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |