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