/[libvob]/libvob/org/nongnu/libvob/util/PS2Reader.java
ViewVC logotype

Diff of /libvob/org/nongnu/libvob/util/PS2Reader.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by tjl, Wed Apr 9 12:31:05 2003 UTC revision 1.2 by tjl, Wed Apr 9 13:03:27 2003 UTC
# Line 11  public class PS2Reader { Line 11  public class PS2Reader {
11          void chg(int x, int y, int z, boolean b1, boolean b2, boolean b3);          void chg(int x, int y, int z, boolean b1, boolean b2, boolean b3);
12      };      };
13    
14      private FileInputStream in;      private RandomAccessFile in;
     private FileOutputStream out;  
15      private Listener chg;      private Listener chg;
16    
17      static final byte[] imps2 = new byte[] {      static final byte[] imps2 = new byte[] {
18          (byte)0xf3, (byte)0xc8, (byte)0xf3, (byte)0x64, (byte)0xf3, (byte)0x50          (byte)0xf3, (byte)0xc8, (byte)0xf3, (byte)0x64, (byte)0xf3, (byte)0x50
19      };      };
20      public PS2Reader(String file) throws IOException {      public PS2Reader(String file) throws IOException {
21          out = new FileOutputStream(file);          in = new RandomAccessFile(file, "rw");
22          in = new FileInputStream(out.getFD());          in.write(imps2);
         out.write(imps2);  
23      }      }
24    
25      public int x;      public int x;
# Line 54  public class PS2Reader { Line 52  public class PS2Reader {
52          b2 = (buf[0] & 2) != 0;          b2 = (buf[0] & 2) != 0;
53          b3 = (buf[0] & 4) != 0;          b3 = (buf[0] & 4) != 0;
54    
55          chg.chg(x, y, z, b1, b2, b3);          if(chg != null)
56                chg.chg(x, y, z, b1, b2, b3);
57        }
58    
59        public void print() {
60            System.out.println(""+x+"\t"+y+"\t"+z+"\t"+b1+
61                            "\t"+b2+"\t"+b3);
62        }
63    
64        static public void main(String[] argv) throws Exception {
65            PS2Reader r = new PS2Reader(argv[0]);
66            while(true) {
67                r.read();
68                r.print();
69            }
70      }      }
71    
72  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26