home *** CD-ROM | disk | FTP | other *** search
/ All for Cell Phones: Sony Ericsson / Sony-Ericsson 2004.iso / Java / Kool / Kool.jar / kool / GameScreen.class (.txt) < prev    next >
Encoding:
Java Class File  |  2001-12-24  |  1.8 KB  |  32 lines

  1. package kool;
  2.  
  3. import java.io.InputStream;
  4. import javax.microedition.io.Connector;
  5. import javax.microedition.lcdui.Canvas;
  6.  
  7. abstract class GameScreen extends Canvas implements Runnable {
  8.    private static final boolean showInfo = false;
  9.  
  10.    public abstract void Dispose();
  11.  
  12.    public abstract void run();
  13.  
  14.    public abstract int getReturnValue();
  15.  
  16.    public byte[] ReadByteArray(String file, int bytes, int offsetInFile) {
  17.       byte[] data = null;
  18.       new StringBuffer();
  19.  
  20.       try {
  21.          InputStream is = Connector.openInputStream("resource:/".concat(String.valueOf(String.valueOf(file))));
  22.          data = new byte[bytes];
  23.          is.read(data);
  24.          is.close();
  25.       } catch (Exception e) {
  26.          System.out.println(String.valueOf(String.valueOf((new StringBuffer("Exception: please copy the sprite-files from \\res to your class-files directory (CLASSPATH)!\n")).append(file).append("\n").append(e))));
  27.       }
  28.  
  29.       return data;
  30.    }
  31. }
  32.