Class PrintWriter_limited

java.lang.Object
java.io.Writer
java.io.PrintWriter
eu.bandm.tools.util.files.PrintWriter_limited
All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable

@PropertyDependency("line.separator") public class PrintWriter_limited extends PrintWriter
Prints only the n first characters and igores the rest. Useful in debugging for printing the prefix of a structure dump which would otherwise be (ergonomically) too large for the context. (For instance, whole tdom dumps, of which only the head information needs to be readable.) Since needed for interactive use, the os's default encoding is appropriate.
  • Field Details

    • LS

      public static final String LS
      Public cache for the os-dependent line-separator string, as retrieved by System.getProperty("line.separator").
    • count

      protected int count
      Internal counter of characters.
    • maxcount

      protected final int maxcount
      Limit on characters.
    • fin

      protected boolean fin
      Flag that limit has been reached.
  • Constructor Details

    • PrintWriter_limited

      public PrintWriter_limited(PrintWriter out, int maxcount)
      Constructor setting the target of the prints and the limit in character count. Uses the os's default encoding.
  • Method Details