Add NullOutputStream

This is in preparation for the Java 8 move, which doesn't support
nullOutputStream().
master
Graham 5 years ago
parent f0fdb4cfe4
commit 6150e85a5c
  1. 2
      src/main/java/org/apache/harmony/unpack200/Archive.java
  2. 26
      src/main/java/org/apache/harmony/unpack200/NullOutputStream.java

@ -148,7 +148,7 @@ public class Archive {
segment.setLogLevel(logLevel);
segment
.setLogStream(logFile != null ? (OutputStream) logFile
: OutputStream.nullOutputStream());
: NullOutputStream.INSTANCE);
segment.setPreRead(false);
if (i == 1) {

@ -0,0 +1,26 @@
package org.apache.harmony.unpack200;
import java.io.OutputStream;
public final class NullOutputStream extends OutputStream {
public static final OutputStream INSTANCE = new NullOutputStream();
private NullOutputStream() {
/* empty */
}
@Override
public void write(int i) {
/* empty */
}
@Override
public void write(byte[] b) {
/* empty */
}
@Override
public void write(byte[] b, int off, int len) {
/* empty */
}
}
Loading…
Cancel
Save