Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Reader;
- import java.io.RandomAccessFile;
- import java.io.IOException;
- public class RAFReader implements Readerr{
- private ColorRectangle[] rectangles = new ColorRectangle[10];
- public Object readFile(String fileName) {
- try {
- RandomAccessFile file = new RandomAccessFile(fileName, "r");
- int i = 0;
- String strLine;
- String[] res = new String[5];
- while((strLine = file.readLine()) != null) {
- res = strLine.split(" ");
- int x1 = Integer.parseInt(res[0]);
- int y1 = Integer.parseInt(res[1]);
- int x2 = Integer.parseInt(res[2]);
- int y2 = Integer.parseInt(res[3]);
- long c= Long.parseLong (res[4]);
- ColorRectangle a=new ColorRectangle(x1,y1,x2,y2,c);
- if (i==rectangles.lenght) break;
- rectangles[i++]=a;
- }
- file.close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement