Documentation of 'org.freehep.util.io.LineNumberWriter' Java class
LineNumberWriter
org.freehep.util.io

Class LineNumberWriter

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


    public class LineNumberWriter
    extends java.io.Writer
    Counts line numbers, based on the first cr-lf, cr or lf it finds. Informs a listener when the linenumber exceeds a threshold. Listeners can only be informed from the second line only.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      static class  LineNumberWriter.LineNumberEvent
      Event to be used by the LineNumberListener interface.
      static interface  LineNumberWriter.LineNumberListener
      LineNumberListener interface can inform a listener about changes in the line number, or when a linenumber limit has been reached.
    • Constructor Summary

      Constructors 
      Constructor and Description
      LineNumberWriter(java.io.Writer out)
      Creates a Line Number Writer
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addLineNumberListener(LineNumberWriter.LineNumberListener listener, int lineNoLimit)
      Add a LineNumberListener
      void close() 
      void flush() 
      int getLineNumber()
      Returns the line number that is currently being written.
      void setLineNumber(int lineNo)
      Set the current line number
      void write(char[] cbuf) 
      void write(char[] cbuf, int off, int len) 
      void write(int c) 
      void write(java.lang.String str) 
      void write(java.lang.String str, int off, int len) 
      • Methods inherited from class java.io.Writer

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

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

      • LineNumberWriter

        public LineNumberWriter(java.io.Writer out)
        Creates a Line Number Writer
        Parameters:
        out - writer to write to
    • Method Detail

      • write

        public void write(char[] cbuf)
                   throws java.io.IOException
        Overrides:
        write in class java.io.Writer
        Throws:
        java.io.IOException
      • write

        public void write(char[] cbuf,
                          int off,
                          int len)
                   throws java.io.IOException
        Specified by:
        write in class java.io.Writer
        Throws:
        java.io.IOException
      • write

        public void write(java.lang.String str)
                   throws java.io.IOException
        Overrides:
        write in class java.io.Writer
        Throws:
        java.io.IOException
      • write

        public void write(java.lang.String str,
                          int off,
                          int len)
                   throws java.io.IOException
        Overrides:
        write in class java.io.Writer
        Throws:
        java.io.IOException
      • write

        public void write(int c)
                   throws java.io.IOException
        Overrides:
        write in class java.io.Writer
        Throws:
        java.io.IOException
      • close

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

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

        public int getLineNumber()
        Returns the line number that is currently being written.
        Returns:
        current line number
      • setLineNumber

        public void setLineNumber(int lineNo)
        Set the current line number
        Parameters:
        lineNo - new line number
      • addLineNumberListener

        public void addLineNumberListener(LineNumberWriter.LineNumberListener listener,
                                          int lineNoLimit)
                                   throws java.util.TooManyListenersException
        Add a LineNumberListener
        Parameters:
        listener - new listener
        lineNoLimit - line number for which to generate a LineNumberEvent
        Throws:
        java.util.TooManyListenersException - if there is more than one listener

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.