00001 package commandline.binToFilePackage;
00002
00003 import java.io.IOException;
00004 import java.io.InputStream;
00005 import java.io.PrintStream;
00006
00007 import commandline.CodingUtils.ByteConvertor;
00008
00009
00010
00011
00012
00013 public class MyTestDataInputStream extends MyDataInPutStream {
00014
00015 PrintStream printStream;
00016 public MyTestDataInputStream(InputStream inputStream,PrintStream printStream) {
00017 super(inputStream);
00018 this.printStream=printStream;
00019
00020 }
00021
00022 public synchronized int readMyShort(){
00023 int read= super.readMyShort();
00024 printStream.println(read);
00025 return read;
00026 }
00027
00028 public void close() throws IOException{
00029 super.close();
00030 printStream.flush();
00031 printStream.close();
00032 }
00033
00034 public synchronized int readMyByte() throws IOException{
00035 int integ=super.readMyByte();
00036 String[] strarray=ByteConvertor.getStringArrayOfBitsFor(integ,8);
00037 for(String str:strarray){
00038 printStream.print(str);
00039 }
00040 printStream.println();
00041 return integ;
00042 }
00043
00044 public synchronized void readMyBytes(int[] bytes) throws IOException{
00045 super.readMyBytes(bytes);
00046 }
00047
00048
00049 }