• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reading file from memory card

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I need to store a large amount of data on a memory card in files and then access it from a midlet.......
I should mention I am testing this on a Palm Tungsten C and a SD memory card.
The File Connection Optional Package is not available on the JVM i'm using.....
So i'm trying to use the basic Connector class with a InputStream
I am unable to read from any files on the memory card using the following code.
InputConnection conn = null;
DataInputStream dis = null;
StringBuffer sb = new StringBuffer();
String url = "file:///CardName/file.txt";

for(int i =0;i<urls.length;i++){
try {
conn =(InputConnection) Connector.open( url,Connector.READ);
DataInputStream is = conn.openDataInputStream();
sb.append("AAAAAAAA" + is.available());
}
}
catch( IOException ioe ){
sb.append(i + "Reg InputConnection: " + url+ "\n" + ioe.getMessage());
}}

I cannot use the RMS packages, as I need to store the data on a memory card and it writes it to the Palms main memory and not the card....
Does anybody know how to read files from a memory card? (using j2me of course)
 
author
Posts: 1436
6
Python TypeScript Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Without the File Connection OP, there is no standard way to do that -- the "file://" style url would cause an exception. I recall the IBM JVM for Palm has a small library that wraps most of the Palm native calls. I cannot remember its name (or its content) at this moment. But you might be able to find some thin wrapper over the native file I/O there.
 
reply
    Bookmark Topic Watch Topic
  • New Topic