Overview
Package
Class
Use
Tree
Deprecated
Index
All Classes
Help
Prev Class
Next Class
VUtils – Release 1
Interface org.violetlib.io.TransactionalUncheckedOutputStream
Inherited members: ShowHide
Deprecated: ShowHide
org.violetlib.io

Interface TransactionalUncheckedOutputStream

  • All Superinterfaces:
    AutoCloseable, Closeable, IOTransactional, Transactional, VUWriter
    public interface TransactionalUncheckedOutputStream extends VUWriter, IOTransactional
    A transactional output stream that throws runtime exceptions.

    This interface defines two methods that terminate a transactional output operation. These methods change the state of the transactional output stream to terminated. In the terminated state, invocations of these methods have no effect and invocations of output operations throw an IllegalStateException.

    The terminating methods are commit() and abort(). The commit method must be called after the intended contents have been written to make the contents available, for example, as a new file. Otherwise, the abort method must be called, both to ensure that temporary resources are released and to ensure that a subsequent invocation of commit(), even by accident, has no effect.

    The above description means that one may call commit() after calling abort() or call abort() after calling commit(); in either case, the second method invocation will have no effect. Thus, it is possible and convenient to call commit() at the end of a try body and call abort() in a finally clause of the same try statement. Even more conveniently, if the transactional writer is created and used within a try-with-resources statement, no explicit invocation of abort() is required, because it will be called implicitly (as close() is defined to call abort()).

    • Static Methods 
      Modifier and Type Static Method and Description
      Inherited member indicator from Reveal DetailHide Detail
      static VUWriter from(Writer w)
       
      static VUWriter from(Writer w)
    • Methods 
      Modifier and Type Method and Description
      Ordinary member indicator abort Reveal DetailHide Detail
      abstract void abort()
      This method has no effect if the output stream has already been committed or aborted.
      void abort()
      This method has no effect if the output stream has already been committed or aborted. Otherwise, abort the output operation so that (if possible) no partial effects are visible.
      Specified by:
      abort in interface IOTransactional
      Specified by:
      abort in interface Transactional
      Inherited member indicator asPrintWriter Reveal DetailHide Detail
      PrintWriter asPrintWriter()
       
      PrintWriter asPrintWriter()
      Inherited member indicator asWriter Reveal DetailHide Detail
      Writer asWriter()
       
      Writer asWriter()
      Ordinary member indicator close Reveal DetailHide Detail
      void close()
      The close method is defined to invoke the abort method.
      void close() throws IORuntimeException
      The close method is defined to invoke the abort method. This behavior allows a transactional output stram to be used in a try-with-resources statement with no explicit invocation of abort().
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface IOTransactional
      Specified by:
      close in interface Transactional
      Throws:
      IORuntimeException
      Ordinary member indicator commit Reveal DetailHide Detail
      abstract void commit()
      This method has no effect if the output stream has already been committed or aborted.
      void commit() throws IORuntimeException
      This method has no effect if the output stream has already been committed or aborted. Otherwise, make the previously written contents available as appropriate, for example, in a new file.
      Specified by:
      commit in interface IOTransactional
      Specified by:
      commit in interface Transactional
      Throws:
      IORuntimeException - if the attempt to make the contents available failed.
      Inherited member indicator flush Reveal DetailHide Detail
      abstract void flush()
       
      void flush() throws IORuntimeException
      Inherited member indicator newLine Reveal DetailHide Detail
      abstract void newLine()
       
      void newLine() throws IORuntimeException
      Inherited member indicator write Reveal DetailHide Detail
      abstract void write(char ch)
       
      void write(char ch) throws IORuntimeException
      Inherited member indicator write Reveal DetailHide Detail
      abstract void write(String s)
       
      void write(String s) throws IORuntimeException
      Inherited member indicator writeln Reveal DetailHide Detail
      void writeln()
       
      void writeln() throws IORuntimeException
      Inherited member indicator writeln Reveal DetailHide Detail
      void writeln(String s)
       
      void writeln(String s) throws IORuntimeException