📄 pim.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>PIM (PIM Optional Package 1.0 Spec, Final Release) </TITLE>
<!-- Generated by javadoc on Wed Oct 29 13:13:41 PST 2003 -->
<META NAME="keywords" CONTENT="javax.microedition.pim.PIM,PIM class">
<LINK REL="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
<SCRIPT>
function asd()
{
parent.document.title="PIM (PIM Optional Package 1.0 Spec, Final Release)";
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="asd();">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN="3" BGCOLOR="#eeeeff" CLASS="NavBarCell1">
<A NAME="navbar_top_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="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> PIM Optional Package 1.0<br>
Final Release</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> PREV CLASS <A HREF="../../../javax/microedition/pim/RepeatRule.html"><B>NEXT
CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" TARGET="_top">
<B>FRAMES</B></A> <A HREF="PIM.html" TARGET="_top"><B>NO FRAMES</B></A>
<SCRIPT> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>'); } //--></SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>
</NOSCRIPT>
</FONT>
</TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">javax.microedition.pim</FONT>
<BR>
Class PIM</H2>
<PRE>
java.lang.Object
|
+--<B>javax.microedition.pim.PIM</B>
</PRE>
<HR>
<DL>
<DT>public abstract class <B>PIM</B><DT>extends java.lang.Object</DT></DL>
<P>
Class for accessing PIM lists on a device and performing PIM wide functions.
This class is a collection of static methods for getting the names of the
existing PIM lists, opening the lists, and converting raw data streams to and
from PIM items for importing and exporting into those lists.
<h3>Examples</h3>
<h4>Importing a Contact from a Stream</h4>
This example assumes that the InputStream contains a valid vCard 3.0 entry with
the following characteristics:
<pre>
Content-Type: text/directory; charset="UTF-8"; profile="vCard"
Content-ID: <id3@host.com>
Content-Transfer-Encoding: Quoted-Printable
</pre>
The content of the vCard looks like the following:
<pre> begin:VCARD
source:ldap://cn=3Dbjorn%20Jensen, o=3Duniversity%20of%20Michigan, c=3DUS
name:Bjorn Jensen
fn:Bj=C3=B8rn Jensen
n:Jensen;Bj=F8rn
email;type=3Dinternet:bjorn@umich.edu
tel;type=3Dwork,voice,msg:+1 313 747-4454
key;type=3Dx509;encoding=3DB:dGhpcyBjb3VsZCBiZSAKbXkgY2VydGlmaWNhdGUK
end:VCARD
</pre>
The following method assumes that the input stream is positioned at the first
character of the vCard (i.e. the start of the "begin:" tag). For simplicity in
this example, the method also hardcodes the transfer encoding of Quoted
Printable and the data in the character set UTF-8.
<pre> void importVCard(InputStream is) {
// Using application defined class QuotedPrintableInputStream ...
QuotedPrintableInputStream qpis = new QuotedPrintableInputStream(is);
try {
PIMItem[] items = PIM.getInstance().fromSerialFormat(qpis, "UTF-8");
Contact c = (Contact) (items[0]);
ContactList cl = (ContactList) PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);
cl.importContact(c);
}
catch(PIMException pe) {
}
catch(IOException ioe) {
}
}
</pre>
<h4>Exporting a Contact to a Stream</h4>
This example exports a Contact to the provided output stream. The data format
used is the first data format returned from <A HREF="../../../javax/microedition/pim/PIM.html#supportedSerialFormats(int)">
<CODE>supportedSerialFormats(int)</CODE></A>. Note that any transfer
encoding, such as applying Quoted Printable, is the responsibility of the
application outside of this method.
<pre> void exportVCard(Contact c, OutputStream os) {
String[] data_formats = PIM.getInstance().supportedSerialFormats(PIM.CONTACT_LIST);
try {
PIM.getInstance().toSerialFormat(c, os, "UTF-8", data_formats[0]);
}
catch (PIMException pe){
}
catch (IOException ioe){
}
}
</pre>
<P>
<P>
<DL>
<DT><B>Since:</B>
<DD>
PIM 1.0</DD>
</DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#ccccff" CLASS="TableHeadingColor">
<TD COLSPAN="2"><FONT SIZE="+2"> <B>Field Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/pim/PIM.html#CONTACT_LIST">CONTACT_LIST</A></B></CODE>
<BR>
Constant
representing a Contact List.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/pim/PIM.html#EVENT_LIST">EVENT_LIST</A></B></CODE>
<BR>
Constant
representing an Event List.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/pim/PIM.html#READ_ONLY">READ_ONLY</A></B></CODE>
<BR>
Constant
representing opening a list in read only mode.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/pim/PIM.html#READ_WRITE">READ_WRITE</A></B></CODE>
<BR>
Constant
representing opening a list in read/write mode.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/pim/PIM.html#TODO_LIST">TODO_LIST</A></B></CODE>
<BR>
Constant
representing a ToDo List.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/pim/PIM.html#WRITE_ONLY">WRITE_ONLY</A></B></CODE>
<BR>
Constant
representing opening a list in write only mode.</TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#ccccff" CLASS="TableHeadingColor">
<TD COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected </CODE></FONT>
</TD>
<TD><CODE><B><A HREF="../../../javax/microedition/pim/PIM.html#PIM()">PIM</A></B>()</CODE>
<BR>
Constructor for
subclasses.</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#ccccff" CLASS="TableHeadingColor">
<TD COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>abstract <A HREF="../../../javax/microedition/pim/PIMItem.html">PIMItem</A>[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/pim/PIM.html#fromSerialFormat(java.io.InputStream, java.lang.String)">fromSerialFormat</A></B>(java.io.InputStream is,
java.lang.String enc)</CODE>
<BR>
Creates and fills
one or more PIM items from data provided in the given InputStream object where
the data is expressed in a valid data format supported by this platform.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../../../javax/microedition/pim/PIM.html">PIM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/pim/PIM.html#getInstance()">getInstance</A></B>()</CODE>
<BR>
Factory method to
get an instance of the PIM class.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>abstract
java.lang.String[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/pim/PIM.html#listPIMLists(int)">listPIMLists</A></B>(int pimListType)</CODE>
<BR>
Returns a list of
all PIM List names for the given PIM list type.</TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -