<commit_before>//
// $Id: ExtensiblePrintStream.java,v 1.1 2002/10/16 19:09:02 shaper Exp $
//
// samskivert library - useful routines for java programs
// Copyright (C) 2002 <NAME>
// 
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

package com.samskivert.io;

import java.io.PrintStream;
import java.io.UnsupportedEncodingException;

/**
 * Wraps a supplied {@link PrintStream} to allow capturing all data
 * written to the stream via various <code>print()</code> and
 * <code>println()</code> variants.  Derived classes must implement the
 * {@link #handlePrinted} and {@link #handleNewLine} methods.
 */
public abstract class ExtensiblePrintStream extends PrintStream
{
    /**
     * Constructs an extensible print stream.
     */
    public ExtensiblePrintStream (PrintStream out)
    {
        super(out);
    }

    /**
     * Constructs an extensible print stream.
     */
    public ExtensiblePrintStream (PrintStream out, boolean autoFlush)
    {
        super(out, autoFlush);
    }

    /**
     * Constructs an extensible print stream.
     */
    public ExtensiblePrintStream (
        PrintStream out, boolean autoFlush, String encoding)
        throws UnsupportedEncodingException
    {
        super(out, autoFlush, encoding);
    }

    /**
     * Called with any text printed to the stream, excepting newlines
     * resulting from calls to the {@link #println} variants which are
     * reported via {@link #handleNewLine}.
     */
    public abstract void handlePrinted (String s);

    /**
     * Called whenever a newline is printed to the stream by one of the
     * {@link #println} variants.
     */
    public abstract void handleNewLine ();

    // documentation inherited
    public void print (boolean b)
    {
        super.print(b);<commit_msg>Minor javadoc edits.<commit_after>//
// $Id: ExtensiblePrintStream.java,v 1.2 2002/10/16 19:12:53 shaper Exp $
//
// samskivert library - useful routines for java programs
// Copyright (C) 2002 <NAME>
// 
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

package com.samskivert.io;

import java.io.PrintStream;
import java.io.UnsupportedEncodingException;

/**
 * Wraps a supplied {@link PrintStream} to allow capturing all data
 * written to the stream via the various <code>print()</code> and
 * <code>println()</code> variants.  Derived classes must implement the
 * {@link #handlePrinted} and {@link #handleNewLine} methods.
 */
public abstract class ExtensiblePrintStream extends PrintStream
{
    /**
     * Constructs an extensible print stream.
     */
    public ExtensiblePrintStream (PrintStream out)
    {
        super(out);
    }

    /**
     * Constructs an extensible print stream.
     */
    public ExtensiblePrintStream (PrintStream out, boolean autoFlush)
    {
        super(out, autoFlush);
    }

    /**
     * Constructs an extensible print stream.
     */
    public ExtensiblePrintStream (
        PrintStream out, boolean autoFlush, String encoding)
        throws UnsupportedEncodingException
    {
        super(out, autoFlush, encoding);
    }

    /**
     * Called with any text printed to the stream, excepting newlines
     * resulting from calls to the various <code>println()</code> methods,
     * which are reported via {@link #handleNewLine}.
     */
    public abstract void handlePrinted (String s);

    /**
     * Called whenever a newline is printed to the stream by one of the
     * various <code>println()</code> methods.
     */
    public abstract void handleNewLine ();

    // documentation inherited
    public void print (boolean b)
    {
        super.print(b);
{'fraction_non_alphanumeric': 0.08860249697946034, 'fraction_numerical': 0.01449859041482078, 'mean_word_length': 3.008878127522195, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4232233', 'n_tokens_mistral': 1388, 'n_tokens_neox': 1293, 'n_words': 556}