1 / 10

D303 Java Mobile

RMS – Persistent Storage, HTTP Connections. D303 Java Mobile. Persistent Storage. MIDP provides a way for MIDlets to persistently store data and retrieve it later This is a simple record-oriented database called the Record Management System (RMS)

wyanet
Télécharger la présentation

D303 Java Mobile

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. RMS – Persistent Storage, HTTP Connections D303 Java Mobile

  2. Persistent Storage • MIDP provides a way for MIDlets to persistently store data and retrieve it later • This is a simple record-oriented database called the Record Management System (RMS) • A MIDP database (or a record store) consists of a collection of records that remain persistent after the MIDlet exits

  3. RMS • import javax.microedition.rms.* • import javax.microedition.io.* • import java.io.* • Record stores are binary files that are platform dependent

  4. RMS APIs • The RMS APIs provide the following functionality: • Allow MIDlets to add and remove records within a record store. • Allow MIDlets in the same application to share records (access one another's record store directly). • Do not provide a mechanism for sharing records between MIDlets in different applications.

  5. Record Stores • Data is stored as bytes in record stores • Data Streams are used to allow transfer of any data types to the record store • For each: RecordStore.openRecordStore there needs to be a corresponding close

  6. Record Store • Create record store • Create streams for transferring data • two streams are created, data stream and byte stream • Write data to data stream • Write data stream to byte array and write record • Close record store

  7. HTTP Connections • We can use a network enabled device to connect to a JSP/Servlet using HTTP • HTTP connection is made as a POST or a GET • GET simply adds the data to the URL so it is recommended that POST is used

  8. HTTP Connection • Create HTTP connection passing URL of JSP • Set HTTP connection to POST • Set connection properties to enable reading of parameters • Create byte stream • Store data in byte array

  9. HTTP Connection • Write byte array data to byte stream • Close byte stream – once stream is closed HTTP POST is created and data sent to JSP • Receive response from server • 200 – OK • 404 – Not Found • 500 – Internal Error

  10. Conclusion • RMS and HTTP allow us to store data on a mobile device for transfer to our existing web application at a convenient time

More Related