Explore the use of the j2_recording Management System

Source: Internet
Author: User
Tags network function

This article briefly introduces the functions of j2's, focuses on the use of persistent data and record management systems, and provides support for storing persistent data on mobile devices, in addition, the MID short table specifically stipulates that compatible mobile devices must provide at least 8 KB of non-dynamic memory for data storage purposes. In fact, most MIDPJava devices provide more space than this requirement.

Persistent data and record management system RecordManagementSystem (RMS)

As mentioned in the previous article, MIDP provides support for storing persistent data on mobile devices, in addition, the MID short table specifically stipulates that compatible mobile devices must provide at least 8 KB of non-dynamic memory for data storage purposes. In fact, most MIDPJava devices provide more space than this requirement. This allows a midlet to fully utilize the persistent data of the application. For developers with Java 2 Standard Edition development experience, pay attention to the difference between this data storage capability and standard Java. The J2EE record management system (RMS) allows data streams to be stored and accessed based on a single record. The application developer parses each record to the field level. Interfaces in the RMS package support the comparison and retrieval functions defined by an application.

1. javax. microedition. rms package

Use the javax. microedition. rms package to access the j2_record management system. This package includes a class, RecordStore, and several useful interfaces (described in the following table ):

These interfaces are useful for implementing custom search and search functions. The most commonly used interfaces are RecordEnumeration. This interface is returned from the RecordStore. enumerateRecords () method call and is used to traverse a group of records returned from the record storage. It contains nextRecord (), previousRecord (), numRecords (), hasNextElement (), and other methods.

Ii. Use RecordStore class access record storage

The RecordStore class is the interface for developers to develop grassroots RMS, and records are stored on a platform-the method of relying on the midlet environment. The actual location of the information and storage details are not known to the application developers. record storage can be accessed using a simple naming rule: the name can contain up to 32 Unicode characters, case Sensitive and must be unique in a midlet suite. All midlets in a midlet suite have the read/write permission to store a record, as long as they know the correct name. Once this midlet suite is deleted from this device, all record storage associated with this suite will also be deleted.

For example, to open a record store named TestRecordSet, you can call RecordStore. openRecordStore () method. This method uses two parameters: a string, indicating the name of the record store; A boolean value, if true, will be created when the record store does not exist. Let's call the following method to create a new TestRecordSet record storage:

 
 
  1. RecordStorers=null;  
  2.  
  3. rs=RecordStore.openRecordStore("TestRecordSet",true);  
  4.  

After the record store is created, we can add data to the record store by calling the RecordStore. addRecord () method. AddRecord () accepts three parameters:

Once addRecord () is successfully called, this method returns an integer to specify the ID number of the record in the record storage. RecordStore also specifies another data editing method, including setRecord () and deleteRecord (), but they are not used in the example.

The MID short table contains a forward-looking network function, making j2-based radio application development a leader in the future. This feature will be the foundation of AI technology and will make j2's a cornerstone of future technology (for example, you can use the HTTPConnection interface and XML analyzer to construct a WML Browser ). In fact, XML analyzer like kXML will allow the J2EE client to support SOAP, XML-RPC, and other XML-based distribution technologies.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.