📄 recordstore.html
字号:
<PRE>
public void <B>removeRecordListener</B>(<A HREF="../../../javax/microedition/rms/RecordListener.html">RecordListener</A> listener)</PRE>
<DL>
<DD>Removes the specified RecordListener. If the specified listener is not registered, this method does nothing.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>listener</CODE> - the RecordChangedListener<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/rms/RecordStore.html#addRecordListener(javax.microedition.rms.RecordListener)"><CODE>addRecordListener(javax.microedition.rms.RecordListener)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getNextRecordID()"><!-- --></A><H3>
getNextRecordID</H3>
<PRE>
public int <B>getNextRecordID</B>() throws <A HREF="../../../javax/microedition/rms/RecordStoreNotOpenException.html">RecordStoreNotOpenException</A>, <A HREF="../../../javax/microedition/rms/RecordStoreException.html">RecordStoreException</A></PRE>
<DL>
<DD>Returns the recordId of the next record to be added to the record store. This can be useful for setting up pseudo-relational relationships. That is, if you have two or more record stores whose records need to refer to one another, you can predetermine the recordIds of the records that will be created in one record store, before populating the fields and allocating the record in another record store. Note that the recordId returned is only valid while the record store remains open and until a call to <code>addRecord()</code>.<DD><DL>
<DT><B>Returns:</B><DD>the recordId of the next record to be added to the record store<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/microedition/rms/RecordStoreNotOpenException.html">RecordStoreNotOpenException</A></CODE> - if the record store is not open<DD><CODE><A HREF="../../../javax/microedition/rms/RecordStoreException.html">RecordStoreException</A></CODE> - if a different record store-related exception occurred</DL>
</DD>
</DL>
<HR>
<A NAME="addRecord(byte[], int, int)"><!-- --></A><H3>
addRecord</H3>
<PRE>
public int <B>addRecord</B>(byte[] data, int offset, int numBytes) throws <A HREF="../../../javax/microedition/rms/RecordStoreNotOpenException.html">RecordStoreNotOpenException</A>, <A HREF="../../../javax/microedition/rms/RecordStoreException.html">RecordStoreException</A>, <A HREF="../../../javax/microedition/rms/RecordStoreFullException.html">RecordStoreFullException</A></PRE>
<DL>
<DD>Adds a new record to the record store. The recordId for this new record is returned. This is a blocking atomic operation. The record is written to persistent storage before the method returns.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>data</CODE> - the data to be stored in this record. If the record is to have zero-length data (no data), this parameter may be null.<DD><CODE>offset</CODE> - the index into the data buffer of the first relevant byte for this record<DD><CODE>numBytes</CODE> - the number of bytes of the data buffer to use for this record (may be zero)<DT><B>Returns:</B><DD>the recordId for the new record<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/microedition/rms/RecordStoreNotOpenException.html">RecordStoreNotOpenException</A></CODE> - if the record store is not open<DD><CODE><A HREF="../../../javax/microedition/rms/RecordStoreException.html">RecordStoreException</A></CODE> - if a different record store-related exception occurred<DD><CODE><A HREF="../../../javax/microedition/rms/RecordStoreFullException.html">RecordStoreFullException</A></CODE> - if the operation cannot be completed because the record store has no more room<DD><CODE><A HREF="../../../java/lang/SecurityException.html">SecurityException</A></CODE> - if the MIDlet has read-only access to the RecordStore</DL>
</DD>
</DL>
<HR>
<A NAME="deleteRecord(int)"><!-- --></A><H3>
deleteRecord</H3>
<PRE>
public void <B>deleteRecord</B>(int recordId) throws <A HREF="../../../javax/microedition/rms/RecordStoreNotOpenException.html">RecordStoreNotOpenException</A>, <A HREF="../../../javax/microedition/rms/InvalidRecordIDException.html">InvalidRecordIDException</A>, <A HREF="../../../javax/microedition/rms/RecordStoreException.html">RecordStoreException</A></PRE>
<DL>
<DD>The record is deleted from the record store. The recordId for this record is NOT reused.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>recordId</CODE> - the ID of the record to delete<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/microedition/rms/RecordStoreNotOpenException.html">RecordStoreNotOpenException</A></CODE> - if the record store is not open<DD><CODE><A HREF="../../../javax/microedition/rms/InvalidRecordIDException.html">InvalidRecordIDException</A></CODE> - if the recordId is invalid<DD><CODE><A HREF="../../../javax/microedition/rms/RecordStoreException.html">RecordStoreException</A></CODE> - if a general record store exception occurs<DD><CODE><A HREF="../../../java/lang/SecurityException.html">SecurityException</A></CODE> - if the MIDlet has read-only access to the RecordStore</DL>
</DD>
</DL>
<HR>
<A NAME="getRecordSize(int)"><!-- --></A><H3>
getRecordSize</H3>
<PRE>
public int <B>getRecordSize</B>(int recordId) throws <A HREF="../../../javax/microedition/rms/RecordStoreNotOpenException.html">RecordStoreNotOpenException</A>, <A HREF="../../../javax/microedition/rms/InvalidRecordIDException.html">InvalidRecordIDException</A>, <A HREF="../../../javax/microedition/rms/RecordStoreException.html">RecordStoreException</A></PRE>
<DL>
<DD>Returns the size (in bytes) of the MIDlet data available in the given record.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>recordId</CODE> - the ID of the record to use in this operation<DT><B>Returns:</B><DD>the size (in bytes) of the MIDlet data available in the given record<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/microedition/rms/RecordStoreNotOpenException.html">RecordStoreNotOpenException</A></CODE> - if the record store is not open<DD><CODE><A HREF="../../../javax/microedition/rms/InvalidRecordIDException.html">InvalidRecordIDException</A></CODE> - if the recordId is invalid<DD><CODE><A HREF="../../../javax/microedition/rms/RecordStoreException.html">RecordStoreException</A></CODE> - if a general record store exception occurs</DL>
</DD>
</DL>
<HR>
<A NAME="getRecord(int, byte[], int)"><!-- --></A><H3>
getRecord</H3>
<PRE>
public int <B>getRecord</B>(int recordId, byte[] buffer, int offset) throws <A HREF="../../../javax/microedition/rms/RecordStoreNotOpenException.html">RecordStoreNotOpenException</A>, <A HREF="../../../javax/microedition/rms/InvalidRecordIDException.html">InvalidRecordIDException</A>, <A HREF="../../../javax/microedition/rms/RecordStoreException.html">RecordStoreException</A></PRE>
<DL>
<DD>Returns the data stored in the given record.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>recordId</CODE> - the ID of the record to use in this operation<DD><CODE>buffer</CODE> - the byte array in which to copy the data<DD><CODE>offset</CODE> - the index into the buffer in which to start copying<DT><B>Returns:</B><DD>the number of bytes copied into the buffer, starting at index <code>offset</code><DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/microedition/rms/RecordStoreNotOpenException.html">RecordStoreNotOpenException</A></CODE> - if the record store is not open<DD><CODE><A HREF="../../../javax/microedition/rms/InvalidRecordIDException.html">InvalidRecordIDException</A></CODE> - if the recordId is invalid<DD><CODE><A HREF="../../../javax/microedition/rms/RecordStoreException.html">RecordStoreException</A></CODE> - if a general record store exception occurs<DD><CODE><A HREF="../../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if the record is larger than the buffer supplied<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/rms/RecordStore.html#setRecord(int, byte[], int, int)"><CODE>setRecord(int, byte[], int, int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getRecord(int)"><!-- --></A><H3>
getRecord</H3>
<PRE>
public byte[] <B>getRecord</B>(int recordId) throws <A HREF="../../../javax/microedition/rms/RecordStoreNotOpenException.html">RecordStoreNotOpenException</A>, <A HREF="../../../javax/microedition/rms/InvalidRecordIDException.html">InvalidRecordIDException</A>, <A HREF="../../../javax/microedition/rms/RecordStoreException.html">RecordStoreException</A></PRE>
<DL>
<DD>Returns a copy of the data stored in the given record.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>recordId</CODE> - the ID of the record to use in this operation<DT><B>Returns:</B><DD>the data stored in the given record. Note that if the record has no data, this method will return null.<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/microedition/rms/RecordStoreNotOpenException.html">RecordStoreNotOpenException</A></CODE> - if the record store is not open<DD><CODE><A HREF="../../../javax/microedition/rms/InvalidRecordIDException.html">InvalidRecordIDException</A></CODE> - if the recordId is invalid<DD><CODE><A HREF="../../../javax/microedition/rms/RecordStoreException.html">RecordStoreException</A></CODE> - if a general record store exception occurs<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/rms/RecordStore.html#setRecord(int, byte[], int, int)"><CODE>setRecord(int, byte[], int, int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setRecord(int, byte[], int, int)"><!-- --></A><H3>
setRecord</H3>
<PRE>
public void <B>setRecord</B>(int recordId, byte[] newData, int offset, int numBytes) throws <A HREF="../../../javax/microedition/rms/RecordStoreNotOpenException.html">RecordStoreNotOpenException</A>, <A HREF="../../../javax/microedition/rms/InvalidRecordIDException.html">InvalidRecordIDException</A>, <A HREF="../../../javax/microedition/rms/RecordStoreException.html">RecordStoreException</A>, <A HREF="../../../javax/microedition/rms/RecordStoreFullException.html">RecordStoreFullException</A></PRE>
<DL>
<DD>Sets the data in the given record to that passed in. After this method returns, a call to <code>getRecord(int recordId)</code> will return an array of numBytes size containing the data supplied here.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>recordId</CODE> - the ID of the record to use in this operation<DD><CODE>newData</CODE> - the new data to store in the record<DD><CODE>offset</CODE> - the index into the data buffer of the first relevant byte for this record<DD><CODE>numBytes</CODE> - the number of bytes of the data buffer to use for this record<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/microedition/rms/RecordStoreNotOpenException.html">RecordStoreNotOpenException</A></CODE> - if the record store is not open<DD><CODE><A HREF="../../../javax/microedition/rms/InvalidRecordIDException.html">InvalidRecordIDException</A></CODE> - if the recordId is invalid<DD><CODE><A HREF="../../../javax/microedition/rms/RecordStoreException.html">RecordStoreException</A></CODE> - if a general record store exception occurs<DD><CODE><A HREF="../../../javax/microedition/rms/RecordStoreFullException.html">RecordStoreFullException</A></CODE> - if the operation cannot be completed because the record store has no more room<DD><CODE><A HREF="../../../java/lang/SecurityException.html">SecurityException</A></CODE> - if the MIDlet has read-only access to the RecordStore<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/rms/RecordStore.html#getRecord(int, byte[], int)"><CODE>getRecord(int, byte[], int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="enumerateRecords(javax.microedition.rms.RecordFilter, javax.microedition.rms.RecordComparator, boolean)"><!-- --></A><H3>
enumerateRecords</H3>
<PRE>
public <A HREF="../../../javax/microedition/rms/RecordEnumeration.html">RecordEnumeration</A> <B>enumerateRecords</B>(<A HREF="../../../javax/microedition/rms/RecordFilter.html">RecordFilter</A> filter, <A HREF="../../../javax/microedition/rms/RecordComparator.html">RecordComparator</A> comparator, boolean keepUpdated) throws <A HREF="../../../javax/microedition/rms/RecordStoreNotOpenException.html">RecordStoreNotOpenException</A></PRE>
<DL>
<DD>Returns an enumeration for traversing a set of records in the record store in an optionally specified order.<p> The filter, if non-null, will be used to determine what subset of the record store records will be used.<p> The comparator, if non-null, will be used to determine the order in which the records are returned.<p> If both the filter and comparator is null, the enumeration will traverse all records in the record store in an undefined order. This is the most efficient way to traverse all of the records in a record store. If a filter is used with a null comparator, the enumeration will traverse the filtered records in an undefined order. The first call to <code>RecordEnumeration.nextRecord()</code> returns the record data from the first record in the sequence. Subsequent calls to <code>RecordEnumeration.nextRecord()</code> return the next consecutive record's data. To return the record data from the previous consecutive from any given point in the enumeration, call <code>previousRecord()</code>. On the other hand, if after creation the first call is to <code>previousRecord()</code>, the record data of the last element of the enumeration will be returned. Each subsequent call to <code>previousRecord()</code> will step backwards through the sequence.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>filter</CODE> - if non-null, will be used to determine what subset of the record store records will be used<DD><CODE>comparator</CODE> - if non-null, will be used to determine the order in which the records are returned<DD><CODE>keepUpdated</CODE> - if true, the enumerator will keep its enumeration current with any changes in the records of the record store. Use with caution as there are possible performance consequences. If false the enumeration will not be kept current and may return recordIds for records that have been deleted or miss records that are added later. It may also return records out of order that have been modified after the enumeration was built. Note that any changes to records in the record store are accurately reflected when the record is later retrieved, either directly or through the enumeration. The thing that is risked by setting this parameter false is the filtering and sorting order of the enumeration when records are modified, added, or deleted.<DT><B>Returns:</B><DD>an enumeration for traversing a set of records in the record store in an optionally specified order<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/microedition/rms/RecordStoreNotOpenException.html">RecordStoreNotOpenException</A></CODE> - if the record store is not open<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/rms/RecordEnumeration.html#rebuild()"><CODE>RecordEnumeration.rebuild()</CODE></A></DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/RecordStore.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<strong>MID Profile</strong></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV CLASS
NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="RecordStore.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<font size="-1"><a href="mailto:midp-feedback@risc.sps.mot.com">Submit a comment or suggestion</a> Version 2.0 of MID Profile Specification<br>Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries. Copyright (c) 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road,Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -