You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gary Gregory <ga...@gmail.com> on 2019/05/24 12:49:19 UTC

[IO] NullPrintStream

Hi All:

We have a handy NullOutputStream.

I'd like to add a convenience NullPrintStream, which would dead simple:

/**
 * This PrintStream writes all data to the famous <b>/dev/null</b>.
 * <p>
 * This print stream has no destination (file/socket etc.) and all bytes
written to it are ignored and lost.
 * </p>
 * @since 2.7
 */
public class NullPrintStream extends PrintStream {

    public static final NullPrintStream NULL_PRINT_STREAM = new
NullPrintStream();

    @SuppressWarnings("resource")
    public NullPrintStream() {
        super(new NullOutputStream());
    }

}

Any objections?

Gary

Re: [IO] NullPrintStream

Posted by Gary Gregory <ga...@gmail.com>.
Tracking https://issues.apache.org/jira/browse/IO-608

Gary

On Fri, May 24, 2019 at 10:29 AM Gary Gregory <ga...@gmail.com>
wrote:

> On Fri, May 24, 2019 at 9:38 AM Bruno P. Kinoshita <ki...@apache.org>
> wrote:
>
>>  Is it equivalent to JDK 11 Writer#nullWriter?
>>
>>
>> https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Writer.html#nullWriter()
>>
>> If so I'm -0, not a blocker, but I have on a Python project for about 1
>> year, catching up with the language and libraries, and lost track of JVM
>> release dates, EOL. But I think Java 11 will be LTS, and maybe others will
>> update to it quickly?
>>
>
> We get push back on updating from Java 7 to 8 (see Commons IO), so Java
> 11? Not in a long while...
>
> Gary
>
>
>>
>>
>> But if it's not doing the same as Writer#nullWriter, +0 (I don't have a
>> use case for it, but sounds OK/useful to others)
>>
>>
>> CheersBruno
>>
>>     On Saturday, 25 May 2019, 12:49:45 am NZST, Gary Gregory <
>> garydgregory@gmail.com> wrote:
>>
>>  Hi All:
>>
>> We have a handy NullOutputStream.
>>
>> I'd like to add a convenience NullPrintStream, which would dead simple:
>>
>> /**
>>  * This PrintStream writes all data to the famous <b>/dev/null</b>.
>>  * <p>
>>  * This print stream has no destination (file/socket etc.) and all bytes
>> written to it are ignored and lost.
>>  * </p>
>>  * @since 2.7
>>  */
>> public class NullPrintStream extends PrintStream {
>>
>>     public static final NullPrintStream NULL_PRINT_STREAM = new
>> NullPrintStream();
>>
>>     @SuppressWarnings("resource")
>>     public NullPrintStream() {
>>         super(new NullOutputStream());
>>     }
>>
>> }
>>
>> Any objections?
>>
>> Gary
>>
>
>

Re: [IO] NullPrintStream

Posted by Gary Gregory <ga...@gmail.com>.
On Fri, May 24, 2019 at 9:38 AM Bruno P. Kinoshita <ki...@apache.org> wrote:

>  Is it equivalent to JDK 11 Writer#nullWriter?
>
>
> https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Writer.html#nullWriter()
>
> If so I'm -0, not a blocker, but I have on a Python project for about 1
> year, catching up with the language and libraries, and lost track of JVM
> release dates, EOL. But I think Java 11 will be LTS, and maybe others will
> update to it quickly?
>

We get push back on updating from Java 7 to 8 (see Commons IO), so Java 11?
Not in a long while...

Gary


>
>
> But if it's not doing the same as Writer#nullWriter, +0 (I don't have a
> use case for it, but sounds OK/useful to others)
>
>
> CheersBruno
>
>     On Saturday, 25 May 2019, 12:49:45 am NZST, Gary Gregory <
> garydgregory@gmail.com> wrote:
>
>  Hi All:
>
> We have a handy NullOutputStream.
>
> I'd like to add a convenience NullPrintStream, which would dead simple:
>
> /**
>  * This PrintStream writes all data to the famous <b>/dev/null</b>.
>  * <p>
>  * This print stream has no destination (file/socket etc.) and all bytes
> written to it are ignored and lost.
>  * </p>
>  * @since 2.7
>  */
> public class NullPrintStream extends PrintStream {
>
>     public static final NullPrintStream NULL_PRINT_STREAM = new
> NullPrintStream();
>
>     @SuppressWarnings("resource")
>     public NullPrintStream() {
>         super(new NullOutputStream());
>     }
>
> }
>
> Any objections?
>
> Gary
>

Re: [IO] NullPrintStream

Posted by "Bruno P. Kinoshita" <ki...@apache.org>.
 Is it equivalent to JDK 11 Writer#nullWriter?

https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Writer.html#nullWriter()

If so I'm -0, not a blocker, but I have on a Python project for about 1 year, catching up with the language and libraries, and lost track of JVM release dates, EOL. But I think Java 11 will be LTS, and maybe others will update to it quickly?


But if it's not doing the same as Writer#nullWriter, +0 (I don't have a use case for it, but sounds OK/useful to others)


CheersBruno

    On Saturday, 25 May 2019, 12:49:45 am NZST, Gary Gregory <ga...@gmail.com> wrote:  
 
 Hi All:

We have a handy NullOutputStream.

I'd like to add a convenience NullPrintStream, which would dead simple:

/**
 * This PrintStream writes all data to the famous <b>/dev/null</b>.
 * <p>
 * This print stream has no destination (file/socket etc.) and all bytes
written to it are ignored and lost.
 * </p>
 * @since 2.7
 */
public class NullPrintStream extends PrintStream {

    public static final NullPrintStream NULL_PRINT_STREAM = new
NullPrintStream();

    @SuppressWarnings("resource")
    public NullPrintStream() {
        super(new NullOutputStream());
    }

}

Any objections?

Gary