00001 package commandline.TxTPackage;
00002
00003 import java.io.EOFException;
00004 import java.io.FileNotFoundException;
00005 import java.io.FileReader;
00006 import java.io.IOException;
00007
00008 import commandline.debuggingCode.Debug;
00009
00010
00011
00012
00013 public class Uitleesklasse {
00018 private input ds;
00019
00020 public Uitleesklasse(String filename){
00021 try{
00022 ds = new input(new FileReader(filename));
00023 }
00024 catch(Exception e){
00025 e.printStackTrace();
00026 }
00027 }
00028
00029 public float readnext(){
00030 float[] lees= readnext(1);
00031 return lees[0];
00032 }
00033
00034 public float EOFreadnext() throws EOFException,IOException{
00035 float d=0;
00036 try{
00037 d = ds.readFloat();
00038 }
00039 catch(FileNotFoundException e)
00040 {
00041 Debug.print(e.getMessage());
00042 System.exit(1);
00043 }
00044
00045
00046
00047 return d;
00048 }
00049
00050 public float[] readnext(int aantal){
00051 float[] rij=new float[aantal];
00052 try
00053 {
00054 for(int i =0;i!=aantal;i++){
00055 float d = ds.readFloat();
00056 rij[i]=d;
00057 }
00058 }
00059
00060
00061 catch(FileNotFoundException e)
00062 {
00063 Debug.print(e.getMessage());
00064 System.exit(1);
00065 }
00066 catch(EOFException e)
00067 {
00068 if(!Debug.DISTIBUTION) Debug.print("End of file, no problem");
00069 }
00070
00071 catch(IOException e)
00072 {
00073 Debug.print(e.getMessage());
00074 System.exit(1);
00075 }
00076 return rij;
00077 }
00078 protected static Uitleesklasse theinstance;
00079
00080
00081
00082
00083
00084
00085
00086
00087 }
00088
00089