Package com.sun.xfile
Class XFileOutputStream
java.lang.Object
java.io.OutputStream
com.sun.xfile.XFileOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
An XFile output stream is an output stream for writing data to an
XFile
.-
Constructor Summary
ConstructorsConstructorDescriptionXFileOutputStream
(XFile xfile) Creates an XFile output stream to write to the specifiedXFile
object.XFileOutputStream
(XFile xfile, boolean append) Creates an output file for the specified XFile object.XFileOutputStream
(String name) Creates an output XFile stream to write to the file with the specified name.XFileOutputStream
(String name, boolean append) Creates an output file with the specified name or URL. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes this file output stream, flushes any buffered, unwritten data, and releases any system resources associated with this stream.protected void
finalize()
Ensures that theclose
method of this XFile output stream is called when there are no more references to this stream.void
flush()
Flushes this output stream and forces any buffered output bytes to be written out.void
write
(byte[] b) Writesb.length
bytes from the specified byte array to this file output stream.void
write
(byte[] b, int off, int len) Writeslen
bytes from the specified byte array starting at offsetoff
to this XFile output stream.void
write
(int b) Writes the specified byte to this file output stream.Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
XFileOutputStream
Creates an XFile output stream to write to the specifiedXFile
object.- Parameters:
file
- the XFile to be opened for writing.- Throws:
IOException
- if the XFile could not be opened for writing.
-
XFileOutputStream
Creates an output XFile stream to write to the file with the specified name.- Parameters:
name
- the system-dependent filename.- Throws:
IOException
- if the file could not be opened for writing.
-
XFileOutputStream
Creates an output file for the specified XFile object.- Parameters:
xfile
- the XFile to be opened for writing.append
- true if writes begin at the end of the file- Throws:
IOException
- If the file is not found.
-
XFileOutputStream
Creates an output file with the specified name or URL.- Parameters:
name
- the native name or URLappend
- true if writes begin at the end of the file- Throws:
IOException
- If the file is not found.
-
-
Method Details
-
write
Writes the specified byte to this file output stream.- Specified by:
write
in classOutputStream
- Parameters:
b
- the byte to be written.- Throws:
IOException
- if an I/O error occurs.
-
write
Writesb.length
bytes from the specified byte array to this file output stream.- Overrides:
write
in classOutputStream
- Parameters:
b
- the data.- Throws:
IOException
- if an I/O error occurs.
-
write
Writeslen
bytes from the specified byte array starting at offsetoff
to this XFile output stream.- Overrides:
write
in classOutputStream
- Parameters:
b
- the data.off
- the start offset in the data.len
- the number of bytes to write.- Throws:
IOException
- if an I/O error occurs.
-
flush
Flushes this output stream and forces any buffered output bytes to be written out.- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
- if an I/O error occurs.
-
close
Closes this file output stream, flushes any buffered, unwritten data, and releases any system resources associated with this stream. After the file is closed further I/O operations may throw IOException.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
- if an I/O error occurs.
-
finalize
Ensures that theclose
method of this XFile output stream is called when there are no more references to this stream.- Overrides:
finalize
in classObject
- Throws:
IOException
- if an I/O error occurs.- See Also:
-