Java Reference
In-Depth Information
The first thing you might notice is that while the err and out PrintStreams are defined, there
is no System.in . This makes sense— System.in represents the console input; on a MIDP device,
there really isn't any console. In fact, it may seem weird to have System.out and System.err
defined. If you print information to System.out , it may not come out anywhere on a device;
however, on a device emulator, you may be able to view System.out in a console window. Of
course, any code that contains output to System.out and System.err should be removed from
production code.
The gc() and exit() methods are shortcuts for calling the corresponding methods in the
Runtime class.
All of System 's methods are static. The arraycopy() method provides a fast implementation of
array copying.
Finally, identityHashCode() is a default used by Object 's hashCode() method.
The getProperty() method returns system properties, which are different from the MIDlet
properties returned by MIDlet's getAppProperty() method. The following standard system
properties are supported and their values can be retrieved at runtime:
microedition.platform : This property contains the name of the device or host platform.
If the implementation does not supply a value, the default is null.
microedition.encoding : This property contains the default character encoding, which spec-
ifies how Unicode characters are represented in a byte stream, for example, “ISO-8859-1”.
microedition.configuration : This property contains the name of the implemented
configuration, for example, “CLDC-1.1”.
microedition.profiles : Implemented profiles are contained in this system property, for
example, “MIDP-2.0”.
Streams in java.io
The java.io package in the CLDC/MIDP world is a stripped-down version of java.io in J2SE.
Table 4-3 summarizes the classes of java.io in both J2SE and CLDC/MIDP. As you can see,
many of the java.io classes you normally find in J2SE are missing from CLDC/MIDP.
Table 4-3. The java.io Package
J2SE SDK 1.4.2
CLDC 1.0
CLDC 1.1
Interfaces
DataInput
Different
Different
DataOutput
Different
Different
Externalizable
-
-
FileFilter
-
-
FilenameFilter
-
-
ObjectInput
-
-
ObjectInputValidation
-
-
Search WWH ::




Custom Search