J2ME in a Nutshell phần 7 pps

52 336 0
J2ME in a Nutshell phần 7 pps

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

J2ME in a Nutshell 307 Type Of This section lists all of the fields and constants that are of this type, which can help you figure out how to obtain an object of this type. II.3.6 A Note About Class Names Throughout the quick reference, you'll notice that classes are sometimes referred to by class name alone and at other times referred to by class name and package name. If package names were always used, the class synopses would become long and hard to read. On the other hand, if package names were never used, it would sometimes be difficult to know what class was being referred to. The rules for including or omitting the package name are complex. They can be summarized approximately as follows, however: • If the class name alone is ambiguous, the package name is always used. • If the class is part of the java.lang package or is a very commonly used class, the package name is omitted. • If the class being referred to is part of the current package (and has a quick-reference entry in the current chapter), the package name is omitted. J2ME in a Nutshell 308 Chapter 10. J2ME Packages and Classes There are two types of packages and classes in the J2ME platform: • Those that are inherited from the J2SE platform • Those that are specific to J2ME and have no counterpart in J2SE Most of J2ME falls into the first category. Depending on the configuration and profile you are using, you can use a different subset of J2SE packages and a subset of those packages that are part of J2ME itself, as shown in Table 10-1. Some J2SE packages, particularly those associated with the user interface, are not currently part of any J2ME profile. These classes are listed in Table 10-2. Even when a package is available, it is not necessarily the case that all of its classes are included in the J2ME implementation. The remaining sections of this chapter list all classes in the J2SE packages included in at least one J2ME profile and show, for each configuration and profile, the classes applicable to it. 1 In some cases, you'll see that a J2SE class is not available at all in J2ME. Classes are usually omitted because of resource limitations, but there has also been an effort to remove classes that are deprecated in Java 2 Version 1.3; where this is the case, it is indicated in the tables. 10.1 J2ME Packages The following table shows the packages that make up J2ME and the configurations and profiles in which they are available. For example, the appearing on the top row of the "CLDC 1.0" column indicates that the java.io package is available in the CLDC configuration. Table 10-1. J2ME Package List Package CLDC 1.0 MID Profile 1.0 CDC 1.0 Foundation Profile 1.0 RMI Profile 1.0 java.io java.lang java.lang.ref java.lang.reflect java.math java.net java.rmi java.rmi.activation java.rmi.dgc java.rmi.registry java.rmi.server java.security java.security.acl java.security.cert java.security.interfaces java.security.spec 1 Since all of the J2ME profiles are based on Java 2 Version 1.3, the tables in this chapter show the packages and classes from that version. J2ME in a Nutshell 309 java.text java.util java.util.jar java.util.zip javax.microedition.io javax.microedition.lcdui javax.microedition.midlet javax.microedition.rms Note that the presence of a package does not mean that all classes in that J2SE package are available in J2ME. Class availability is covered in later sections of this chapter. 10.2 J2SE Packages Not Present in J2ME The J2SE packages listed in the following table are not included in any J2ME configuration or profile. Since all J2ME configurations and profiles are based on Java 2 Version 1.3, this list does not include classes available in later J2SE platform releases. Table 10-2. J2SE Packages Not Included in J2ME java.applet javax.swing java.awt javax.swing.border java.awt.color javax.swing.colorchooser java.awt.datatransfer javax.swing.event java.awt.dnd javax.swing.filechooser java.awt.event javax.swing.plaf java.awt.font javax.swing.plaf.basic java.awt.geom javax.swing.plaf.metal java.awt.im javax.swing.plaf.multi java.awt.im.spi javax.swing.table java.awt.image javax.swing.text java.awt.image.renderable javax.swing.text.html java.awt.print javax.swing.text.html.parser java.beans javax.swing.text.rtf java.beans.beancontext javax.swing.tree java.sql javax.swing.undo javax.accessibility javax.transaction javax.naming org.omg.CORBA javax.naming.directory org.omg.CORBA_2_3 javax.naming.event org.omg.CORBA_2_3.portable javax.naming.ldap org.omg.CORBA.DynAnyPackage javax.naming.spi org.omg.CORBA.ORBPackage javax.rmi org.omg.CORBA.portable javax.rmi.CORBA org.omg.CORBA.TypeCodePackage javax.sound.midi org.omg.CosNaming javax.sound.midi.spi org.omg.CosNaming.NamingContextPackage javax.sound.sampled org.omg.SendingContext javax.sound.sampled.spi org.omg.stub.java.rmi J2ME in a Nutshell 310 10.3 J2ME Package Contents This section contains tables that indicate which classes are available in each of the J2ME packages, itemized by configuration or profile. The presence of a symbol in a cell indicates that the class corresponding to its row is available in the configuration or profile corresponding to its column. 10.3.1 The java.io Package Table 10-3. Classes in the J2ME java.io Package Class CLDC 1.0 MID Profile 1.0 CDC 1.0 Foundation Profile 1.0 RMI Profile 1.0 BufferedInputStream BufferedOutputStream BufferedReader BufferedWriter ByteArrayInputStream ByteArrayOutputStream CharArrayReader CharArrayWriter CharConversionException DataInput DataInputStream DataOutput DataOutputStream EOFException Externalizable File FileDescriptor FileFilter FilenameFilter FileInputStream FileNotFoundException FileOutputStream FilePermission FileReader FileWriter FilterInputStream FilterOutputStream FilterReader FilterWriter InputStream InputStreamReader InterruptedIOException InvalidClassException InvalidObjectException IOException LineNumberInputStream Deprecated J2ME in a Nutshell 311 LineNumberReader NotActiveException NotSerializableException ObjectInput ObjectInputStream ObjectInputStream.GetField ObjectInputValidation ObjectOutput ObjectOutputStream ObjectOutputStream.PutField ObjectStreamClass ObjectStreamConstants ObjectStreamException ObjectStreamField OptionalDataException OutputStream OutputStreamWriter PipedInputStream PipedOutputStream PipedReader PipedWriter PrintStream PrintWriter PushbackInputStream PushbackReader RandomAccessFile Reader SequenceInputStream Serializable SerializablePermission StreamCorruptedException StreamTokenizer StringBufferInputStream Deprecated StringReader StringWriter SyncFailedException UnsupportedEncodingException UTFDataFormatException Writer WriteAbortedException 10.3.2 The java.lang Package Table 10-4. Classes in the J2ME java.lang Package Class CLDC 1.0 MID Profile 1.0 CDC 1.0 Foundation Profile 1.0 RMI Profile 1.0 AbstractMethodError ArithmeticException J2ME in a Nutshell 312 ArrayIndexOutOfBoundsException ArrayStoreException Boolean Byte Character Character.Subset Character.UnicodeBlock Class ClassCastException ClassCircularityError ClassFormatError ClassLoader ClassNotFoundException Cloneable CloneNotSupportedException Comparable Compiler Double Error Exception ExceptionInInitializerError Float IllegalAccessError IllegalAccessException IllegalArgumentException IllegalMonitorStateException IllegalStateException IllegalThreadStateException IncompatibleClassChangeError IndexOutOfBoundsException InheritableThreadLocal InstantiationError InstantiationException Integer InternalError InterruptedException LinkageError Long Math NegativeArraySizeException NoClassDefFoundError NoSuchFieldError NoSuchFieldException NoSuchMethodError NoSuchMethodException NullPointerException Number NumberFormatException J2ME in a Nutshell 313 Object OutOfMemoryError Package Process Runnable Runtime RuntimeException RuntimePermission SecurityException SecurityManager Short StackOverflowError StrictMath String StringBuffer StringIndexOutOfBoundsException System Thread ThreadDeath ThreadGroup ThreadLocal Throwable UnknownError UnsatisfiedLinkError UnsupportedClassVersionError UnsupportedOperationException VerifyError VirtualMachineError Void 10.3.3 The java.lang.ref Package Table 10-5. Classes in the J2ME java.lang.ref Package Class CLDC 1.0 MID Profile 1.0 CDC 1.0 Foundation Profile 1.0 RMI Profile 1.0 PhantomReference Reference ReferenceQueue SoftReference WeakReference 10.3.4 The java.lang.reflect Package Table 10-6. Classes in the J2ME java.lang.reflect Package Class CLDC 1.0 MID Profile 1.0 CDC 1.0 Foundation Profile 1.0 RMI Profile 1.0 AccessibleObject Array Constructor J2ME in a Nutshell 314 Field InvocationHandler InvocationTargetException Member Method Modifier Proxy ReflectPermission UndeclaredThrowableException 10.3.5 The java.math Package Table 10-7. Classes in the J2ME java.math Package Class CLDC 1.0 MID Profile 1.0 CDC 1.0 Foundation Profile 1.0 RMI Profile 1.0 BigDecimal BigInteger 10.3.6 The java.net Package Table 10-8. Classes in the J2ME java.net Package Class CLDC 1.0 MID Profile 1.0 CDC 1.0 Foundation Profile 1.0 RMI Profile 1.0 Authenticator BindException ConnectException ContentHandler ContentHandlerFactory DatagramPacket DatagramSocket DatagramSocketImpl DatagramSocketImplFactory FileNameMap HttpURLConnection InetAddress JarURLConnection MalformedURLException MulticastSocket NetPermission NoRouteToHostException PasswordAuthentication ProtocolException ServerSocket Socket SocketException SocketImpl SocketImplFactory SocketOptions SocketPermission J2ME in a Nutshell 315 UnknownHostException UnknownServiceException URL URLClassLoader URLConnection URLDecoder URLEncoder URLStreamHandler URLStreamHandlerFactory 10.3.7 The java.rmi Package Table 10-9. Classes in the J2ME java.rmi Package Class CLDC 1.0 MID Profile 1.0 CDC 1.0 Foundation Profile 1.0 RMI Profile 1.0 AccessException AlreadyBoundException ConnectException ConnectIOException MarshalException MarshalledObject Naming NoSuchObjectException NotBoundException Remote RemoteException RMISecurityException RMISecurityManager ServerError ServerException ServerRuntimeException StubNotFoundException UnexpectedException UnknownHostException UnmarshalException 10.3.8 The java.rmi.activation Package Table 10-10. Classes in the J2ME java.rmi.activation Package Class CLDC 1.0 MID Profile 1.0 CDC 1.0 Foundation Profile 1.0 RMI Profile 1.0 Activatable ActivateFailedException ActivationDesc ActivationException ActivationGroup ActivationGroupDesc J2ME in a Nutshell 316 ActivationGroupDesc. CommandEnvironment ActivationGroupID ActivationID ActivationInstantiator ActivationMonitor ActivationSystem Activator UnknownGroupException UnknownObjectException The CDC RMI profile contains only a small subset of the J2SE java.rmi.activation package, because it provides only the client-side functionality. The server side is assumed to be hosted in a J2SE or J2EE environment. 10.3.9 The java.rmi.dgc Package Table 10-11. Classes in the J2ME java.rmi.dgc Package Class CLDC 1.0 MID Profile 1.0 CDC 1.0 Foundation Profile 1.0 RMI Profile 1.0 DGC Lease VMID 10.3.10 The java.rmi.registry Package Table 10-12. Classes in the J2ME java.rmi.registry Package Class CLDC 1.0 MID Profile 1.0 CDC 1.0 Foundation Profile 1.0 RMI Profile 1.0 LocateRegistry Registry RegistryHandler Deprecated 10.3.11 The java.rmi.server Package Table 10-13. Classes in the java.rmi.server Package Class CLDC 1.0 MID Profile 1.0 CDC 1.0 Foundation Profile 1.0 RMI Profile 1.0 ExportException LoaderHandler Deprecated LogStream Deprecated ObjID Operation RemoteCall RemoteObject RemoteRef RemoteServer RemoteStub RMIClassLoader [...]... Subclasses ByteArrayInputStream, DataInputStream Passed To DataInputStream.DataInputStream(), InputStreamReader.InputStreamReader() Returned By Class.getResourceAsStream(), javax.microedition.io.Connector.openInputStream(), javax.microedition.io.InputConnection.openInputStream() Type Of DataInputStream .in InputStreamReader CLDC 1.0, MIDP 1.0 java.io InputStreamReader is a subclass of Reader that reads... AttributedCharacterIterator.Attribute AttributedString BreakIterator CharacterIterator ChoiceFormat CollationElementIterator CollationKey Collator DateFormat DateFormatSymbols DecimalFormat DecimalFormatSymbols FieldPosition Format MessageFormat NumberFormat ParseException ParsePosition RuleBasedCollator SimpleDateFormat StringCharacterIterator 10.3.18 The java.util Package Table 10-20 Classes in the J2ME java.util... therefore cannot safely be used on its own to read character data by widening a sequence of bytes into a sequence of chars Instead, character data should be handled using the readUTF() or readChar() methods of DataInputStream or by using an InputStreamReader with the appropriate encoding for the data in the input stream public abstract class InputStream { // Public Constructors public InputStream(); //... Protected Instance Fields protected InputStream in; } Returned By javax.microedition.io.Connector.openDataInputStream(), javax.microedition.io.InputConnection.openDataInputStream() DataOutput CLDC 1.0, MIDP 1.0 java.io This interface is implemented by classes that write strings and Java primitive types to a platform-independent binary encoding that can be read by a class implementing the DataInput interface... using the InputStreamReader and OutputStreamWriter classes Most of the concrete input and output stream and reader/writer classes available in J2SE are not provided In addition, some abstract classes (such as FilterInputStream) are also omitted so that derived classes in CLDC are reparented directly to InputStream or OutputStream ByteArrayInputStream CLDC 1.0, MIDP 1.0 java.io This is a subclass of InputStream... java.io This subclass of InputStream implements the methods of the DataInput interface, reading encoded data as a sequence of bytes from another InputStream Instances of this class can not only be created directly, but can also be obtained from various other methods, such as the openDataInputStream method of javax.microedition.io.Connector In this case, the openDataInputStream method returns a stream... to a sequence of Unicode characters by wrapping it with an instance of the InputStreamReader class, which is the only concrete subclass of Reader provided in the CLDC java.io package Most of the methods provided by Reader are the same as those available from InputStream, except that the fundamental unit of transfer is a char rather than a byte The read() methods copy data from the data source into a. .. Protected Instance Fields protected Object lock; } Subclasses OutputStreamWriter 340 J2ME in a Nutshell Chapter 12 java.lang Package java.lang CLDC 1.0, MIDP 1.0 The java.lang package, whose class hierarchy is shown in Figure 12-1, contains the classes that form the core of the Java language API The CLDC version of this package contains just under half of the classes and interfaces of its J2SE counterpart... reading an unsigned short, which is a 16-bit value that is returned in a Java int without sign extension Strings are held in a slightly modified form of UTF-8, which results in Unicode characters with values in the range 0-1 27 inclusive being encoded as a single byte This is an 3 27 J2ME in a Nutshell optimization for the most common characters in Western locales The readUTF() returns a String from a. .. Package CLDC MID Profile CDC Foundation Class 1.0 1.0 1.0 Profile 1.0 AbstractCollection AbstractList AbstractMap AbstractSequentialList AbstractSet ArrayList RMI Profile 1.0 320 J2ME in a Nutshell Arrays BitSet Calendar Collection Collections Comparator ConcurrentModificationException Date Dictionary EmptyStackException Enumeration EventListener EventObject GregorianCalendar HashMap HashSet Hashtable . java.awt.datatransfer javax.swing.event java.awt.dnd javax.swing.filechooser java.awt.event javax.swing.plaf java.awt.font javax.swing.plaf.basic java.awt.geom javax.swing.plaf.metal java.awt.im javax.swing.plaf.multi. javax.swing.plaf.multi java.awt.im.spi javax.swing.table java.awt.image javax.swing.text java.awt.image.renderable javax.swing.text.html java.awt.print javax.swing.text.html.parser java.beans javax.swing.text.rtf. later J2SE platform releases. Table 10-2. J2SE Packages Not Included in J2ME java.applet javax.swing java.awt javax.swing.border java.awt.color javax.swing.colorchooser java.awt.datatransfer

Ngày đăng: 12/08/2014, 19:21

Mục lục

  • II: API Quick Reference

    • 10. J2ME Packages and Classes

      • 10.1 J2ME Packages

      • 10.2 J2SE Packages Not Present in J2ME

      • 10.3 J2ME Package Contents

      • 11. java.io

        • Package java.io

        • ByteArrayInputStream

        • ByteArrayOutputStream

        • DataInput

        • DataInputStream

        • DataOutput

        • DataOutputStream

        • EOFException

        • InputStream

        • InputStreamReader

        • InterruptedIOException

        • IOException

        • OutputStream

        • OutputStreamWriter

        • PrintStream

        • Reader

        • UnsupportedEncodingException

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan