MockOutputStream.java 585B

12345678910111213141516171819202122232425262728293031
  1. package com.zipcoder.server.mocks;
  2. import java.io.IOException;
  3. import java.io.OutputStream;
  4. public class MockOutputStream extends OutputStream {
  5. private String value = "";
  6. private boolean close;
  7. @Override
  8. public void write(int i) throws IOException {
  9. }
  10. @Override
  11. public void write(byte[] bytes, int off, int len) throws IOException {
  12. value += (new String(bytes));
  13. }
  14. public String getValue(){
  15. return value;
  16. }
  17. public void close(){
  18. close = true;
  19. }
  20. public boolean isClosed(){
  21. return close;
  22. }
  23. }