Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8178291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:43:40+00:00 2026-06-06T23:43:40+00:00

I am trying to port my LWUIT application to Codename one . I have

  • 0

I am trying to port my LWUIT application to Codename one.

I have used RMS in LWUIT and now obviously I have to transform this to Storage.

I don’t understand how the Storage class works in Codename one and the documentation for codename one has nothing about either.

1) What is the structure of a storage file?

–> In J2ME RecordStore , you have records bunched together like a table. Every row, corresponds to a record. Each record has a unique record ID and you can access the record with this record id. Every record can have some data stored in it.

How does this map to Storage class?

2)I wish to store some records in my storage, how do i do it?

The documentation says:

static Storage  getInstance() 
          Returns the storage instance or null if the storage wasn't initialized using a call to init(String) first.

–> In LWUIT it was something like Storage.init(storageName). ; However there is no init in codename one!!!. How do I open a Storage in Codename one??

3)If i try to open a storage file which does not exist, what will happen (RMS gives an exception)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:43:42+00:00Added an answer on June 6, 2026 at 11:43 pm

    The easiest way to think about Storage is as a flat file system (without directories/folders).

    When running on top of RMS this file system abstraction is mapped to the RMS database seamlessly for you.

    Notice that init() for Storage in Codename One is no longer necessary, under LWUIT it only performed basic initialization and the name was usually ignored.

    The Storage class has several methods:

    InputStream createInputStream(String name)
    

    Creates an input stream to the given storage source file

    OutputStream    createOutputStream(String name)
    

    Creates an output stream to the storage with the given name

    boolean     exists(String name)
    

    Returns true if the given storage file exists

    String[]    listEntries()
    

    Lists the names of the storage files

    You can use these to just store and check if data exists. However you can also store complex objects in storage without using input/output streams by using these two methods:

     Object     readObject(String name)
    

    Reads the object from the storage, returns null if the object isn’t there

     boolean    writeObject(String name, Object o)
    

    Writes the given object to storage assuming it is an externalizable type or one of the supported types

    So to simulate something like byte[] storage you can do something like this:

    Vector p = new Vector();
    byte[] myData = ...;
    p.addElement(myData);
    p.addElement(additionalData);
    Storage.getInstance().writeObject("myStore", p);
    

    Then just read it as:

    Vector p = (Vector)Storage.getInstance().read("myStore");
    // p will be null if nothing was written
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to port this function to c# http://www.phpsnaps.com/snaps/view/clean-url/ I have problems to transform
I am trying to port my lwuit app to codenameone . I have used
I am trying to port my LWUIT app to CodeName one . My LWUIT
I'm trying to port a Swing application to GWT. However lots of this application
I have an LWUIT app which i am trying to port on blackberry. I
I am trying to port this application from PHP to Java. PHP makes things
I'm trying to port my application to Mac, but I don't understand what's causing
I'm trying to port a Silverlight application to Metro, and have found that within
I am trying to port an application from Windows to Linux. In Windows I
I'm trying to port an application to the newest version of Mozilla Prism (1.0b1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.