Revision: 3272
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 1, 2007 22:35 by javapda
Initial Code
public class GetAppPropertiesSpotApp extends MIDlet { protected void startApp() throws MIDletStateChangeException { String nameOfFile=this.getAppProperty("NameOfFile"); System.out.println("NameOfFile=" + nameOfFile); InputStream is = getClass().getResourceAsStream(nameOfFile); InputStreamReader isr= new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line = null; while ((line=br.readLine())!=null) { System.out.println("line=" + line); } } protected void pauseApp() {} protected void destroyApp(boolean arg0) throws MIDletStateChangeException {} }
Initial URL
Initial Description
Shows reading a file bundled with a Sun SPOT application. The file, called winners.txt contains the following 2 lines: Walker Griffin ----------------------------------------------------------- The output would include: NameOfFile=/winners.txt line=Walker line=Griffin
Initial Title
Sun SPOT read bundled file as resource
Initial Tags
file
Initial Language
Java