Class BlankLinesWriter.NewLinesHandler

  • Enclosing class:
    BlankLinesWriter

    private class BlankLinesWriter.NewLinesHandler
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int newLinesCount  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private NewLinesHandler()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void finished()
      Marks the end of token streams, allows to emit a last newlines if the last tokens were all newlines.
      private boolean processToken​(java.lang.String token, boolean hasMoreTokens)
      Processes the token, counting the newlines and producing at most one in output.
      • Methods inherited from class java.lang.Object

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

      • newLinesCount

        private int newLinesCount
    • Constructor Detail

      • NewLinesHandler

        private NewLinesHandler()
    • Method Detail

      • processToken

        private boolean processToken​(java.lang.String token,
                                     boolean hasMoreTokens)
                              throws java.io.IOException
        Processes the token, counting the newlines and producing at most one in output.
        Parameters:
        token - The token to be written
        hasMoreTokens - Does more tokens exist
        Returns:
        True if the token needs to be skipped (it's a newline or a set of newlines)
        Throws:
        java.io.IOException - If an I/O error occurs.
      • finished

        private void finished()
                       throws java.io.IOException
        Marks the end of token streams, allows to emit a last newlines if the last tokens were all newlines.
        Throws:
        java.io.IOException - If an I/O error occurs.