Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-608

Add a convenience NullPrintStream

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.7
    • Streams/Writers
    • None

    Description

      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());
          }
      
      }
      

      Attachments

        Activity

          People

            ggregory Gary D. Gregory
            ggregory Gary D. Gregory
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: