Package com.sun.xfile

Class XFileOutputStream

java.lang.Object
java.io.OutputStream
com.sun.xfile.XFileOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class XFileOutputStream extends OutputStream
An XFile output stream is an output stream for writing data to an XFile.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an XFile output stream to write to the specified XFile object.
    XFileOutputStream(XFile xfile, boolean append)
    Creates an output file for the specified XFile object.
    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 Type
    Method
    Description
    void
    Closes this file output stream, flushes any buffered, unwritten data, and releases any system resources associated with this stream.
    protected void
    Ensures that the close method of this XFile output stream is called when there are no more references to this stream.
    void
    Flushes this output stream and forces any buffered output bytes to be written out.
    void
    write(byte[] b)
    Writes b.length bytes from the specified byte array to this file output stream.
    void
    write(byte[] b, int off, int len)
    Writes len bytes from the specified byte array starting at offset off 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

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • XFileOutputStream

      public XFileOutputStream(XFile xfile) throws IOException
      Creates an XFile output stream to write to the specified XFile object.
      Parameters:
      file - the XFile to be opened for writing.
      Throws:
      IOException - if the XFile could not be opened for writing.
    • XFileOutputStream

      public XFileOutputStream(String name) throws IOException
      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

      public XFileOutputStream(XFile xfile, boolean append) throws IOException
      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

      public XFileOutputStream(String name, boolean append) throws IOException
      Creates an output file with the specified name or URL.
      Parameters:
      name - the native name or URL
      append - true if writes begin at the end of the file
      Throws:
      IOException - If the file is not found.
  • Method Details

    • write

      public void write(int b) throws IOException
      Writes the specified byte to this file output stream.
      Specified by:
      write in class OutputStream
      Parameters:
      b - the byte to be written.
      Throws:
      IOException - if an I/O error occurs.
    • write

      public void write(byte[] b) throws IOException
      Writes b.length bytes from the specified byte array to this file output stream.
      Overrides:
      write in class OutputStream
      Parameters:
      b - the data.
      Throws:
      IOException - if an I/O error occurs.
    • write

      public void write(byte[] b, int off, int len) throws IOException
      Writes len bytes from the specified byte array starting at offset off to this XFile output stream.
      Overrides:
      write in class OutputStream
      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

      public void flush() throws IOException
      Flushes this output stream and forces any buffered output bytes to be written out.

      Specified by:
      flush in interface Flushable
      Overrides:
      flush in class OutputStream
      Throws:
      IOException - if an I/O error occurs.
    • close

      public void close() throws IOException
      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 interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class OutputStream
      Throws:
      IOException - if an I/O error occurs.
    • finalize

      protected void finalize() throws IOException
      Ensures that the close method of this XFile output stream is called when there are no more references to this stream.
      Overrides:
      finalize in class Object
      Throws:
      IOException - if an I/O error occurs.
      See Also: