Module de.carne.mcd
Package de.carne.mcd

Class PlainMCDOutput

  • All Implemented Interfaces:
    MCDOutput, java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public class PlainMCDOutput
    extends java.lang.Object
    implements MCDOutput, java.io.Closeable, java.io.Flushable
    MCDOutput implementation which emits the decoded to data to a PrintWriter or PrintStream.
    • Constructor Detail

      • PlainMCDOutput

        public PlainMCDOutput​(java.io.Writer out,
                              boolean autoClose)
        Constructs a new MCDOutput instance.
        Parameters:
        out - the Writer to emit the decoded data to.
        autoClose - whether to automatically close the PrintWriter when this channel is closed.
      • PlainMCDOutput

        public PlainMCDOutput​(java.io.PrintStream ps,
                              boolean autoClose)
        Constructs a new MCDOutput instance.
        Parameters:
        ps - the PrintStream to emit the decoded data to.
        autoClose - whether to automatically close the PrintWriter when this channel is closed.
      • PlainMCDOutput

        public PlainMCDOutput​(java.nio.channels.WritableByteChannel channel,
                              boolean autoClose)
        Constructs a new MCDOutput instance.
        Parameters:
        channel - the WritableByteChannel to emit the decoded data to.
        autoClose - whether to automatically close the PrintWriter when this channel is closed.
    • Method Detail

      • flush

        public void flush()
                   throws java.io.IOException
        Specified by:
        flush in interface java.io.Flushable
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • increaseIndent

        public @NonNull MCDOutput increaseIndent()
                                          throws java.io.IOException
        Description copied from interface: MCDOutput
        Increases the indent level of all following print calls:
        Specified by:
        increaseIndent in interface MCDOutput
        Returns:
        this instance for chaining.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • decreaseIndent

        public @NonNull MCDOutput decreaseIndent()
                                          throws java.io.IOException
        Description copied from interface: MCDOutput
        Decreases the indent level of all following print calls:
        Specified by:
        decreaseIndent in interface MCDOutput
        Returns:
        this instance for chaining.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • println

        public MCDOutput println()
                          throws java.io.IOException
        Description copied from interface: MCDOutput
        Prints a line break.
        Specified by:
        println in interface MCDOutput
        Returns:
        this instance for chaining.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • print

        public MCDOutput print​(java.lang.String text)
                        throws java.io.IOException
        Description copied from interface: MCDOutput
        Prints a standard text.
        Specified by:
        print in interface MCDOutput
        Parameters:
        text - the text to print.
        Returns:
        this instance for chaining.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • println

        public MCDOutput println​(java.lang.String text)
                          throws java.io.IOException
        Description copied from interface: MCDOutput
        Prints a standard text and a line break.
        Specified by:
        println in interface MCDOutput
        Parameters:
        text - the text to print.
        Returns:
        this instance for chaining.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • printValue

        public MCDOutput printValue​(java.lang.String value)
                             throws java.io.IOException
        Description copied from interface: MCDOutput
        Prints a value text.
        Specified by:
        printValue in interface MCDOutput
        Parameters:
        value - the text to print.
        Returns:
        this instance for chaining.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • printlnValue

        public MCDOutput printlnValue​(java.lang.String value)
                               throws java.io.IOException
        Description copied from interface: MCDOutput
        Prints a value text and a line break.
        Specified by:
        printlnValue in interface MCDOutput
        Parameters:
        value - the text to print.
        Returns:
        this instance for chaining.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • printComment

        public MCDOutput printComment​(java.lang.String comment)
                               throws java.io.IOException
        Description copied from interface: MCDOutput
        Prints a comment text.
        Specified by:
        printComment in interface MCDOutput
        Parameters:
        comment - the text to print.
        Returns:
        this instance for chaining.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • printlnComment

        public MCDOutput printlnComment​(java.lang.String comment)
                                 throws java.io.IOException
        Description copied from interface: MCDOutput
        Prints a comment text and a line break.
        Specified by:
        printlnComment in interface MCDOutput
        Parameters:
        comment - the text to print.
        Returns:
        this instance for chaining.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • printKeyword

        public MCDOutput printKeyword​(java.lang.String keyword)
                               throws java.io.IOException
        Description copied from interface: MCDOutput
        Prints a keyword text.
        Specified by:
        printKeyword in interface MCDOutput
        Parameters:
        keyword - the text to print.
        Returns:
        this instance for chaining.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • printlnKeyword

        public MCDOutput printlnKeyword​(java.lang.String keyword)
                                 throws java.io.IOException
        Description copied from interface: MCDOutput
        Prints a keyword text and a line break.
        Specified by:
        printlnKeyword in interface MCDOutput
        Parameters:
        keyword - the text to print.
        Returns:
        this instance for chaining.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • printOperator

        public MCDOutput printOperator​(java.lang.String operator)
                                throws java.io.IOException
        Description copied from interface: MCDOutput
        Prints an operator text.
        Specified by:
        printOperator in interface MCDOutput
        Parameters:
        operator - the text to print.
        Returns:
        this instance for chaining.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • printlnOperator

        public MCDOutput printlnOperator​(java.lang.String operator)
                                  throws java.io.IOException
        Description copied from interface: MCDOutput
        Prints an operator text and a line break.
        Specified by:
        printlnOperator in interface MCDOutput
        Parameters:
        operator - the text to print.
        Returns:
        this instance for chaining.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • printLabel

        public MCDOutput printLabel​(java.lang.String label)
                             throws java.io.IOException
        Description copied from interface: MCDOutput
        Prints a label text.
        Specified by:
        printLabel in interface MCDOutput
        Parameters:
        label - the text to print.
        Returns:
        this instance for chaining.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • printlnLabel

        public MCDOutput printlnLabel​(java.lang.String label)
                               throws java.io.IOException
        Description copied from interface: MCDOutput
        Prints a label text and a line break.
        Specified by:
        printlnLabel in interface MCDOutput
        Parameters:
        label - the text to print.
        Returns:
        this instance for chaining.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • printError

        public MCDOutput printError​(java.lang.String error)
                             throws java.io.IOException
        Description copied from interface: MCDOutput
        Prints an error text.
        Specified by:
        printError in interface MCDOutput
        Parameters:
        error - the text to print.
        Returns:
        this instance for chaining.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • printlnError

        public MCDOutput printlnError​(java.lang.String error)
                               throws java.io.IOException
        Description copied from interface: MCDOutput
        Prints an error text and a line break.
        Specified by:
        printlnError in interface MCDOutput
        Parameters:
        error - the text to print.
        Returns:
        this instance for chaining.
        Throws:
        java.io.IOException - if an I/O error occurs.