Created
September 6, 2013 22:25
-
-
Save jcassee/6470812 to your computer and use it in GitHub Desktop.
Inspiratie voor debuggin van streams
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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