com.ibm.as400.access

Class SCS5256Writer

  • java.lang.Object
    • java.io.Writer
      • java.io.OutputStreamWriter
        • com.ibm.as400.access.SCS5256Writer
  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.Appendable
    Direct Known Subclasses:
    SCS5224Writer


    public class SCS5256Writer
    extends java.io.OutputStreamWriter
    The SCS5256Writer class writes an SCS 5256 data stream to an output stream, translating characters into bytes of the specified CCSID. SCS5256Writer is the simplest SCS generator. It supports text, carriage return, line feed, new line, form feed, Absolute Horiz/Vert positioning, Relative Horiz/Vert positioning, and Set Vertical Format.
    Version:
    1.1
    See Also:
    OutputStreamWriter
    • Field Summary

      • Fields inherited from class java.io.Writer

        lock
    • Constructor Summary

      Constructors 
      Constructor and Description
      SCS5256Writer(java.io.OutputStream out)
      Deprecated. 
      Replaced by SCS5256Writer(OutputStream, int, AS400). Any SCS5256Writer object that is created without specifying an AS400 system object on its constructor may not behave as expected in certain environments.
      SCS5256Writer(java.io.OutputStream out, int ccsid)
      Deprecated. 
      Replaced by SCS5256Writer(OutputStream, int, AS400). Any SCS5256Writer object that is created without specifying an AS400 system object on its constructor may not behave as expected in certain environments.
      SCS5256Writer(java.io.OutputStream out, int ccsid, AS400 system)
      Constructs a SCS5256Writer.
      SCS5256Writer(java.io.OutputStream out, java.lang.String encoding)
      Deprecated. 
      Replaced by SCS5256Writer(OutputStream, int, AS400). Any SCS5256Writer object that is created without specifying an AS400 system object on its constructor may not behave as expected in certain environments.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void absoluteHorizontalPosition(int column)
      Moves the print position to the column specified.
      void absoluteVerticalPosition(int line)
      Moves the print position to the line number specified.
      void carriageReturn()
      Adds a carriage return control to the stream.
      void close()
      Closes the stream.
      void endPage()
      Ends current page.
      void flush()
      Flushes the stream.
      java.lang.String getEncoding()
      Returns the name of the encoding being used by this stream.
      void lineFeed()
      Adds a line feed control to the stream.
      void newLine()
      Adds a new line control to the stream.
      void relativeHorizontalPosition(int chars)
      Moves the print position the number of characters specified.
      void relativeVerticalPosition(int lines)
      Moves the print position the number of lines specified.
      void setHorizontalFormat(int NumOfChars)
      Sets the Horizontal Format.
      void setVerticalFormat(int NumOfLines)
      Sets the Vertical Format.
      void write(char[] databuffer, int offset, int length)
      Writes a portion of an array of characters.
      void write(int c)
      Writes a single character.
      void write(java.lang.String str)
      Writes a string.
      void write(java.lang.String str, int offset, int length)
      Writes a portion of a string.
      • Methods inherited from class java.io.Writer

        append, append, append, write
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SCS5256Writer

        public SCS5256Writer(java.io.OutputStream out)
        Deprecated. Replaced by SCS5256Writer(OutputStream, int, AS400). Any SCS5256Writer object that is created without specifying an AS400 system object on its constructor may not behave as expected in certain environments.
        Constructs a SCS5256Writer. The default encoding will be used.
        Parameters:
        out - An OutputStream.
      • SCS5256Writer

        public SCS5256Writer(java.io.OutputStream out,
                     int ccsid)
                      throws java.io.UnsupportedEncodingException
        Deprecated. Replaced by SCS5256Writer(OutputStream, int, AS400). Any SCS5256Writer object that is created without specifying an AS400 system object on its constructor may not behave as expected in certain environments.
        Constructs a SCS5256Writer.
        Parameters:
        out - An OutputStream.
        ccsid - The name of the target CCSID to be used.
        Throws:
        java.io.UnsupportedEncodingException - If ccsid is invalid.
      • SCS5256Writer

        public SCS5256Writer(java.io.OutputStream out,
                     int ccsid,
                     AS400 system)
                      throws java.io.UnsupportedEncodingException
        Constructs a SCS5256Writer.
        Parameters:
        out - An OutputStream.
        ccsid - The name of the target CCSID to be used.
        system - The system.
        Throws:
        java.io.UnsupportedEncodingException - If ccsid is invalid.
      • SCS5256Writer

        public SCS5256Writer(java.io.OutputStream out,
                     java.lang.String encoding)
                      throws java.io.UnsupportedEncodingException
        Deprecated. Replaced by SCS5256Writer(OutputStream, int, AS400). Any SCS5256Writer object that is created without specifying an AS400 system object on its constructor may not behave as expected in certain environments.
        Constructs a SCS5256Writer.
        Parameters:
        out - An OutputStream.
        encoding - The name of the target encoding to be used.
        Throws:
        java.io.UnsupportedEncodingException - If encoding is invalid.
    • Method Detail

      • absoluteHorizontalPosition

        public void absoluteHorizontalPosition(int column)
                                        throws java.io.IOException
        Moves the print position to the column specified. Moving beyond the right end of the page will cause an error on the printer.
        Parameters:
        column - The new horizontal print position. Valid values are 0 to the maximum print position as set in the SetHorizontalFormat method. A value of 0 causes a no-op. The number of columns on a line is dependent on the current character width (CPI) and the width of the page.
        Throws:
        java.io.IOException - If an error occurs while communicating with the system.
      • absoluteVerticalPosition

        public void absoluteVerticalPosition(int line)
                                      throws java.io.IOException
        Moves the print position to the line number specified. Moving above the current line causes a form feed and move to the specified line on the next page.
        Parameters:
        line - The new vertical print position. Valid values are 0 to the current forms length as specified by the SetVerticalFormat method. A value of 0 causes a no-op. If the value is less than the current line, the forms are moved to the specified line of the next logical page.
        Throws:
        java.io.IOException - If an error occurs while communicating with the system.
      • carriageReturn

        public void carriageReturn()
                            throws java.io.IOException
        Adds a carriage return control to the stream.
        Throws:
        java.io.IOException - If an error occurs while communicating with the system.
      • close

        public void close()
                   throws java.io.IOException
        Closes the stream.
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.OutputStreamWriter
        Throws:
        java.io.IOException - If an error occurs while communicating with the system.
      • endPage

        public void endPage()
                     throws java.io.IOException
        Ends current page. The application MUST use this method to end the current page after the page data has been written.
        Throws:
        java.io.IOException - If an error occurs while communicating with the system.
      • flush

        public void flush()
                   throws java.io.IOException
        Flushes the stream.
        Specified by:
        flush in interface java.io.Flushable
        Overrides:
        flush in class java.io.OutputStreamWriter
        Throws:
        java.io.IOException - If an error occurs while communicating with the system.
      • getEncoding

        public java.lang.String getEncoding()
        Returns the name of the encoding being used by this stream. It may return null if the stream has been closed.
        Overrides:
        getEncoding in class java.io.OutputStreamWriter
      • lineFeed

        public void lineFeed()
                      throws java.io.IOException
        Adds a line feed control to the stream.
        Throws:
        java.io.IOException - If an error occurs while communicating with the system.
      • newLine

        public void newLine()
                     throws java.io.IOException
        Adds a new line control to the stream.
        Throws:
        java.io.IOException - If an error occurs while communicating with the system.
      • relativeHorizontalPosition

        public void relativeHorizontalPosition(int chars)
                                        throws java.io.IOException
        Moves the print position the number of characters specified. Moving beyond the right end of the page will cause an error on the printer.
        Parameters:
        chars - The number of character widths to move. Valid values are 0 to the maximum print position minus the current column. The maximum print position is the current CPI * 13.2 inches. A value of 0 causes a no-op.
        Throws:
        java.io.IOException - If an error occurs while communicating with the system.
      • relativeVerticalPosition

        public void relativeVerticalPosition(int lines)
                                      throws java.io.IOException
        Moves the print position the number of lines specified.
        Parameters:
        lines - The number of lines to move down the page. Valid values are 0 to the last logical line on the page. A value of 0 causes a no-op.
        Throws:
        java.io.IOException - If an error occurs while communicating with the system.
      • setHorizontalFormat

        public void setHorizontalFormat(int NumOfChars)
                                 throws java.io.IOException
        Sets the Horizontal Format. This specifies the maximum number of characters on the line.
        Parameters:
        NumOfChars - The maximum number of characters. Valid values are 0 to 255. A value of 0 causes horizontal format to be set to the printer default.
        Throws:
        java.io.IOException - If an error occurs while communicating with the system.
      • setVerticalFormat

        public void setVerticalFormat(int NumOfLines)
                               throws java.io.IOException
        Sets the Vertical Format. This specifies the maximum number of lines on the page. Note that when the printer executes this command the current line number on the printer is set to 1. Also, the combination of LPI and Vertical Format should not exceed 159 cm (63.75 inches). Changing the Line Density changes where the maximum line is on the physical page.
        Parameters:
        NumOfLines - The maximum number of lines. Valid values are 0 to 255. A value of 0 causes vertical format to be set to the printer default.
        Throws:
        java.io.IOException - If an error occurs while communicating with the system.
      • write

        public void write(char[] databuffer,
                 int offset,
                 int length)
                   throws java.io.IOException
        Writes a portion of an array of characters.
        Overrides:
        write in class java.io.OutputStreamWriter
        Parameters:
        databuffer - The buffer of characters.
        offset - The offset from which to start writing characters.
        length - The number of characters to write.
        Throws:
        java.io.IOException - If an error occurs while communicating with the system.
      • write

        public void write(int c)
                   throws java.io.IOException
        Writes a single character.
        Overrides:
        write in class java.io.OutputStreamWriter
        Parameters:
        c - The character to write.
        Throws:
        java.io.IOException - If an error occurs while communicating with the system.
      • write

        public void write(java.lang.String str)
                   throws java.io.IOException
        Writes a string.
        Overrides:
        write in class java.io.Writer
        Parameters:
        str - The string to write.
        Throws:
        java.io.IOException - If an error occurs while communicating with the system.
      • write

        public void write(java.lang.String str,
                 int offset,
                 int length)
                   throws java.io.IOException
        Writes a portion of a string.
        Overrides:
        write in class java.io.OutputStreamWriter
        Parameters:
        str - The string to write.
        offset - The offset from which to start writing characters.
        length - The number of characters to write.
        Throws:
        java.io.IOException - If an error occurs while communicating with the system.