00001 package commandline.flatFileToBinaryPackage;
00002
00003 import java.io.IOException;
00004 import java.io.OutputStream;
00005 import java.io.PrintStream;
00006
00007 import commandline.CodingUtils.ByteConvertor;
00008
00009 public class MyTestOutputStream extends MyDataOutPutStream {
00010
00011 PrintStream printStream;
00012 public MyTestOutputStream(OutputStream arg0,PrintStream test) {
00013 super(arg0);
00014 this.printStream=test;
00015 }
00016
00017 public void writeMyShort(int getal) throws IOException{
00018 super.writeMyShort(getal);
00019 printStream.println(getal);
00020 }
00021
00022 public void write(byte[] bytearray) throws IOException{
00023 super.write(bytearray);
00024 for(byte getal : bytearray){
00025 String[] strarr=ByteConvertor.getStringArrayOfBitsFor(getal+128,8);
00026 for(String str:strarr){
00027 printStream.print(str);
00028 }
00029 }
00030 printStream.println();
00031
00032 }
00033
00034 public void flush() throws IOException{
00035 super.flush();
00036 printStream.flush();
00037 }
00038
00039 public void close()throws IOException{
00040 super.close();
00041 printStream.close();
00042 }
00043 }