„Java Platform, Standard Edition” változatai közötti eltérés

[ellenőrzött változat][ellenőrzött változat]
Tartalom törölve Tartalom hozzáadva
B.Zsoltbot (vitalap | szerkesztései)
a clean up, replaced: – → – (28), — → — (3) AWB
24. sor:
 
A főbb osztályok a {{Javadoc:SE|package=java.lang|java/lang}} csomagban a következők:
* {{Javadoc:SE|java/lang|Object}} – a gyökere az teljes osztály hierarchiának.
* {{Javadoc:SE|java/lang|Enum}} – [[megszámlálható típus|megszámlálható osztályok]] megvalósításához (J2SE 5.0-tól).
* {{Javadoc:SE|java/lang|Class}} – a gyökere a Java [[Reflection (computer science)|reflection]] rendszernek.
* {{Javadoc:SE|java/lang|Throwable}} – az alap osztálya az exception osztály hierarchiának.
* {{Javadoc:SE|java/lang|Error}}, {{Javadoc:SE|java/lang|Exception}}, és {{Javadoc:SE|java/lang|RuntimeException}} – alap az összes kivétel kezelő osztály gyökerét képezik az öröklési fában
* {{Javadoc:SE|java/lang|Thread}} – szál kezelési műveleteket biztosítja
* {{Javadoc:SE|java/lang|String}} – a [[string (computer science)|string]]ek és [[string literál]]ok kezelését biztosítja
* {{Javadoc:SE|java/lang|StringBuffer}} és {{Javadoc:SE|java/lang|StringBuilder}} &ndash; a string manipulációt végzik (<code>StringBuilder</code> is a J2SE 5.0-től).
* {{Javadoc:SE|java/lang|Comparable}} &ndash; ez az interfész biztosítja az osztályok általános összehasonlítását és rendezését ( J2SE 1.2 óta).
* {{Javadoc:SE|java/lang|Iterable}} &ndash; ez az interfész biztosítja az általános iterációk használatát, melyek a [[Foreach#Java|továbbfejlesztett <code>for</code> ciklusokban]] használhatók (J2SE 5.0 óta).
* {{Javadoc:SE|java/lang|ClassLoader}}, {{Javadoc:SE|java/lang|Process}}, {{Javadoc:SE|java/lang|Runtime}},{{Javadoc:SE|java/lang|SecurityManager}}, és {{Javadoc:SE|java/lang|System}} &ndash; ezek az osztályok "rendszer szintű műveleteket" látnak el, azaz kezelik az osztályok [[dynamically loaded library|dinamikus betöltés]]ét, külső [[process (computer science)|processz]] létrehozását, környezetről információkat képes lekérni mint, pl. az idő, és a [[security policy|biztonsági policy]]k végrehajtását is biztosítja.
* {{Javadoc:SE|java/lang|Math}} és {{Javadoc:SE|java/lang|StrictMath}} &ndash; ellátják az alap matematikai funkciókat a rendszerben, mint pl., [[sin]], [[cosin]], és [[négyzetgyök]] számítást (<code>StrictMath</code> is a J2SE 1.3 óta).
* A [[primitív csomagoló osztály]]ok, melyek osztályokba csomagolják az [[primitív típus]]okat mint pl. <code>int</code>-be.
* Alap kivétel osztályokat dob a nyelvi szinten, továbbá más közös kivételeket is.
45. sor:
The {{Javadoc:SE|package=java.lang.ref|java/lang/ref}} package provides more flexible types of [[Reference (computer science)|references]] than are otherwise available, permitting limited interaction between the application and the [[Java Virtual Machine]] (JVM) [[garbage collection (computer science)|garbage collector]]. It is an important package, central enough to the language for the language designers to give it a name that starts with "java.lang", but it is somewhat special-purpose and not used by a lot of developers. This package was added in J2SE 1.2.
 
Java has an expressive system of references and allows for special behavior for garbage collection. A normal reference in Java is known as a "strong reference." The <code>java.lang.ref</code> package defines three other types of references &mdash; soft, [[weak reference|weak]], and phantom references. Each type of reference is designed for a specific use.
 
*A {{Javadoc:SE|java/lang/ref|SoftReference}} can be used to implement a [[cache (computing)|cache]]. An object that is not reachable by a strong reference (that is, not strongly reachable), but is referenced by a soft reference is called "softly reachable." A softly reachable object may be garbage collected at the discretion of the garbage collector. This generally means that softly reachable objects will only be garbage collected when free memory is low, but again, it is at the discretion of the garbage collector. Semantically, a soft reference means "keep this object when nothing else references it unless the memory is needed."
71. sor:
====== Discovery ======
Discovery typically starts with an object and calling the {{Javadoc:SE|java/lang|Object|getClass()}} method to get the object's <code>Class</code>. The <code>Class</code> object has several methods for discovering the contents of the class, for example:
* {{Javadoc:SE|name=getMethods()|java/lang|Class|getMethods()}} &ndash; returns an array of {{Javadoc:SE|java/lang/reflect|Method}} objects representing all the public methods of the class or interface
* {{Javadoc:SE|name=getConstructors()|java/lang|Class|getConstructors()}} &ndash; returns an array of {{Javadoc:SE|java/lang/reflect|Constructor}} objects representing all the public constructors of the class
* {{Javadoc:SE|name=getFields()|java/lang|Class|getFields()}} &ndash; returns an array of {{Javadoc:SE|java/lang/reflect|Field}} objects representing all the public fields of the class or interface
* {{Javadoc:SE|name=getClasses()|java/lang|Class|getClasses()}} &ndash; returns an array of <code>Class</code> objects representing all the public classes and interfaces that are members (e.g. [[inner class]]es) of the class or interface
* {{Javadoc:SE|name=getSuperclass()|java/lang|Class|getSuperclass()}} &ndash; return the <code>Class</code> object representing the superclass of the class or interface (<code>null</code> is returned for interfaces)
* {{Javadoc:SE|name=getInterfaces()|java/lang|Class|getInterfaces()}} &ndash; returns an array of <code>Class</code> objects representing all the interfaces that are implemented by the class or interface
 
====== Use by name ======
The <code>Class</code> object can be obtained either through discovery, by using the ''class literal'' (e.g. <code>MyClass.class</code>) or by using the name of the class (e.g. {{Javadoc:SE|name=Class.forName("mypackage.MyClass")|java/lang|Class|forName(java.lang.String)}}). With a <code>Class</code> object, member <code>Method</code>, <code>Constructor</code>, or <code>Field</code> objects can be obtained using the symbolic name of the member. For example:
* {{Javadoc:SE|name=getMethod("methodName", Class...)|java/lang|Class|getMethod(java.lang.String,java.lang.Class...)}} &ndash; returns the <code>Method</code> object representing the public method with the name "methodName" of the class or interface that accepts the parameters specified by the <code>Class...</code> parameters.
* {{Javadoc:SE|name=getConstructor(Class...)|java/lang|Class|getConstructor(java.lang.Class...)}} &ndash; returns the <code>Constructor</code> object representing the public constructor of the class that accepts the parameters specified by the <code>Class...</code> parameters.
* {{Javadoc:SE|name=getField("fieldName")|java/lang|Class|getField(java.lang.String)}} &ndash; returns the <code>Field</code> object representing the public field with the name "fieldName" of the class or interface.
 
<code>Method</code>, <code>Constructor</code>, and <code>Field</code> objects can be used to dynamically access the represented member of the class. For example:
* {{Javadoc:SE|name=Field.get(Object)|java/lang/reflect|Field|get(java.lang.Object)}} &ndash; returns an <code>Object</code> containing the value of the field from the instance of the object passed to <code>get()</code>. (If the <code>Field</code> object represents a static field then the <code>Object</code> parameter is ignored and may be <code>null</code>.)
* {{Javadoc:SE|name=Method.invoke(Object, Object...)|java/lang/reflect|Method|invoke(java.lang.Object,%20java.lang.Object...)}} &ndash; returns an <code>Object</code> containing the result of invoking the method for the instance of the first <code>Object</code> parameter passed to <code>invoke()</code>. The remaining <code>Object...</code> parameters are passed to the method. (If the <code>Method</code> object represents a [[static method]] then the first <code>Object</code> parameter is ignored and may be <code>null</code>.)
* {{Javadoc:SE|name=Constructor.newInstance(Object...)|java/lang/reflect|Constructor|newInstance(java.lang.Object...)}} &ndash; returns the new <code>Object</code> instance from invoking the constructor. The <code>Object...</code> parameters are passed to the constructor. (Note that the parameterless constructor for a class can also be invoked by calling {{Javadoc:SE|name=newInstance()|java/lang|Class|newInstance()}}.)
 
===== Arrays and proxies =====
The <code>java.lang.reflect</code> package also provides an {{Javadoc:SE|java/lang/reflect|Array}} class that contains static methods for creating and manipulating array objects, and since J2SE 1.3, a {{Javadoc:SE|java/lang/reflect|Proxy}} class that supports dynamic creation of proxy classes that implement specified interfaces.
 
The implementation of a <code>Proxy</code> class is provided by a supplied object that implements the {{Javadoc:SE|java/lang/reflect|InvocationHandler}} interface. The <code>InvocationHandler</code>'s {{Javadoc:SE|name=invoke(Object, Method, Object<nowiki>[]</nowiki>)|java/lang/reflect|InvocationHandler|invoke(java.lang.Object,java.lang.reflect.Method,java.lang.Object<nowiki>[]</nowiki>)}} method is called for each method invoked on the proxy object&mdash;theobject—the first parameter is the proxy object, the second parameter is the <code>Method</code> object representing the method from the interface implemented by the proxy, and the third parameter is the array of parameters passed to the interface method. The <code>invoke()</code> method returns an <code>Object</code> result that contains the result returned to the code that called the proxy interface method.
 
=== java.io ===
132. sor:
Data type handling and processing or filtering of stream data is accomplished through stream [[filter (software)|filters]]. The filter classes all accept another compatible stream object as a parameter to the constructor and ''decorate'' the enclosed stream with additional features. Filters are created by extending one of the base filter classes {{Javadoc:SE|java/io|FilterInputStream}}, {{Javadoc:SE|java/io|FilterOutputStream}}, {{Javadoc:SE|java/io|FilterReader}}, or {{Javadoc:SE|java/io|FilterWriter}}.
 
The <code>Reader</code> and <code>Writer</code> classes are really just byte streams with additional processing performed on the data stream to convert the bytes to characters. They use the default [[character encoding]] for the platform, which as of J2SE 5.0 is represented by the {{Javadoc:SE|java/nio/charset|Charset}} returned by the {{Javadoc:SE|package=java.nio.charset|java/nio/charset|Charset|defaultCharset()}} static method. The {{Javadoc:SE|java/io|InputStreamReader}} class converts an <code>InputStream</code> to a <code>Reader</code> and the {{Javadoc:SE|java/io|OutputStreamWriter}} class converts an <code>OutputStream</code> to a <code>Writer</code>. Both these classes have constructors that allow the character encoding to use to be specified&mdash;ifspecified—if no encoding is specified then the default encoding for the platform is used.
 
The following table shows the other processes and filters supported directly by the <code>java.io</code> package. All of these classes extend the corresponding <code>Filter</code> class.
171. sor:
The {{Javadoc:SE|package=java.math|java/math}} package supports [[Arbitrary-precision arithmetic|multiprecision arithmetic]] (including modular arithmetic operations) and provides multiprecision prime number generators used for cryptographic key generation. The main classes of the package are:
 
* {{Javadoc:SE|java/math|BigDecimal}} &ndash; provides arbitrary-precision signed decimal numbers. <code>BigDecimal</code> gives the user control over rounding behavior through <code>RoundingMode</code>.
* {{Javadoc:SE|java/math|BigInteger}} &ndash; provides arbitrary-precision integers. Operations on <code>BigInteger</code> do not [[Arithmetic overflow|overflow]] or lose precision. In addition to standard arithmetic operations, it provides [[modular arithmetic]], [[Greatest common divisor|GCD]] calculation, [[primality testing]], [[prime number]] generation, [[bit]] manipulation, and other miscellaneous operations.
* {{Javadoc:SE|java/math|MathContext}} &ndash; encapsulate the context settings which describe certain rules for numerical operators.
* {{Javadoc:SE|java/math|RoundingMode}} &ndash; an enumeration that provides eight rounding behaviors.
 
=== java.net ===