Class ServiceLogColoredPrintStream

    • Method Detail

      • getTokens

        protected List<byte[]> getTokens​(byte[] buf,
                                         int off,
                                         int len)
                                  throws IOException
        Splits the current buffer into tokens; the criteria for splitting consists in considering each new line as a token and everything else as another token. If we have e.g.: "AAAA\nBBBB", we would have 3 tokens: "AAAA","\n","BBBB"; Note that a buffer not containing any new line is considered a single token e.g. buffer "AAAA" is considered as the single token "AAAA"
        Parameters:
        buf - the data.
        off - the start offset in the data.
        len - the number of bytes to write.
        Returns:
        the list of tokens in the data; joining the tokens you get the original data.
        Throws:
        IOException - in case something goes wrong while managing streams internally
      • write

        public void write​(byte[] buf,
                          int off,
                          int len)
        Prints the data with properly colored background and foreground; takes care of adding a line header to each line
        Overrides:
        write in class PrintStream
        Parameters:
        buf - the data.
        off - the start offset in the data.
        len - the number of bytes to write.