Created
January 11, 2019 05:57
-
-
Save vijayakumar-psg587/1367a774777593cd912ab2c32e850219 to your computer and use it in GitHub Desktop.
ByteArrayPrintWriter
This file contains 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
/** | |
* IMplemented own Printer as the new wrapper | |
* | |
*/ | |
public class ByteArrayPrinter { | |
private ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |
private PrintWriter pw = new PrintWriter(baos); | |
private ServletOutputStream sos = new ByteArrayServletStream(baos); | |
public PrintWriter getWriter() { | |
return pw; | |
} | |
public ServletOutputStream getStream() { | |
return sos; | |
} | |
byte[] toByteArray() { | |
return baos.toByteArray(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment