Skip to content

Instantly share code, notes, and snippets.

@jcassee
Created September 6, 2013 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcassee/6470812 to your computer and use it in GitHub Desktop.
Save jcassee/6470812 to your computer and use it in GitHub Desktop.
Inspiratie voor debuggin van streams
package com.goabout.api.http;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class LogOutputStream extends OutputStream {
private OutputStream stream;
private OutputStream logStream;
LogOutputStream(File logFile, OutputStream stream) throws IOException {
this.stream = stream;
this.logStream = new BufferedOutputStream(new FileOutputStream(logFile));
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
stream.write(b, off, len);
logStream.write(b, off, len);
}
@Override
public void write(int b) throws IOException {
stream.write(b);
logStream.write(b);
}
@Override
public void close() throws IOException {
stream.close();
logStream.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment