NullOutputStream.java

  1. /**
  2.  * Powerunit - A JDK1.8 test framework
  3.  * Copyright (C) 2014 Mathieu Boretti.
  4.  *
  5.  * This file is part of Powerunit
  6.  *
  7.  * Powerunit is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License as published by
  9.  * the Free Software Foundation, either version 3 of the License, or
  10.  * (at your option) any later version.
  11.  *
  12.  * Powerunit is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.  * GNU General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU General Public License
  18.  * along with Powerunit. If not, see <http://www.gnu.org/licenses/>.
  19.  */
  20. package ch.powerunit.rules.impl;

  21. import java.io.IOException;
  22. import java.io.OutputStream;

  23. /**
  24.  * This is a stream that does nothing.
  25.  *
  26.  * @author borettim
  27.  * @since 0.4.0
  28.  */
  29. public final class NullOutputStream extends OutputStream {

  30.     /*
  31.      * (non-Javadoc)
  32.      *
  33.      * @see java.io.OutputStream#write(int)
  34.      */
  35.     @Override
  36.     public void write(int arg0) throws IOException {
  37.         // Nothing
  38.     }

  39.     /*
  40.      * (non-Javadoc)
  41.      *
  42.      * @see java.io.OutputStream#write(byte[], int, int)
  43.      */
  44.     @Override
  45.     public void write(byte[] b, int off, int len) throws IOException {
  46.         // Nothing
  47.     }

  48.     /*
  49.      * (non-Javadoc)
  50.      *
  51.      * @see java.io.OutputStream#write(byte[])
  52.      */
  53.     @Override
  54.     public void write(byte[] b) throws IOException {
  55.         // Nothing
  56.     }

  57. }