You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(97) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(127) |
Feb
(34) |
Mar
(16) |
Apr
(26) |
May
(55) |
Jun
(107) |
Jul
(36) |
Aug
(72) |
Sep
(90) |
Oct
(41) |
Nov
(27) |
Dec
(13) |
| 2008 |
Jan
(37) |
Feb
(39) |
Mar
(98) |
Apr
(115) |
May
(134) |
Jun
(120) |
Jul
(86) |
Aug
(149) |
Sep
(68) |
Oct
(66) |
Nov
(104) |
Dec
(49) |
| 2009 |
Jan
(131) |
Feb
(132) |
Mar
(125) |
Apr
(172) |
May
(161) |
Jun
(43) |
Jul
(47) |
Aug
(38) |
Sep
(18) |
Oct
(6) |
Nov
(1) |
Dec
(15) |
| 2010 |
Jan
(21) |
Feb
(8) |
Mar
(10) |
Apr
(4) |
May
(9) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(4) |
| 2011 |
Jan
(23) |
Feb
(10) |
Mar
(13) |
Apr
(3) |
May
|
Jun
(19) |
Jul
(11) |
Aug
(22) |
Sep
|
Oct
(4) |
Nov
(2) |
Dec
(12) |
| 2012 |
Jan
(3) |
Feb
(4) |
Mar
(7) |
Apr
(3) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(30) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(8) |
| 2013 |
Jan
(3) |
Feb
(40) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(12) |
Dec
|
| 2021 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
|
From: <ls...@us...> - 2007-06-17 07:38:32
|
Revision: 3269
http://jnode.svn.sourceforge.net/jnode/?rev=3269&view=rev
Author: lsantha
Date: 2007-06-17 00:38:28 -0700 (Sun, 17 Jun 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/java/java/sql/
trunk/core/src/openjdk/java/java/sql/Array.java
trunk/core/src/openjdk/java/java/sql/BatchUpdateException.java
trunk/core/src/openjdk/java/java/sql/Blob.java
trunk/core/src/openjdk/java/java/sql/CallableStatement.java
trunk/core/src/openjdk/java/java/sql/ClientInfoStatus.java
trunk/core/src/openjdk/java/java/sql/Clob.java
trunk/core/src/openjdk/java/java/sql/Connection.java
trunk/core/src/openjdk/java/java/sql/DataTruncation.java
trunk/core/src/openjdk/java/java/sql/DatabaseMetaData.java
trunk/core/src/openjdk/java/java/sql/Date.java
trunk/core/src/openjdk/java/java/sql/Driver.java
trunk/core/src/openjdk/java/java/sql/DriverManager.java
trunk/core/src/openjdk/java/java/sql/DriverPropertyInfo.java
trunk/core/src/openjdk/java/java/sql/NClob.java
trunk/core/src/openjdk/java/java/sql/ParameterMetaData.java
trunk/core/src/openjdk/java/java/sql/PreparedStatement.java
trunk/core/src/openjdk/java/java/sql/Ref.java
trunk/core/src/openjdk/java/java/sql/ResultSet.java
trunk/core/src/openjdk/java/java/sql/ResultSetMetaData.java
trunk/core/src/openjdk/java/java/sql/RowId.java
trunk/core/src/openjdk/java/java/sql/RowIdLifetime.java
trunk/core/src/openjdk/java/java/sql/SQLClientInfoException.java
trunk/core/src/openjdk/java/java/sql/SQLData.java
trunk/core/src/openjdk/java/java/sql/SQLDataException.java
trunk/core/src/openjdk/java/java/sql/SQLException.java
trunk/core/src/openjdk/java/java/sql/SQLFeatureNotSupportedException.java
trunk/core/src/openjdk/java/java/sql/SQLInput.java
trunk/core/src/openjdk/java/java/sql/SQLIntegrityConstraintViolationException.java
trunk/core/src/openjdk/java/java/sql/SQLInvalidAuthorizationSpecException.java
trunk/core/src/openjdk/java/java/sql/SQLNonTransientConnectionException.java
trunk/core/src/openjdk/java/java/sql/SQLNonTransientException.java
trunk/core/src/openjdk/java/java/sql/SQLOutput.java
trunk/core/src/openjdk/java/java/sql/SQLPermission.java
trunk/core/src/openjdk/java/java/sql/SQLRecoverableException.java
trunk/core/src/openjdk/java/java/sql/SQLSyntaxErrorException.java
trunk/core/src/openjdk/java/java/sql/SQLTimeoutException.java
trunk/core/src/openjdk/java/java/sql/SQLTransactionRollbackException.java
trunk/core/src/openjdk/java/java/sql/SQLTransientConnectionException.java
trunk/core/src/openjdk/java/java/sql/SQLTransientException.java
trunk/core/src/openjdk/java/java/sql/SQLWarning.java
trunk/core/src/openjdk/java/java/sql/SQLXML.java
trunk/core/src/openjdk/java/java/sql/Savepoint.java
trunk/core/src/openjdk/java/java/sql/Statement.java
trunk/core/src/openjdk/java/java/sql/Struct.java
trunk/core/src/openjdk/java/java/sql/Time.java
trunk/core/src/openjdk/java/java/sql/Timestamp.java
trunk/core/src/openjdk/java/java/sql/Types.java
trunk/core/src/openjdk/java/java/sql/Wrapper.java
trunk/core/src/openjdk/java/java/sql/package.html
Added: trunk/core/src/openjdk/java/java/sql/Array.java
===================================================================
--- trunk/core/src/openjdk/java/java/sql/Array.java (rev 0)
+++ trunk/core/src/openjdk/java/java/sql/Array.java 2007-06-17 07:38:28 UTC (rev 3269)
@@ -0,0 +1,368 @@
+/*
+ * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.sql;
+
+/**
+ * The mapping in the Java programming language for the SQL type
+ * <code>ARRAY</code>.
+ * By default, an <code>Array</code> value is a transaction-duration
+ * reference to an SQL <code>ARRAY</code> value. By default, an <code>Array</code>
+ * object is implemented using an SQL LOCATOR(array) internally, which
+ * means that an <code>Array</code> object contains a logical pointer
+ * to the data in the SQL <code>ARRAY</code> value rather
+ * than containing the <code>ARRAY</code> value's data.
+ * <p>
+ * The <code>Array</code> interface provides methods for bringing an SQL
+ * <code>ARRAY</code> value's data to the client as either an array or a
+ * <code>ResultSet</code> object.
+ * If the elements of the SQL <code>ARRAY</code>
+ * are a UDT, they may be custom mapped. To create a custom mapping,
+ * a programmer must do two things:
+ * <ul>
+ * <li>create a class that implements the {@link SQLData}
+ * interface for the UDT to be custom mapped.
+ * <li>make an entry in a type map that contains
+ * <ul>
+ * <li>the fully-qualified SQL type name of the UDT
+ * <li>the <code>Class</code> object for the class implementing
+ * <code>SQLData</code>
+ * </ul>
+ * </ul>
+ * <p>
+ * When a type map with an entry for
+ * the base type is supplied to the methods <code>getArray</code>
+ * and <code>getResultSet</code>, the mapping
+ * it contains will be used to map the elements of the <code>ARRAY</code> value.
+ * If no type map is supplied, which would typically be the case,
+ * the connection's type map is used by default.
+ * If the connection's type map or a type map supplied to a method has no entry
+ * for the base type, the elements are mapped according to the standard mapping.
+ * <p>
+ * All methods on the <code>Array</code> interface must be fully implemented if the
+ * JDBC driver supports the data type.
+ *
+ * @since 1.2
+ */
+
+public interface Array {
+
+ /**
+ * Retrieves the SQL type name of the elements in
+ * the array designated by this <code>Array</code> object.
+ * If the elements are a built-in type, it returns
+ * the database-specific type name of the elements.
+ * If the elements are a user-defined type (UDT),
+ * this method returns the fully-qualified SQL type name.
+ *
+ * @return a <code>String</code> that is the database-specific
+ * name for a built-in base type; or the fully-qualified SQL type
+ * name for a base type that is a UDT
+ * @exception SQLException if an error occurs while attempting
+ * to access the type name
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.2
+ */
+ String getBaseTypeName() throws SQLException;
+
+ /**
+ * Retrieves the JDBC type of the elements in the array designated
+ * by this <code>Array</code> object.
+ *
+ * @return a constant from the class {@link java.sql.Types} that is
+ * the type code for the elements in the array designated by this
+ * <code>Array</code> object
+ * @exception SQLException if an error occurs while attempting
+ * to access the base type
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.2
+ */
+ int getBaseType() throws SQLException;
+
+ /**
+ * Retrieves the contents of the SQL <code>ARRAY</code> value designated
+ * by this
+ * <code>Array</code> object in the form of an array in the Java
+ * programming language. This version of the method <code>getArray</code>
+ * uses the type map associated with the connection for customizations of
+ * the type mappings.
+ * <p>
+ * <strong>Note:</strong> When <code>getArray</code> is used to materialize
+ * a base type that maps to a primitive data type, then it is
+ * implementation-defined whether the array returned is an array of
+ * that primitive data type or an array of <code>Object</code>.
+ *
+ * @return an array in the Java programming language that contains
+ * the ordered elements of the SQL <code>ARRAY</code> value
+ * designated by this <code>Array</code> object
+ * @exception SQLException if an error occurs while attempting to
+ * access the array
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.2
+ */
+ Object getArray() throws SQLException;
+
+ /**
+ * Retrieves the contents of the SQL <code>ARRAY</code> value designated by this
+ * <code>Array</code> object.
+ * This method uses
+ * the specified <code>map</code> for type map customizations
+ * unless the base type of the array does not match a user-defined
+ * type in <code>map</code>, in which case it
+ * uses the standard mapping. This version of the method
+ * <code>getArray</code> uses either the given type map or the standard mapping;
+ * it never uses the type map associated with the connection.
+ * <p>
+ * <strong>Note:</strong> When <code>getArray</code> is used to materialize
+ * a base type that maps to a primitive data type, then it is
+ * implementation-defined whether the array returned is an array of
+ * that primitive data type or an array of <code>Object</code>.
+ *
+ * @param map a <code>java.util.Map</code> object that contains mappings
+ * of SQL type names to classes in the Java programming language
+ * @return an array in the Java programming language that contains the ordered
+ * elements of the SQL array designated by this object
+ * @exception SQLException if an error occurs while attempting to
+ * access the array
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.2
+ */
+ Object getArray(java.util.Map<String,Class<?>> map) throws SQLException;
+
+ /**
+ * Retrieves a slice of the SQL <code>ARRAY</code>
+ * value designated by this <code>Array</code> object, beginning with the
+ * specified <code>index</code> and containing up to <code>count</code>
+ * successive elements of the SQL array. This method uses the type map
+ * associated with the connection for customizations of the type mappings.
+ * <p>
+ * <strong>Note:</strong> When <code>getArray</code> is used to materialize
+ * a base type that maps to a primitive data type, then it is
+ * implementation-defined whether the array returned is an array of
+ * that primitive data type or an array of <code>Object</code>.
+ *
+ * @param index the array index of the first element to retrieve;
+ * the first element is at index 1
+ * @param count the number of successive SQL array elements to retrieve
+ * @return an array containing up to <code>count</code> consecutive elements
+ * of the SQL array, beginning with element <code>index</code>
+ * @exception SQLException if an error occurs while attempting to
+ * access the array
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.2
+ */
+ Object getArray(long index, int count) throws SQLException;
+
+ /**
+ * Retreives a slice of the SQL <code>ARRAY</code> value
+ * designated by this <code>Array</code> object, beginning with the specified
+ * <code>index</code> and containing up to <code>count</code>
+ * successive elements of the SQL array.
+ * <P>
+ * This method uses
+ * the specified <code>map</code> for type map customizations
+ * unless the base type of the array does not match a user-defined
+ * type in <code>map</code>, in which case it
+ * uses the standard mapping. This version of the method
+ * <code>getArray</code> uses either the given type map or the standard mapping;
+ * it never uses the type map associated with the connection.
+ * <p>
+ * <strong>Note:</strong> When <code>getArray</code> is used to materialize
+ * a base type that maps to a primitive data type, then it is
+ * implementation-defined whether the array returned is an array of
+ * that primitive data type or an array of <code>Object</code>.
+ *
+ * @param index the array index of the first element to retrieve;
+ * the first element is at index 1
+ * @param count the number of successive SQL array elements to
+ * retrieve
+ * @param map a <code>java.util.Map</code> object
+ * that contains SQL type names and the classes in
+ * the Java programming language to which they are mapped
+ * @return an array containing up to <code>count</code>
+ * consecutive elements of the SQL <code>ARRAY</code> value designated by this
+ * <code>Array</code> object, beginning with element
+ * <code>index</code>
+ * @exception SQLException if an error occurs while attempting to
+ * access the array
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.2
+ */
+ Object getArray(long index, int count, java.util.Map<String,Class<?>> map)
+ throws SQLException;
+
+ /**
+ * Retrieves a result set that contains the elements of the SQL
+ * <code>ARRAY</code> value
+ * designated by this <code>Array</code> object. If appropriate,
+ * the elements of the array are mapped using the connection's type
+ * map; otherwise, the standard mapping is used.
+ * <p>
+ * The result set contains one row for each array element, with
+ * two columns in each row. The second column stores the element
+ * value; the first column stores the index into the array for
+ * that element (with the first array element being at index 1).
+ * The rows are in ascending order corresponding to
+ * the order of the indices.
+ *
+ * @return a {@link ResultSet} object containing one row for each
+ * of the elements in the array designated by this <code>Array</code>
+ * object, with the rows in ascending order based on the indices.
+ * @exception SQLException if an error occurs while attempting to
+ * access the array
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.2
+ */
+ ResultSet getResultSet () throws SQLException;
+
+ /**
+ * Retrieves a result set that contains the elements of the SQL
+ * <code>ARRAY</code> value designated by this <code>Array</code> object.
+ * This method uses
+ * the specified <code>map</code> for type map customizations
+ * unless the base type of the array does not match a user-defined
+ * type in <code>map</code>, in which case it
+ * uses the standard mapping. This version of the method
+ * <code>getResultSet</code> uses either the given type map or the standard mapping;
+ * it never uses the type map associated with the connection.
+ * <p>
+ * The result set contains one row for each array element, with
+ * two columns in each row. The second column stores the element
+ * value; the first column stores the index into the array for
+ * that element (with the first array element being at index 1).
+ * The rows are in ascending order corresponding to
+ * the order of the indices.
+ *
+ * @param map contains the mapping of SQL user-defined types to
+ * classes in the Java programming language
+ * @return a <code>ResultSet</code> object containing one row for each
+ * of the elements in the array designated by this <code>Array</code>
+ * object, with the rows in ascending order based on the indices.
+ * @exception SQLException if an error occurs while attempting to
+ * access the array
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.2
+ */
+ ResultSet getResultSet (java.util.Map<String,Class<?>> map) throws SQLException;
+
+ /**
+ * Retrieves a result set holding the elements of the subarray that
+ * starts at index <code>index</code> and contains up to
+ * <code>count</code> successive elements. This method uses
+ * the connection's type map to map the elements of the array if
+ * the map contains an entry for the base type. Otherwise, the
+ * standard mapping is used.
+ * <P>
+ * The result set has one row for each element of the SQL array
+ * designated by this object, with the first row containing the
+ * element at index <code>index</code>. The result set has
+ * up to <code>count</code> rows in ascending order based on the
+ * indices. Each row has two columns: The second column stores
+ * the element value; the first column stores the index into the
+ * array for that element.
+ *
+ * @param index the array index of the first element to retrieve;
+ * the first element is at index 1
+ * @param count the number of successive SQL array elements to retrieve
+ * @return a <code>ResultSet</code> object containing up to
+ * <code>count</code> consecutive elements of the SQL array
+ * designated by this <code>Array</code> object, starting at
+ * index <code>index</code>.
+ * @exception SQLException if an error occurs while attempting to
+ * access the array
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.2
+ */
+ ResultSet getResultSet(long index, int count) throws SQLException;
+
+ /**
+ * Retrieves a result set holding the elements of the subarray that
+ * starts at index <code>index</code> and contains up to
+ * <code>count</code> successive elements.
+ * This method uses
+ * the specified <code>map</code> for type map customizations
+ * unless the base type of the array does not match a user-defined
+ * type in <code>map</code>, in which case it
+ * uses the standard mapping. This version of the method
+ * <code>getResultSet</code> uses either the given type map or the standard mapping;
+ * it never uses the type map associated with the connection.
+ * <P>
+ * The result set has one row for each element of the SQL array
+ * designated by this object, with the first row containing the
+ * element at index <code>index</code>. The result set has
+ * up to <code>count</code> rows in ascending order based on the
+ * indices. Each row has two columns: The second column stores
+ * the element value; the first column stroes the index into the
+ * array for that element.
+ *
+ * @param index the array index of the first element to retrieve;
+ * the first element is at index 1
+ * @param count the number of successive SQL array elements to retrieve
+ * @param map the <code>Map</code> object that contains the mapping
+ * of SQL type names to classes in the Java(tm) programming language
+ * @return a <code>ResultSet</code> object containing up to
+ * <code>count</code> consecutive elements of the SQL array
+ * designated by this <code>Array</code> object, starting at
+ * index <code>index</code>.
+ * @exception SQLException if an error occurs while attempting to
+ * access the array
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.2
+ */
+ ResultSet getResultSet (long index, int count,
+ java.util.Map<String,Class<?>> map)
+ throws SQLException;
+ /**
+ * This method frees the <code>Array</code> object and releases the resources that
+ * it holds. The object is invalid once the <code>free</code>
+ * method is called.
+ *<p>
+ * After <code>free</code> has been called, any attempt to invoke a
+ * method other than <code>free</code> will result in a <code>SQLException</code>
+ * being thrown. If <code>free</code> is called multiple times, the subsequent
+ * calls to <code>free</code> are treated as a no-op.
+ *<p>
+ *
+ * @throws SQLException if an error occurs releasing
+ * the Array's resources
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.6
+ */
+ void free() throws SQLException;
+
+}
+
+
Added: trunk/core/src/openjdk/java/java/sql/BatchUpdateException.java
===================================================================
--- trunk/core/src/openjdk/java/java/sql/BatchUpdateException.java (rev 0)
+++ trunk/core/src/openjdk/java/java/sql/BatchUpdateException.java 2007-06-17 07:38:28 UTC (rev 3269)
@@ -0,0 +1,346 @@
+/*
+ * Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.sql;
+
+/**
+ * The subclass of {@link SQLException} thrown when an error
+ * occurs during a batch update operation. In addition to the
+ * information provided by {@link SQLException}, a
+ * <code>BatchUpdateException</code> provides the update
+ * counts for all commands that were executed successfully during the
+ * batch update, that is, all commands that were executed before the error
+ * occurred. The order of elements in an array of update counts
+ * corresponds to the order in which commands were added to the batch.
+ * <P>
+ * After a command in a batch update fails to execute properly
+ * and a <code>BatchUpdateException</code> is thrown, the driver
+ * may or may not continue to process the remaining commands in
+ * the batch. If the driver continues processing after a failure,
+ * the array returned by the method
+ * <code>BatchUpdateException.getUpdateCounts</code> will have
+ * an element for every command in the batch rather than only
+ * elements for the commands that executed successfully before
+ * the error. In the case where the driver continues processing
+ * commands, the array element for any command
+ * that failed is <code>Statement.EXECUTE_FAILED</code>.
+ * <P>
+ * @since 1.2
+ */
+
+public class BatchUpdateException extends SQLException {
+
+ /**
+ * Constructs a <code>BatchUpdateException</code> object initialized with a given
+ * <code>reason</code>, <code>SQLState</code>, <code>vendorCode</code> and
+ * <code>updateCounts</code>.
+ * The <code>cause</code> is not initialized, and may subsequently be
+ * initialized by a call to the
+ * {@link Throwable#initCause(java.lang.Throwable)} method.
+ * <p>
+ *
+ * @param reason a description of the error
+ * @param SQLState an XOPEN or SQL:2003 code identifying the exception
+ * @param vendorCode an exception code used by a particular
+ * database vendor
+ * @param updateCounts an array of <code>int</code>, with each element
+ * indicating the update count, <code>Statement.SUCCESS_NO_INFO</code> or
+ * <code>Statement.EXECUTE_FAILED</code> for each SQL command in
+ * the batch for JDBC drivers that continue processing
+ * after a command failure; an update count or
+ * <code>Statement.SUCCESS_NO_INFO</code> for each SQL command in the batch
+ * prior to the failure for JDBC drivers that stop processing after a command
+ * failure
+ * @since 1.2
+ */
+ public BatchUpdateException( String reason, String SQLState, int vendorCode,
+ int[] updateCounts ) {
+ super(reason, SQLState, vendorCode);
+ this.updateCounts = updateCounts;
+ }
+
+ /**
+ * Constructs a <code>BatchUpdateException</code> object initialized with a given
+ * <code>reason</code>, <code>SQLState</code> and
+ * <code>updateCounts</code>.
+ * The <code>cause</code> is not initialized, and may subsequently be
+ * initialized by a call to the
+ * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code
+ * is intialized to 0.
+ * <p>
+ *
+ * @param reason a description of the exception
+ * @param SQLState an XOPEN or SQL:2003 code identifying the exception
+ * @param updateCounts an array of <code>int</code>, with each element
+ * indicating the update count, <code>Statement.SUCCESS_NO_INFO</code> or
+ * <code>Statement.EXECUTE_FAILED</code> for each SQL command in
+ * the batch for JDBC drivers that continue processing
+ * after a command failure; an update count or
+ * <code>Statement.SUCCESS_NO_INFO</code> for each SQL command in the batch
+ * prior to the failure for JDBC drivers that stop processing after a command
+ * failure
+ * @since 1.2
+ */
+ public BatchUpdateException(String reason, String SQLState,
+ int[] updateCounts) {
+ super(reason, SQLState);
+ this.updateCounts = updateCounts;
+ }
+
+ /**
+ * Constructs a <code>BatchUpdateException</code> object initialized with a given
+ * <code>reason</code> and <code>updateCounts</code>.
+ * The <code>cause</code> is not initialized, and may subsequently be
+ * initialized by a call to the
+ * {@link Throwable#initCause(java.lang.Throwable)} method. The
+ * <code>SQLState</code> is initialized to <code>null</code>
+ * and the vender code is initialized to 0.
+ * <p>
+ *
+ *
+ * @param reason a description of the exception
+ * @param updateCounts an array of <code>int</code>, with each element
+ * indicating the update count, <code>Statement.SUCCESS_NO_INFO</code> or
+ * <code>Statement.EXECUTE_FAILED</code> for each SQL command in
+ * the batch for JDBC drivers that continue processing
+ * after a command failure; an update count or
+ * <code>Statement.SUCCESS_NO_INFO</code> for each SQL command in the batch
+ * prior to the failure for JDBC drivers that stop processing after a command
+ * failure
+ * @since 1.2
+ */
+ public BatchUpdateException(String reason, int[] updateCounts) {
+ super(reason);
+ this.updateCounts = updateCounts;
+ }
+
+ /**
+ * Constructs a <code>BatchUpdateException</code> object initialized with a given
+ * <code>updateCounts</code>.
+ * initialized by a call to the
+ * {@link Throwable#initCause(java.lang.Throwable)} method. The <code>reason</code>
+ * and <code>SQLState</code> are initialized to null and the vendor code
+ * is initialized to 0.
+ * <p>
+ *
+ * @param updateCounts an array of <code>int</code>, with each element
+ * indicating the update count, <code>Statement.SUCCESS_NO_INFO</code> or
+ * <code>Statement.EXECUTE_FAILED</code> for each SQL command in
+ * the batch for JDBC drivers that continue processing
+ * after a command failure; an update count or
+ * <code>Statement.SUCCESS_NO_INFO</code> for each SQL command in the batch
+ * prior to the failure for JDBC drivers that stop processing after a command
+ * failure
+ * @since 1.2
+ */
+ public BatchUpdateException(int[] updateCounts) {
+ super();
+ this.updateCounts = updateCounts;
+ }
+
+ /**
+ * Constructs a <code>BatchUpdateException</code> object.
+ * The <code>reason</code>, <code>SQLState</code> and <code>updateCounts</code>
+ * are initialized to <code>null</code> and the vendor code is initialized to 0.
+ * The <code>cause</code> is not initialized, and may subsequently be
+ * initialized by a call to the
+ * {@link Throwable#initCause(java.lang.Throwable)} method.
+ * <p>
+ *
+ * @since 1.2
+ */
+ public BatchUpdateException() {
+ super();
+ this.updateCounts = null;
+ }
+
+ /**
+ * Constructs a <code>BatchUpdateException</code> object initialized with
+ * a given <code>cause</code>.
+ * The <code>SQLState</code> and <code>updateCounts</code>
+ * are initialized
+ * to <code>null</code> and the vendor code is initialized to 0.
+ * The <code>reason</code> is initialized to <code>null</code> if
+ * <code>cause==null</code> or to <code>cause.toString()</code> if
+ * <code>cause!=null</code>.
+ * @param cause the underlying reason for this <code>SQLException</code>
+ * (which is saved for later retrieval by the <code>getCause()</code> method);
+ * may be null indicating the cause is non-existent or unknown.
+ * @since 1.6
+ */
+ public BatchUpdateException(Throwable cause) {
+ super(cause);
+ this.updateCounts = null;
+ }
+
+ /**
+ * Constructs a <code>BatchUpdateException</code> object initialized with a
+ * given <code>cause</code> and <code>updateCounts</code>.
+ * The <code>SQLState</code> is initialized
+ * to <code>null</code> and the vendor code is initialized to 0.
+ * The <code>reason</code> is initialized to <code>null</code> if
+ * <code>cause==null</code> or to <code>cause.toString()</code> if
+ * <code>cause!=null</code>.
+ *
+ * @param updateCounts an array of <code>int</code>, with each element
+ * indicating the update count, <code>Statement.SUCCESS_NO_INFO</code> or
+ * <code>Statement.EXECUTE_FAILED</code> for each SQL command in
+ * the batch for JDBC drivers that continue processing
+ * after a command failure; an update count or
+ * <code>Statement.SUCCESS_NO_INFO</code> for each SQL command in the batch
+ * prior to the failure for JDBC drivers that stop processing after a command
+ * failure
+ * @param cause the underlying reason for this <code>SQLException</code>
+ * (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
+ * the cause is non-existent or unknown.
+ * @since 1.6
+ */
+ public BatchUpdateException(int []updateCounts , Throwable cause) {
+ super(cause);
+ this.updateCounts = updateCounts;
+ }
+
+ /**
+ * Constructs a <code>BatchUpdateException</code> object initialized with
+ * a given <code>reason</code>, <code>cause</code>
+ * and <code>updateCounts</code>. The <code>SQLState</code> is initialized
+ * to <code>null</code> and the vendor code is initialized to 0.
+ *
+ * @param reason a description of the exception
+ * @param updateCounts an array of <code>int</code>, with each element
+ *indicating the update count, <code>Statement.SUCCESS_NO_INFO</code> or
+ * <code>Statement.EXECUTE_FAILED</code> for each SQL command in
+ * the batch for JDBC drivers that continue processing
+ * after a command failure; an update count or
+ * <code>Statement.SUCCESS_NO_INFO</code> for each SQL command in the batch
+ * prior to the failure for JDBC drivers that stop processing after a command
+ * failure
+ * @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method);
+ * may be null indicating
+ * the cause is non-existent or unknown.
+ * @since 1.6
+ */
+ public BatchUpdateException(String reason, int []updateCounts, Throwable cause) {
+ super(reason,cause);
+ this.updateCounts = updateCounts;
+ }
+
+ /**
+ * Constructs a <code>BatchUpdateException</code> object initialized with
+ * a given <code>reason</code>, <code>SQLState</code>,<code>cause</code>, and
+ * <code>updateCounts</code>. The vendor code is initialized to 0.
+ *
+ * @param reason a description of the exception
+ * @param SQLState an XOPEN or SQL:2003 code identifying the exception
+ * @param updateCounts an array of <code>int</code>, with each element
+ * indicating the update count, <code>Statement.SUCCESS_NO_INFO</code> or
+ * <code>Statement.EXECUTE_FAILED</code> for each SQL command in
+ * the batch for JDBC drivers that continue processing
+ * after a command failure; an update count or
+ * <code>Statement.SUCCESS_NO_INFO</code> for each SQL command in the batch
+ * prior to the failure for JDBC drivers that stop processing after a command
+ * failure
+ * @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method);
+ * may be null indicating
+ * the cause is non-existent or unknown.
+ * @since 1.6
+ */
+ public BatchUpdateException(String reason, String SQLState,
+ int []updateCounts, Throwable cause) {
+ super(reason,SQLState,cause);
+ this.updateCounts = updateCounts;
+ }
+
+ /**
+ * Constructs a <code>BatchUpdateException</code> object initialized with
+ * a given <code>reason</code>, <code>SQLState</code>, <code>vendorCode</code>
+ * <code>cause</code> and <code>updateCounts</code>.
+ *
+ * @param reason a description of the error
+ * @param SQLState an XOPEN or SQL:2003 code identifying the exception
+ * @param vendorCode an exception code used by a particular
+ * database vendor
+ * @param updateCounts an array of <code>int</code>, with each element
+ *indicating the update count, <code>Statement.SUCCESS_NO_INFO</code> or
+ * <code>Statement.EXECUTE_FAILED</code> for each SQL command in
+ * the batch for JDBC drivers that continue processing
+ * after a command failure; an update count or
+ * <code>Statement.SUCCESS_NO_INFO</code> for each SQL command in the batch
+ * prior to the failure for JDBC drivers that stop processing after a command
+ * failure
+ * @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method);
+ * may be null indicating
+ * the cause is non-existent or unknown.
+ * @since 1.6
+ */
+ public BatchUpdateException(String reason, String SQLState, int vendorCode,
+ int []updateCounts,Throwable cause) {
+ super(reason,SQLState,vendorCode,cause);
+ this.updateCounts = updateCounts;
+ }
+
+ /**
+ * Retrieves the update count for each update statement in the batch
+ * update that executed successfully before this exception occurred.
+ * A driver that implements batch updates may or may not continue to
+ * process the remaining commands in a batch when one of the commands
+ * fails to execute properly. If the driver continues processing commands,
+ * the array returned by this method will have as many elements as
+ * there are commands in the batch; otherwise, it will contain an
+ * update count for each command that executed successfully before
+ * the <code>BatchUpdateException</code> was thrown.
+ *<P>
+ * The possible return values for this method were modified for
+ * the Java 2 SDK, Standard Edition, version 1.3. This was done to
+ * accommodate the new option of continuing to process commands
+ * in a batch update after a <code>BatchUpdateException</code> object
+ * has been thrown.
+ *
+ * @return an array of <code>int</code> containing the update counts
+ * for the updates that were executed successfully before this error
+ * occurred. Or, if the driver continues to process commands after an
+ * error, one of the following for every command in the batch:
+ * <OL>
+ * <LI>an update count
+ * <LI><code>Statement.SUCCESS_NO_INFO</code> to indicate that the command
+ * executed successfully but the number of rows affected is unknown
+ * <LI><code>Statement.EXECUTE_FAILED</code> to indicate that the command
+ * failed to execute successfully
+ * </OL>
+ * @since 1.3
+ */
+ public int[] getUpdateCounts() {
+ return updateCounts;
+ }
+
+ /**
+ * The array that describes the outcome of a batch execution.
+ * @serial
+ * @since 1.2
+ */
+ private int[] updateCounts;
+
+ private static final long serialVersionUID = 5977529877145521757L;
+}
Added: trunk/core/src/openjdk/java/java/sql/Blob.java
===================================================================
--- trunk/core/src/openjdk/java/java/sql/Blob.java (rev 0)
+++ trunk/core/src/openjdk/java/java/sql/Blob.java 2007-06-17 07:38:28 UTC (rev 3269)
@@ -0,0 +1,306 @@
+/*
+ * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.sql;
+
+import java.io.InputStream;
+
+/**
+ * The representation (mapping) in
+ * the Java<sup><font size=-2>TM</font></sup> programming
+ * language of an SQL
+ * <code>BLOB</code> value. An SQL <code>BLOB</code> is a built-in type
+ * that stores a Binary Large Object as a column value in a row of
+ * a database table. By default drivers implement <code>Blob</code> using
+ * an SQL <code>locator(BLOB)</code>, which means that a
+ * <code>Blob</code> object contains a logical pointer to the
+ * SQL <code>BLOB</code> data rather than the data itself.
+ * A <code>Blob</code> object is valid for the duration of the
+ * transaction in which is was created.
+ *
+ * <P>Methods in the interfaces {@link ResultSet},
+ * {@link CallableStatement}, and {@link PreparedStatement}, such as
+ * <code>getBlob</code> and <code>setBlob</code> allow a programmer to
+ * access an SQL <code>BLOB</code> value.
+ * The <code>Blob</code> interface provides methods for getting the
+ * length of an SQL <code>BLOB</code> (Binary Large Object) value,
+ * for materializing a <code>BLOB</code> value on the client, and for
+ * determining the position of a pattern of bytes within a
+ * <code>BLOB</code> value. In addition, this interface has methods for updating
+ * a <code>BLOB</code> value.
+ * <p>
+ * All methods on the <code>Blob</code> interface must be fully implemented if the
+ * JDBC driver supports the data type.
+ *
+ * @since 1.2
+ */
+
+public interface Blob {
+
+ /**
+ * Returns the number of bytes in the <code>BLOB</code> value
+ * designated by this <code>Blob</code> object.
+ * @return length of the <code>BLOB</code> in bytes
+ * @exception SQLException if there is an error accessing the
+ * length of the <code>BLOB</code>
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.2
+ */
+ long length() throws SQLException;
+
+ /**
+ * Retrieves all or part of the <code>BLOB</code>
+ * value that this <code>Blob</code> object represents, as an array of
+ * bytes. This <code>byte</code> array contains up to <code>length</code>
+ * consecutive bytes starting at position <code>pos</code>.
+ *
+ * @param pos the ordinal position of the first byte in the
+ * <code>BLOB</code> value to be extracted; the first byte is at
+ * position 1
+ * @param length the number of consecutive bytes to be copied; the value
+ * for length must be 0 or greater
+ * @return a byte array containing up to <code>length</code>
+ * consecutive bytes from the <code>BLOB</code> value designated
+ * by this <code>Blob</code> object, starting with the
+ * byte at position <code>pos</code>
+ * @exception SQLException if there is an error accessing the
+ * <code>BLOB</code> value; if pos is less than 1 or length is
+ * less than 0
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @see #setBytes
+ * @since 1.2
+ */
+ byte[] getBytes(long pos, int length) throws SQLException;
+
+ /**
+ * Retrieves the <code>BLOB</code> value designated by this
+ * <code>Blob</code> instance as a stream.
+ *
+ * @return a stream containing the <code>BLOB</code> data
+ * @exception SQLException if there is an error accessing the
+ * <code>BLOB</code> value
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @see #setBinaryStream
+ * @since 1.2
+ */
+ java.io.InputStream getBinaryStream () throws SQLException;
+
+ /**
+ * Retrieves the byte position at which the specified byte array
+ * <code>pattern</code> begins within the <code>BLOB</code>
+ * value that this <code>Blob</code> object represents. The
+ * search for <code>pattern</code> begins at position
+ * <code>start</code>.
+ *
+ * @param pattern the byte array for which to search
+ * @param start the position at which to begin searching; the
+ * first position is 1
+ * @return the position at which the pattern appears, else -1
+ * @exception SQLException if there is an error accessing the
+ * <code>BLOB</code> or if start is less than 1
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.2
+ */
+ long position(byte pattern[], long start) throws SQLException;
+
+ /**
+ * Retrieves the byte position in the <code>BLOB</code> value
+ * designated by this <code>Blob</code> object at which
+ * <code>pattern</code> begins. The search begins at position
+ * <code>start</code>.
+ *
+ * @param pattern the <code>Blob</code> object designating
+ * the <code>BLOB</code> value for which to search
+ * @param start the position in the <code>BLOB</code> value
+ * at which to begin searching; the first position is 1
+ * @return the position at which the pattern begins, else -1
+ * @exception SQLException if there is an error accessing the
+ * <code>BLOB</code> value or if start is less than 1
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.2
+ */
+ long position(Blob pattern, long start) throws SQLException;
+
+ // -------------------------- JDBC 3.0 -----------------------------------
+
+ /**
+ * Writes the given array of bytes to the <code>BLOB</code> value that
+ * this <code>Blob</code> object represents, starting at position
+ * <code>pos</code>, and returns the number of bytes written.
+ * The array of bytes will overwrite the existing bytes
+ * in the <code>Blob</code> object starting at the position
+ * <code>pos</code>. If the end of the <code>Blob</code> value is reached
+ * while writing the array of bytes, then the length of the <code>Blob</code>
+ * value will be increased to accomodate the extra bytes.
+ * <p>
+ * <b>Note:</b> If the value specified for <code>pos</code>
+ * is greater then the length+1 of the <code>BLOB</code> value then the
+ * behavior is undefined. Some JDBC drivers may throw a
+ * <code>SQLException</code> while other drivers may support this
+ * operation.
+ *
+ * @param pos the position in the <code>BLOB</code> object at which
+ * to start writing; the first position is 1
+ * @param bytes the array of bytes to be written to the <code>BLOB</code>
+ * value that this <code>Blob</code> object represents
+ * @return the number of bytes written
+ * @exception SQLException if there is an error accessing the
+ * <code>BLOB</code> value or if pos is less than 1
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @see #getBytes
+ * @since 1.4
+ */
+ int setBytes(long pos, byte[] bytes) throws SQLException;
+
+ /**
+ * Writes all or part of the given <code>byte</code> array to the
+ * <code>BLOB</code> value that this <code>Blob</code> object represents
+ * and returns the number of bytes written.
+ * Writing starts at position <code>pos</code> in the <code>BLOB</code>
+ * value; <code>len</code> bytes from the given byte array are written.
+ * The array of bytes will overwrite the existing bytes
+ * in the <code>Blob</code> object starting at the position
+ * <code>pos</code>. If the end of the <code>Blob</code> value is reached
+ * while writing the array of bytes, then the length of the <code>Blob</code>
+ * value will be increased to accomodate the extra bytes.
+ * <p>
+ * <b>Note:</b> If the value specified for <code>pos</code>
+ * is greater then the length+1 of the <code>BLOB</code> value then the
+ * behavior is undefined. Some JDBC drivers may throw a
+ * <code>SQLException</code> while other drivers may support this
+ * operation.
+ *
+ * @param pos the position in the <code>BLOB</code> object at which
+ * to start writing; the first position is 1
+ * @param bytes the array of bytes to be written to this <code>BLOB</code>
+ * object
+ * @param offset the offset into the array <code>bytes</code> at which
+ * to start reading the bytes to be set
+ * @param len the number of bytes to be written to the <code>BLOB</code>
+ * value from the array of bytes <code>bytes</code>
+ * @return the number of bytes written
+ * @exception SQLException if there is an error accessing the
+ * <code>BLOB</code> value or if pos is less than 1
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @see #getBytes
+ * @since 1.4
+ */
+ int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException;
+
+ /**
+ * Retrieves a stream that can be used to write to the <code>BLOB</code>
+ * value that this <code>Blob</code> object represents. The stream begins
+ * at position <code>pos</code>.
+ * The bytes written to the stream will overwrite the existing bytes
+ * in the <code>Blob</code> object starting at the position
+ * <code>pos</code>. If the end of the <code>Blob</code> value is reached
+ * while writing to the stream, then the length of the <code>Blob</code>
+ * value will be increased to accomodate the extra bytes.
+ * <p>
+ * <b>Note:</b> If the value specified for <code>pos</code>
+ * is greater then the length+1 of the <code>BLOB</code> value then the
+ * behavior is undefined. Some JDBC drivers may throw a
+ * <code>SQLException</code> while other drivers may support this
+ * operation.
+ *
+ * @param pos the position in the <code>BLOB</code> value at which
+ * to start writing; the first position is 1
+ * @return a <code>java.io.OutputStream</code> object to which data can
+ * be written
+ * @exception SQLException if there is an error accessing the
+ * <code>BLOB</code> value or if pos is less than 1
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @see #getBinaryStream
+ * @since 1.4
+ */
+ java.io.OutputStream setBinaryStream(long pos) throws SQLException;
+
+ /**
+ * Truncates the <code>BLOB</code> value that this <code>Blob</code>
+ * object represents to be <code>len</code> bytes in length.
+ * <p>
+ * <b>Note:</b> If the value specified for <code>pos</code>
+ * is greater then the length+1 of the <code>BLOB</code> value then the
+ * behavior is undefined. Some JDBC drivers may throw a
+ * <code>SQLException</code> while other drivers may support this
+ * operation.
+ *
+ * @param len the length, in bytes, to which the <code>BLOB</code> value
+ * that this <code>Blob</code> object represents should be truncated
+ * @exception SQLException if there is an error accessing the
+ * <code>BLOB</code> value or if len is less than 0
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.4
+ */
+ void truncate(long len) throws SQLException;
+
+ /**
+ * This method frees the <code>Blob</code> object and releases the resources that
+ * it holds. The object is invalid once the <code>free</code>
+ * method is called.
+ *<p>
+ * After <code>free</code> has been called, any attempt to invoke a
+ * method other than <code>free</code> will result in a <code>SQLException</code>
+ * being thrown. If <code>free</code> is called multiple times, the subsequent
+ * calls to <code>free</code> are treated as a no-op.
+ *<p>
+ *
+ * @throws SQLException if an error occurs releasing
+ * the Blob's resources
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.6
+ */
+ void free() throws SQLException;
+
+ /**
+ * Returns an <code>InputStream</code> object that contains a partial <code>Blob</code> value,
+ * starting with the byte specified by pos, which is length bytes in length.
+ *
+ * @param pos the offset to the first byte of the partial value to be retrieved.
+ * The first byte in the <code>Blob</code> is at position 1
+ * @param length the length in bytes of the partial value to be retrieved
+ * @return <code>InputStream</code> through which the partial <code>Blob</code> value can be read.
+ * @throws SQLException if pos is less than 1 or if pos is greater than the number of bytes
+ * in the <code>Blob</code> or if pos + length is greater than the number of bytes
+ * in the <code>Blob</code>
+ *
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.6
+ */
+ InputStream getBinaryStream(long pos, long length) throws SQLException;
+}
+
+
Added: trunk/core/src/openjdk/java/java/sql/CallableStatement.java
===================================================================
--- trunk/core/src/openjdk/java/java/sql/CallableStatement.java (rev 0)
+++ trunk/core/src/openjdk/java/java/sql/CallableStatement.java 2007-06-17 07:38:28 UTC (rev 3269)
@@ -0,0 +1,2444 @@
+/*
+ * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.sql;
+
+import java.math.BigDecimal;
+import java.util.Calendar;
+import java.io.Reader;
+import java.io.InputStream;
+
+/**
+ * The interface used to execute SQL stored procedures. The JDBC API
+ * provides a stored procedure SQL escape syntax that allows stored procedures
+ * to be called in a standard way for all RDBMSs. This escape syntax has one
+ * form that includes a result parameter and one that does not. If used, the result
+ * parameter must be registered as an OUT parameter. The other parameters
+ * can be used for input, output or both. Parameters are referred to
+ * sequentially, by number, with the first parameter being 1.
+ * <PRE>
+ * {?= call <procedure-name>[(<arg1>,<arg2>, ...)]}
+ * {call <procedure-name>[(<arg1>,<arg2>, ...)]}
+ * </PRE>
+ * <P>
+ * IN parameter values are set using the <code>set</code> methods inherited from
+ * {@link PreparedStatement}. The type of all OUT parameters must be
+ * registered prior to executing the stored procedure; their values
+ * are retrieved after execution via the <code>get</code> methods provided here.
+ * <P>
+ * A <code>CallableStatement</code> can return one {@link ResultSet} object or
+ * multiple <code>ResultSet</code> objects. Multiple
+ * <code>ResultSet</code> objects are handled using operations
+ * inherited from {@link Statement}.
+ * <P>
+ * For maximum portability, a call's <code>ResultSet</code> objects and
+ * update counts should be processed prior to getting the values of output
+ * parameters.
+ * <P>
+ *
+ * @see Connection#prepareCall
+ * @see ResultSet
+ */
+
+public interface CallableStatement extends PreparedStatement {
+
+ /**
+ * Registers the OUT parameter in ordinal position
+ * <code>parameterIndex</code> to the JDBC type
+ * <code>sqlType</code>. All OUT parameters must be registered
+ * before a stored procedure is executed.
+ * <p>
+ * The JDBC type specified by <code>sqlType</code> for an OUT
+ * parameter determines the Java type that must be used
+ * in the <code>get</code> method to read the value of that parameter.
+ * <p>
+ * If the JDBC type expected to be returned to this output parameter
+ * is specific to this particular database, <code>sqlType</code>
+ * should be <code>java.sql.Types.OTHER</code>. The method
+ * {@link #getObject} retrieves the value.
+ *
+ * @param parameterIndex the first parameter is 1, the second is 2,
+ * and so on
+ * @param sqlType the JDBC type code defined by <code>java.sql.Types</code>.
+ * If the parameter is of JDBC type <code>NUMERIC</code>
+ * or <code>DECIMAL</code>, the version of
+ * <code>registerOutParameter</code> that accepts a scale value
+ * should be used.
+ *
+ * @exception SQLException if the parameterIndex is not valid;
+ * if a database access error occurs or
+ * this method is called on a closed <code>CallableStatement</code>
+ * @exception SQLFeatureNotSupportedException if <code>sqlType</code> is
+ * a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>,
+ * <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>,
+ * <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>,
+ * <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code>
+ * or <code>STRUCT</code> data type and the JDBC driver does not support
+ * this data type
+ * @see Types
+ */
+ void registerOutParameter(int parameterIndex, int sqlType)
+ throws SQLException;
+
+ /**
+ * Registers the parameter in ordinal position
+ * <code>parameterIndex</code> to be of JDBC type
+ * <code>sqlType</code>. All OUT parameters must be registered
+ * before a stored procedure is executed.
+ * <p>
+ * The JDBC type specified by <code>sqlType</code> for an OUT
+ * parameter determines the Java type that must be used
+ * in the <code>get</code> method to read the value of that parameter.
+ * <p>
+ * This version of <code>registerOutParameter</code> should be
+ * used when the parameter is of JDBC type <code>NUMERIC</code>
+ * or <code>DECIMAL</code>.
+ *
+ * @param parameterIndex the first parameter is 1, the second is 2,
+ * and so on
+ * @param sqlType the SQL type code defined by <code>java.sql.Types</code>.
+ * @param scale the desired number of digits to the right of the
+ * decimal point. It must be greater than or equal to zero.
+ * @exception SQLException if the parameterIndex is not valid;
+ * if a database access error occurs or
+ * this method is called on a closed <code>CallableStatement</code>
+ * @exception SQLFeatureNotSupportedException if <code>sqlType</code> is
+ * a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>,
+ * <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>,
+ * <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>,
+ * <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code>
+ * or <code>STRUCT</code> data type and the JDBC driver does not support
+ * this data type
+ * @see Types
+ */
+ void registerOutParameter(int parameterIndex, int sqlType, int scale)
+ throws SQLException;
+
+ /**
+ * Retrieves whether the last OUT parameter read had the value of
+ * SQL <code>NULL</code>. Note that this method should be called only after
+ * calling a getter method; otherwise, there is no value to use in
+ * determining whether it is <code>null</code> or not.
+ *
+ * @return <code>true</code> if the last parameter read was SQL
+ * <code>NULL</code>; <code>false</code> otherwise
+ * @exception SQLException if a database access error occurs or
+ * this method is called on a closed <code>CallableStatement</code>
+ */
+ boolean wasNull() throws SQLException;
+
+ /**
+ * Retrieves the value of the designated JDBC <code>CHAR</code>,
+ * <code>VARCHAR</code>, or <code>LONGVARCHAR</code> parameter as a
+ * <code>String</code> in the Java programming language.
+ * <p>
+ * For the fixed-length type JDBC <code>CHAR</code>,
+ * the <code>String</code> object
+ * returned has exactly the same value the SQL
+ * <code>CHAR</code> value had in the
+ * database, including any padding added by the database.
+ *
+ * @param parameterIndex the first parameter is 1, the second is 2,
+ * and so on
+ * @return the parameter value. If the value is SQL <code>NULL</code>,
+ * the result
+ * is <code>null</code>.
+ * @exception SQLException if the parameterIndex is not valid;
+ * if a database access error occurs or
+ * this method is called on a closed <code>CallableStatement</code>
+ * @see #setString
+ */
+ String getString(int parameterIndex) throws SQLException;
+
+ /**
+ * Retrieves the value of the designated JDBC <code>BIT</code>
+ * or ...
[truncated message content] |
|
From: <ls...@us...> - 2007-06-17 07:37:17
|
Revision: 3268
http://jnode.svn.sourceforge.net/jnode/?rev=3268&view=rev
Author: lsantha
Date: 2007-06-17 00:37:15 -0700 (Sun, 17 Jun 2007)
Log Message:
-----------
Openjdk integration.
Removed Paths:
-------------
trunk/core/src/classpath/java/java/sql/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-17 07:16:57
|
Revision: 3267
http://jnode.svn.sourceforge.net/jnode/?rev=3267&view=rev
Author: lsantha
Date: 2007-06-17 00:16:55 -0700 (Sun, 17 Jun 2007)
Log Message:
-----------
Openjdk integration.
Modified Paths:
--------------
trunk/core/src/classpath/java/java/util/jar/JarEntry.java
trunk/core/src/classpath/java/java/util/jar/JarFile.java
Removed Paths:
-------------
trunk/core/src/classpath/java/java/util/Properties.java
Deleted: trunk/core/src/classpath/java/java/util/Properties.java
===================================================================
--- trunk/core/src/classpath/java/java/util/Properties.java 2007-06-17 07:14:11 UTC (rev 3266)
+++ trunk/core/src/classpath/java/java/util/Properties.java 2007-06-17 07:16:55 UTC (rev 3267)
@@ -1,802 +0,0 @@
-/* Properties.java -- a set of persistent properties
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.util;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Element;
-import org.w3c.dom.bootstrap.DOMImplementationRegistry;
-import org.w3c.dom.ls.DOMImplementationLS;
-import org.w3c.dom.ls.LSOutput;
-import org.w3c.dom.ls.LSSerializer;
-
-/**
- * A set of persistent properties, which can be saved or loaded from a stream.
- * A property list may also contain defaults, searched if the main list
- * does not contain a property for a given key.
- *
- * An example of a properties file for the german language is given
- * here. This extends the example given in ListResourceBundle.
- * Create a file MyResource_de.properties with the following contents
- * and put it in the CLASSPATH. (The character
- * <code>\</code><code>u00e4</code> is the german umlaut)
- *
- *
-<pre>s1=3
-s2=MeineDisk
-s3=3. M\<code></code>u00e4rz 96
-s4=Die Diskette ''{1}'' enth\<code></code>u00e4lt {0} in {2}.
-s5=0
-s6=keine Dateien
-s7=1
-s8=eine Datei
-s9=2
-s10={0,number} Dateien
-s11=Das Formatieren schlug fehl mit folgender Exception: {0}
-s12=FEHLER
-s13=Ergebnis
-s14=Dialog
-s15=Auswahlkriterium
-s16=1,3</pre>
- *
- * <p>Although this is a sub class of a hash table, you should never
- * insert anything other than strings to this property, or several
- * methods, that need string keys and values, will fail. To ensure
- * this, you should use the <code>get/setProperty</code> method instead
- * of <code>get/put</code>.
- *
- * Properties are saved in ISO 8859-1 encoding, using Unicode escapes with
- * a single <code>u</code> for any character which cannot be represented.
- *
- * @author Jochen Hoenicke
- * @author Eric Blake (eb...@em...)
- * @see PropertyResourceBundle
- * @status updated to 1.4
- */
-public class Properties extends Hashtable<Object, Object>
-{
- // WARNING: Properties is a CORE class in the bootstrap cycle. See the
- // comments in vm/reference/java/lang/Runtime for implications of this fact.
-
- /**
- * The property list that contains default values for any keys not
- * in this property list.
- *
- * @serial the default properties
- */
- protected Properties defaults;
-
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 4112578634029874840L;
-
- /**
- * Creates a new empty property list with no default values.
- */
- public Properties()
- {
- }
-
- /**
- * Create a new empty property list with the specified default values.
- *
- * @param defaults a Properties object containing the default values
- */
- public Properties(Properties defaults)
- {
- this.defaults = defaults;
- }
-
- /**
- * Adds the given key/value pair to this properties. This calls
- * the hashtable method put.
- *
- * @param key the key for this property
- * @param value the value for this property
- * @return The old value for the given key
- * @see #getProperty(String)
- * @since 1.2
- */
- public Object setProperty(String key, String value)
- {
- return put(key, value);
- }
-
- /**
- * Reads a property list from an input stream. The stream should
- * have the following format: <br>
- *
- * An empty line or a line starting with <code>#</code> or
- * <code>!</code> is ignored. An backslash (<code>\</code>) at the
- * end of the line makes the line continueing on the next line
- * (but make sure there is no whitespace after the backslash).
- * Otherwise, each line describes a key/value pair. <br>
- *
- * The chars up to the first whitespace, = or : are the key. You
- * can include this caracters in the key, if you precede them with
- * a backslash (<code>\</code>). The key is followed by optional
- * whitespaces, optionally one <code>=</code> or <code>:</code>,
- * and optionally some more whitespaces. The rest of the line is
- * the resource belonging to the key. <br>
- *
- * Escape sequences <code>\t, \n, \r, \\, \", \', \!, \#, \ </code>(a
- * space), and unicode characters with the
- * <code>\\u</code><em>xxxx</em> notation are detected, and
- * converted to the corresponding single character. <br>
- *
- *
-<pre># This is a comment
-key = value
-k\:5 \ a string starting with space and ending with newline\n
-# This is a multiline specification; note that the value contains
-# no white space.
-weekdays: Sunday,Monday,Tuesday,Wednesday,\\
- Thursday,Friday,Saturday
-# The safest way to include a space at the end of a value:
-label = Name:\\u0020</pre>
- *
- * @param inStream the input stream
- * @throws IOException if an error occurred when reading the input
- * @throws NullPointerException if in is null
- */
- public void load(InputStream inStream) throws IOException
- {
- // The spec says that the file must be encoded using ISO-8859-1.
- BufferedReader reader =
- new BufferedReader(new InputStreamReader(inStream, "ISO-8859-1"));
- String line;
-
- while ((line = reader.readLine()) != null)
- {
- char c = 0;
- int pos = 0;
- // Leading whitespaces must be deleted first.
- while (pos < line.length()
- && Character.isWhitespace(c = line.charAt(pos)))
- pos++;
-
- // If empty line or begins with a comment character, skip this line.
- if ((line.length() - pos) == 0
- || line.charAt(pos) == '#' || line.charAt(pos) == '!')
- continue;
-
- // The characters up to the next Whitespace, ':', or '='
- // describe the key. But look for escape sequences.
- // Try to short-circuit when there is no escape char.
- int start = pos;
- boolean needsEscape = line.indexOf('\\', pos) != -1;
- StringBuilder key = needsEscape ? new StringBuilder() : null;
- while (pos < line.length()
- && ! Character.isWhitespace(c = line.charAt(pos++))
- && c != '=' && c != ':')
- {
- if (needsEscape && c == '\\')
- {
- if (pos == line.length())
- {
- // The line continues on the next line. If there
- // is no next line, just treat it as a key with an
- // empty value.
- line = reader.readLine();
- if (line == null)
- line = "";
- pos = 0;
- while (pos < line.length()
- && Character.isWhitespace(c = line.charAt(pos)))
- pos++;
- }
- else
- {
- c = line.charAt(pos++);
- switch (c)
- {
- case 'n':
- key.append('\n');
- break;
- case 't':
- key.append('\t');
- break;
- case 'r':
- key.append('\r');
- break;
- case 'u':
- if (pos + 4 <= line.length())
- {
- char uni = (char) Integer.parseInt
- (line.substring(pos, pos + 4), 16);
- key.append(uni);
- pos += 4;
- } // else throw exception?
- break;
- default:
- key.append(c);
- break;
- }
- }
- }
- else if (needsEscape)
- key.append(c);
- }
-
- boolean isDelim = (c == ':' || c == '=');
-
- String keyString;
- if (needsEscape)
- keyString = key.toString();
- else if (isDelim || Character.isWhitespace(c))
- keyString = line.substring(start, pos - 1);
- else
- keyString = line.substring(start, pos);
-
- while (pos < line.length()
- && Character.isWhitespace(c = line.charAt(pos)))
- pos++;
-
- if (! isDelim && (c == ':' || c == '='))
- {
- pos++;
- while (pos < line.length()
- && Character.isWhitespace(c = line.charAt(pos)))
- pos++;
- }
-
- // Short-circuit if no escape chars found.
- if (!needsEscape)
- {
- put(keyString, line.substring(pos));
- continue;
- }
-
- // Escape char found so iterate through the rest of the line.
- StringBuilder element = new StringBuilder(line.length() - pos);
- while (pos < line.length())
- {
- c = line.charAt(pos++);
- if (c == '\\')
- {
- if (pos == line.length())
- {
- // The line continues on the next line.
- line = reader.readLine();
-
- // We might have seen a backslash at the end of
- // the file. The JDK ignores the backslash in
- // this case, so we follow for compatibility.
- if (line == null)
- break;
-
- pos = 0;
- while (pos < line.length()
- && Character.isWhitespace(c = line.charAt(pos)))
- pos++;
- element.ensureCapacity(line.length() - pos +
- element.length());
- }
- else
- {
- c = line.charAt(pos++);
- switch (c)
- {
- case 'n':
- element.append('\n');
- break;
- case 't':
- element.append('\t');
- break;
- case 'r':
- element.append('\r');
- break;
- case 'u':
- if (pos + 4 <= line.length())
- {
- char uni = (char) Integer.parseInt
- (line.substring(pos, pos + 4), 16);
- element.append(uni);
- pos += 4;
- } // else throw exception?
- break;
- default:
- element.append(c);
- break;
- }
- }
- }
- else
- element.append(c);
- }
- put(keyString, element.toString());
- }
- }
-
- /**
- * Calls <code>store(OutputStream out, String header)</code> and
- * ignores the IOException that may be thrown.
- *
- * @param out the stream to write to
- * @param header a description of the property list
- * @throws ClassCastException if this property contains any key or
- * value that are not strings
- * @deprecated use {@link #store(OutputStream, String)} instead
- */
- @Deprecated
- public void save(OutputStream out, String header)
- {
- try
- {
- store(out, header);
- }
- catch (IOException ex)
- {
- }
- }
-
- /**
- * Writes the key/value pairs to the given output stream, in a format
- * suitable for <code>load</code>.<br>
- *
- * If header is not null, this method writes a comment containing
- * the header as first line to the stream. The next line (or first
- * line if header is null) contains a comment with the current date.
- * Afterwards the key/value pairs are written to the stream in the
- * following format.<br>
- *
- * Each line has the form <code>key = value</code>. Newlines,
- * Returns and tabs are written as <code>\n,\t,\r</code> resp.
- * The characters <code>\, !, #, =</code> and <code>:</code> are
- * preceeded by a backslash. Spaces are preceded with a backslash,
- * if and only if they are at the beginning of the key. Characters
- * that are not in the ascii range 33 to 127 are written in the
- * <code>\</code><code>u</code>xxxx Form.<br>
- *
- * Following the listing, the output stream is flushed but left open.
- *
- * @param out the output stream
- * @param header the header written in the first line, may be null
- * @throws ClassCastException if this property contains any key or
- * value that isn't a string
- * @throws IOException if writing to the stream fails
- * @throws NullPointerException if out is null
- * @since 1.2
- */
- public void store(OutputStream out, String header) throws IOException
- {
- // The spec says that the file must be encoded using ISO-8859-1.
- PrintWriter writer
- = new PrintWriter(new OutputStreamWriter(out, "ISO-8859-1"));
- if (header != null)
- writer.println("#" + header);
- writer.println ("#" + Calendar.getInstance ().getTime ());
-
- Iterator iter = entrySet ().iterator ();
- int i = size ();
- StringBuilder s = new StringBuilder (); // Reuse the same buffer.
- while (--i >= 0)
- {
- Map.Entry entry = (Map.Entry) iter.next ();
- formatForOutput ((String) entry.getKey (), s, true);
- s.append ('=');
- formatForOutput ((String) entry.getValue (), s, false);
- writer.println (s);
- }
-
- writer.flush ();
- }
-
- /**
- * Gets the property with the specified key in this property list.
- * If the key is not found, the default property list is searched.
- * If the property is not found in the default, null is returned.
- *
- * @param key The key for this property
- * @return the value for the given key, or null if not found
- * @throws ClassCastException if this property contains any key or
- * value that isn't a string
- * @see #defaults
- * @see #setProperty(String, String)
- * @see #getProperty(String, String)
- */
- public String getProperty(String key)
- {
- Properties prop = this;
- // Eliminate tail recursion.
- do
- {
- String value = (String) prop.get(key);
- if (value != null)
- return value;
- prop = prop.defaults;
- }
- while (prop != null);
- return null;
- }
-
- /**
- * Gets the property with the specified key in this property list. If
- * the key is not found, the default property list is searched. If the
- * property is not found in the default, the specified defaultValue is
- * returned.
- *
- * @param key The key for this property
- * @param defaultValue A default value
- * @return The value for the given key
- * @throws ClassCastException if this property contains any key or
- * value that isn't a string
- * @see #defaults
- * @see #setProperty(String, String)
- */
- public String getProperty(String key, String defaultValue)
- {
- String prop = getProperty(key);
- if (prop == null)
- prop = defaultValue;
- return prop;
- }
-
- /**
- * Returns an enumeration of all keys in this property list, including
- * the keys in the default property list.
- *
- * @return an Enumeration of all defined keys
- */
- public Enumeration<?> propertyNames()
- {
- // We make a new Set that holds all the keys, then return an enumeration
- // for that. This prevents modifications from ruining the enumeration,
- // as well as ignoring duplicates.
- Properties prop = this;
- Set s = new HashSet();
- // Eliminate tail recursion.
- do
- {
- s.addAll(prop.keySet());
- prop = prop.defaults;
- }
- while (prop != null);
- return Collections.enumeration(s);
- }
-
- /**
- * Prints the key/value pairs to the given print stream. This is
- * mainly useful for debugging purposes.
- *
- * @param out the print stream, where the key/value pairs are written to
- * @throws ClassCastException if this property contains a key or a
- * value that isn't a string
- * @see #list(PrintWriter)
- */
- public void list(PrintStream out)
- {
- PrintWriter writer = new PrintWriter (out);
- list (writer);
- }
-
- /**
- * Prints the key/value pairs to the given print writer. This is
- * mainly useful for debugging purposes.
- *
- * @param out the print writer where the key/value pairs are written to
- * @throws ClassCastException if this property contains a key or a
- * value that isn't a string
- * @see #list(PrintStream)
- * @since 1.1
- */
- public void list(PrintWriter out)
- {
- out.println ("-- listing properties --");
-
- Iterator iter = entrySet ().iterator ();
- int i = size ();
- while (--i >= 0)
- {
- Map.Entry entry = (Map.Entry) iter.next ();
- out.print ((String) entry.getKey () + "=");
-
- // JDK 1.3/1.4 restrict the printed value, but not the key,
- // to 40 characters, including the truncating ellipsis.
- String s = (String ) entry.getValue ();
- if (s != null && s.length () > 40)
- out.println (s.substring (0, 37) + "...");
- else
- out.println (s);
- }
- out.flush ();
- }
-
- /**
- * Formats a key or value for output in a properties file.
- * See store for a description of the format.
- *
- * @param str the string to format
- * @param buffer the buffer to add it to
- * @param key true if all ' ' must be escaped for the key, false if only
- * leading spaces must be escaped for the value
- * @see #store(OutputStream, String)
- */
- private void formatForOutput(String str, StringBuilder buffer, boolean key)
- {
- if (key)
- {
- buffer.setLength(0);
- buffer.ensureCapacity(str.length());
- }
- else
- buffer.ensureCapacity(buffer.length() + str.length());
- boolean head = true;
- int size = str.length();
- for (int i = 0; i < size; i++)
- {
- char c = str.charAt(i);
- switch (c)
- {
- case '\n':
- buffer.append("\\n");
- break;
- case '\r':
- buffer.append("\\r");
- break;
- case '\t':
- buffer.append("\\t");
- break;
- case ' ':
- buffer.append(head ? "\\ " : " ");
- break;
- case '\\':
- case '!':
- case '#':
- case '=':
- case ':':
- buffer.append('\\').append(c);
- break;
- default:
- if (c < ' ' || c > '~')
- {
- String hex = Integer.toHexString(c);
- buffer.append("\\u0000".substring(0, 6 - hex.length()));
- buffer.append(hex);
- }
- else
- buffer.append(c);
- }
- if (c != ' ')
- head = key;
- }
- }
-
- /**
- * <p>
- * Encodes the properties as an XML file using the UTF-8 encoding.
- * The format of the XML file matches the DTD
- * <a href="http://java.sun.com/dtd/properties.dtd">
- * http://java.sun.com/dtd/properties.dtd</a>.
- * </p>
- * <p>
- * Invoking this method provides the same behaviour as invoking
- * <code>storeToXML(os, comment, "UTF-8")</code>.
- * </p>
- *
- * @param os the stream to output to.
- * @param comment a comment to include at the top of the XML file, or
- * <code>null</code> if one is not required.
- * @throws IOException if the serialization fails.
- * @throws NullPointerException if <code>os</code> is null.
- * @since 1.5
- */
- public void storeToXML(OutputStream os, String comment)
- throws IOException
- {
- storeToXML(os, comment, "UTF-8");
- }
-
- /**
- * <p>
- * Encodes the properties as an XML file using the supplied encoding.
- * The format of the XML file matches the DTD
- * <a href="http://java.sun.com/dtd/properties.dtd">
- * http://java.sun.com/dtd/properties.dtd</a>.
- * </p>
- *
- * @param os the stream to output to.
- * @param comment a comment to include at the top of the XML file, or
- * <code>null</code> if one is not required.
- * @param encoding the encoding to use for the XML output.
- * @throws IOException if the serialization fails.
- * @throws NullPointerException if <code>os</code> or <code>encoding</code>
- * is null.
- * @since 1.5
- */
- public void storeToXML(OutputStream os, String comment, String encoding)
- throws IOException
- {
- if (os == null)
- throw new NullPointerException("Null output stream supplied.");
- if (encoding == null)
- throw new NullPointerException("Null encoding supplied.");
- try
- {
- DOMImplementationRegistry registry =
- DOMImplementationRegistry.newInstance();
- DOMImplementation domImpl = registry.getDOMImplementation("LS 3.0");
- DocumentType doctype =
- domImpl.createDocumentType("properties", null,
- "http://java.sun.com/dtd/properties.dtd");
- Document doc = domImpl.createDocument(null, "properties", doctype);
- Element root = doc.getDocumentElement();
- if (comment != null)
- {
- Element commentElement = doc.createElement("comment");
- commentElement.appendChild(doc.createTextNode(comment));
- root.appendChild(commentElement);
- }
- Iterator iterator = entrySet().iterator();
- while (iterator.hasNext())
- {
- Map.Entry entry = (Map.Entry) iterator.next();
- Element entryElement = doc.createElement("entry");
- entryElement.setAttribute("key", (String) entry.getKey());
- entryElement.appendChild(doc.createTextNode((String)
- entry.getValue()));
- root.appendChild(entryElement);
- }
- DOMImplementationLS loadAndSave = (DOMImplementationLS) domImpl;
- LSSerializer serializer = loadAndSave.createLSSerializer();
- LSOutput output = loadAndSave.createLSOutput();
- output.setByteStream(os);
- output.setEncoding(encoding);
- serializer.write(doc, output);
- }
- catch (ClassNotFoundException e)
- {
- throw (IOException)
- new IOException("The XML classes could not be found.").initCause(e);
- }
- catch (InstantiationException e)
- {
- throw (IOException)
- new IOException("The XML classes could not be instantiated.")
- .initCause(e);
- }
- catch (IllegalAccessException e)
- {
- throw (IOException)
- new IOException("The XML classes could not be accessed.")
- .initCause(e);
- }
- }
-
- /**
- * <p>
- * Decodes the contents of the supplied <code>InputStream</code> as
- * an XML file, which represents a set of properties. The format of
- * the XML file must match the DTD
- * <a href="http://java.sun.com/dtd/properties.dtd">
- * http://java.sun.com/dtd/properties.dtd</a>.
- * </p>
- *
- * @param in the input stream from which to receive the XML data.
- * @throws IOException if an I/O error occurs in reading the input data.
- * @throws InvalidPropertiesFormatException if the input data does not
- * constitute an XML properties
- * file.
- * @throws NullPointerException if <code>in</code> is null.
- * @since 1.5
- */
- public void loadFromXML(InputStream in)
- throws IOException, InvalidPropertiesFormatException
- {
- if (in == null)
- throw new NullPointerException("Null input stream supplied.");
- try
- {
- XMLInputFactory factory = XMLInputFactory.newInstance();
- // Don't resolve external entity references
- factory.setProperty("javax.xml.stream.isSupportingExternalEntities",
- Boolean.FALSE);
- XMLStreamReader reader = factory.createXMLStreamReader(in);
- String name, key = null;
- StringBuffer buf = null;
- while (reader.hasNext())
- {
- switch (reader.next())
- {
- case XMLStreamConstants.START_ELEMENT:
- name = reader.getLocalName();
- if (buf == null && "entry".equals(name))
- {
- key = reader.getAttributeValue(null, "key");
- if (key == null)
- {
- String msg = "missing 'key' attribute";
- throw new InvalidPropertiesFormatException(msg);
- }
- buf = new StringBuffer();
- }
- else if (!"properties".equals(name) && !"comment".equals(name))
- {
- String msg = "unexpected element name '" + name + "'";
- throw new InvalidPropertiesFormatException(msg);
- }
- break;
- case XMLStreamConstants.END_ELEMENT:
- name = reader.getLocalName();
- if (buf != null && "entry".equals(name))
- {
- put(key, buf.toString());
- buf = null;
- }
- else if (!"properties".equals(name) && !"comment".equals(name))
- {
- String msg = "unexpected element name '" + name + "'";
- throw new InvalidPropertiesFormatException(msg);
- }
- break;
- case XMLStreamConstants.CHARACTERS:
- case XMLStreamConstants.SPACE:
- case XMLStreamConstants.CDATA:
- if (buf != null)
- buf.append(reader.getText());
- break;
- }
- }
- reader.close();
- }
- catch (XMLStreamException e)
- {
- throw (InvalidPropertiesFormatException)
- new InvalidPropertiesFormatException("Error in parsing XML.").
- initCause(e);
- }
- }
-
-} // class Properties
Modified: trunk/core/src/classpath/java/java/util/jar/JarEntry.java
===================================================================
--- trunk/core/src/classpath/java/java/util/jar/JarEntry.java 2007-06-17 07:14:11 UTC (rev 3266)
+++ trunk/core/src/classpath/java/java/util/jar/JarEntry.java 2007-06-17 07:16:55 UTC (rev 3267)
@@ -39,6 +39,7 @@
import java.io.IOException;
import java.security.cert.Certificate;
+import java.security.CodeSigner;
import java.util.Set;
import java.util.zip.ZipEntry;
@@ -169,4 +170,9 @@
}
return null;
}
+ //@jnode
+ public CodeSigner[] getCodeSigners() {
+ //todo implement
+ return null;
+ }
}
Modified: trunk/core/src/classpath/java/java/util/jar/JarFile.java
===================================================================
--- trunk/core/src/classpath/java/java/util/jar/JarFile.java 2007-06-17 07:14:11 UTC (rev 3266)
+++ trunk/core/src/classpath/java/java/util/jar/JarFile.java 2007-06-17 07:16:55 UTC (rev 3267)
@@ -806,6 +806,15 @@
return verified > 0;
}
+ //openjdk feature
+ // attribute. Returns false if there is no manifest or the manifest
+ // does not contain a "Class-Path" attribute. Currently exported to
+ // core libraries via sun.misc.SharedSecrets.
+ boolean hasClassPathAttribute() throws IOException {
+ //todo IMPLEMENT
+ return false;
+ }
+
/**
* A utility class that verifies jar entries as they are read.
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-17 07:14:13
|
Revision: 3266
http://jnode.svn.sourceforge.net/jnode/?rev=3266&view=rev
Author: lsantha
Date: 2007-06-17 00:14:11 -0700 (Sun, 17 Jun 2007)
Log Message:
-----------
Openjdk integration.
Modified Paths:
--------------
trunk/core/src/classpath/java/java/lang/String.java
Removed Paths:
-------------
trunk/core/src/classpath/java/java/lang/Byte.java
trunk/core/src/classpath/java/java/lang/Integer.java
trunk/core/src/classpath/java/java/lang/Long.java
trunk/core/src/classpath/java/java/lang/NumberFormatException.java
trunk/core/src/classpath/java/java/lang/Short.java
Deleted: trunk/core/src/classpath/java/java/lang/Byte.java
===================================================================
--- trunk/core/src/classpath/java/java/lang/Byte.java 2007-06-17 07:09:54 UTC (rev 3265)
+++ trunk/core/src/classpath/java/java/lang/Byte.java 2007-06-17 07:14:11 UTC (rev 3266)
@@ -1,373 +0,0 @@
-/* Byte.java -- object wrapper for byte
- Copyright (C) 1998, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Instances of class <code>Byte</code> represent primitive <code>byte</code>
- * values.
- *
- * Additionally, this class provides various helper functions and variables
- * useful to bytes.
- *
- * @author Paul Fisher
- * @author John Keiser
- * @author Per Bothner
- * @author Eric Blake (eb...@em...)
- * @author Tom Tromey (tr...@re...)
- * @author Andrew John Hughes (gnu...@me...)
- * @since 1.1
- * @status updated to 1.5
- */
-public final class Byte extends Number implements Comparable<Byte>
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -7183698231559129828L;
-
- /**
- * The minimum value a <code>byte</code> can represent is -128 (or
- * -2<sup>7</sup>).
- */
- public static final byte MIN_VALUE = -128;
-
- /**
- * The maximum value a <code>byte</code> can represent is 127 (or
- * 2<sup>7</sup> - 1).
- */
- public static final byte MAX_VALUE = 127;
-
- /**
- * The primitive type <code>byte</code> is represented by this
- * <code>Class</code> object.
- */
- public static final Class<Byte> TYPE = (Class<Byte>) VMClassLoader.getPrimitiveClass('B');
-
- /**
- * The number of bits needed to represent a <code>byte</code>.
- * @since 1.5
- */
- public static final int SIZE = 8;
-
- // This caches Byte values, and is used by boxing conversions via
- // valueOf(). We're required to cache all possible values here.
- private static Byte[] byteCache = new Byte[MAX_VALUE - MIN_VALUE + 1];
-
-
- /**
- * The immutable value of this Byte.
- *
- * @serial the wrapped byte
- */
- private final byte value;
-
- /**
- * Create a <code>Byte</code> object representing the value of the
- * <code>byte</code> argument.
- *
- * @param value the value to use
- */
- public Byte(byte value)
- {
- this.value = value;
- }
-
- /**
- * Create a <code>Byte</code> object representing the value specified
- * by the <code>String</code> argument
- *
- * @param s the string to convert
- * @throws NumberFormatException if the String does not contain a byte
- * @see #valueOf(String)
- */
- public Byte(String s)
- {
- value = parseByte(s, 10);
- }
-
- /**
- * Converts the <code>byte</code> to a <code>String</code> and assumes
- * a radix of 10.
- *
- * @param b the <code>byte</code> to convert to <code>String</code>
- * @return the <code>String</code> representation of the argument
- */
- public static String toString(byte b)
- {
- return String.valueOf(b);
- }
-
- /**
- * Converts the specified <code>String</code> into a <code>byte</code>.
- * This function assumes a radix of 10.
- *
- * @param s the <code>String</code> to convert
- * @return the <code>byte</code> value of <code>s</code>
- * @throws NumberFormatException if <code>s</code> cannot be parsed as a
- * <code>byte</code>
- * @see #parseByte(String)
- */
- public static byte parseByte(String s)
- {
- return parseByte(s, 10);
- }
-
- /**
- * Converts the specified <code>String</code> into an <code>int</code>
- * using the specified radix (base). The string must not be <code>null</code>
- * or empty. It may begin with an optional '-', which will negate the answer,
- * provided that there are also valid digits. Each digit is parsed as if by
- * <code>Character.digit(d, radix)</code>, and must be in the range
- * <code>0</code> to <code>radix - 1</code>. Finally, the result must be
- * within <code>MIN_VALUE</code> to <code>MAX_VALUE</code>, inclusive.
- * Unlike Double.parseDouble, you may not have a leading '+'.
- *
- * @param s the <code>String</code> to convert
- * @param radix the radix (base) to use in the conversion
- * @return the <code>String</code> argument converted to <code>byte</code>
- * @throws NumberFormatException if <code>s</code> cannot be parsed as a
- * <code>byte</code>
- */
- public static byte parseByte(String s, int radix)
- {
- int i = Integer.parseInt(s, radix, false);
- if ((byte) i != i)
- throw new NumberFormatException();
- return (byte) i;
- }
-
- /**
- * Creates a new <code>Byte</code> object using the <code>String</code>
- * and specified radix (base).
- *
- * @param s the <code>String</code> to convert
- * @param radix the radix (base) to convert with
- * @return the new <code>Byte</code>
- * @throws NumberFormatException if <code>s</code> cannot be parsed as a
- * <code>byte</code>
- * @see #parseByte(String, int)
- */
- public static Byte valueOf(String s, int radix)
- {
- return new Byte(parseByte(s, radix));
- }
-
- /**
- * Creates a new <code>Byte</code> object using the <code>String</code>,
- * assuming a radix of 10.
- *
- * @param s the <code>String</code> to convert
- * @return the new <code>Byte</code>
- * @throws NumberFormatException if <code>s</code> cannot be parsed as a
- * <code>byte</code>
- * @see #Byte(String)
- * @see #parseByte(String)
- */
- public static Byte valueOf(String s)
- {
- return new Byte(parseByte(s, 10));
- }
-
- /**
- * Returns a <code>Byte</code> object wrapping the value.
- * In contrast to the <code>Byte</code> constructor, this method
- * will cache some values. It is used by boxing conversion.
- *
- * @param val the value to wrap
- * @return the <code>Byte</code>
- */
- public static Byte valueOf(byte val)
- {
- synchronized (byteCache)
- {
- if (byteCache[val - MIN_VALUE] == null)
- byteCache[val - MIN_VALUE] = new Byte(val);
- return byteCache[val - MIN_VALUE];
- }
- }
-
- /**
- * Convert the specified <code>String</code> into a <code>Byte</code>.
- * The <code>String</code> may represent decimal, hexadecimal, or
- * octal numbers.
- *
- * <p>The extended BNF grammar is as follows:<br>
- * <pre>
- * <em>DecodableString</em>:
- * ( [ <code>-</code> ] <em>DecimalNumber</em> )
- * | ( [ <code>-</code> ] ( <code>0x</code> | <code>0X</code>
- * | <code>#</code> ) { <em>HexDigit</em> }+ )
- * | ( [ <code>-</code> ] <code>0</code> { <em>OctalDigit</em> } )
- * <em>DecimalNumber</em>:
- * <em>DecimalDigit except '0'</em> { <em>DecimalDigit</em> }
- * <em>DecimalDigit</em>:
- * <em>Character.digit(d, 10) has value 0 to 9</em>
- * <em>OctalDigit</em>:
- * <em>Character.digit(d, 8) has value 0 to 7</em>
- * <em>DecimalDigit</em>:
- * <em>Character.digit(d, 16) has value 0 to 15</em>
- * </pre>
- * Finally, the value must be in the range <code>MIN_VALUE</code> to
- * <code>MAX_VALUE</code>, or an exception is thrown.
- *
- * @param s the <code>String</code> to interpret
- * @return the value of the String as a <code>Byte</code>
- * @throws NumberFormatException if <code>s</code> cannot be parsed as a
- * <code>byte</code>
- * @throws NullPointerException if <code>s</code> is null
- * @see Integer#decode(String)
- */
- public static Byte decode(String s)
- {
- int i = Integer.parseInt(s, 10, true);
- if ((byte) i != i)
- throw new NumberFormatException();
- return new Byte((byte) i);
- }
-
- /**
- * Return the value of this <code>Byte</code>.
- *
- * @return the byte value
- */
- public byte byteValue()
- {
- return value;
- }
-
- /**
- * Return the value of this <code>Byte</code> as a <code>short</code>.
- *
- * @return the short value
- */
- public short shortValue()
- {
- return value;
- }
-
- /**
- * Return the value of this <code>Byte</code> as an <code>int</code>.
- *
- * @return the int value
- */
- public int intValue()
- {
- return value;
- }
-
- /**
- * Return the value of this <code>Byte</code> as a <code>long</code>.
- *
- * @return the long value
- */
- public long longValue()
- {
- return value;
- }
-
- /**
- * Return the value of this <code>Byte</code> as a <code>float</code>.
- *
- * @return the float value
- */
- public float floatValue()
- {
- return value;
- }
-
- /**
- * Return the value of this <code>Byte</code> as a <code>double</code>.
- *
- * @return the double value
- */
- public double doubleValue()
- {
- return value;
- }
-
- /**
- * Converts the <code>Byte</code> value to a <code>String</code> and
- * assumes a radix of 10.
- *
- * @return the <code>String</code> representation of this <code>Byte</code>
- * @see Integer#toString()
- */
- public String toString()
- {
- return String.valueOf(value);
- }
-
- /**
- * Return a hashcode representing this Object. <code>Byte</code>'s hash
- * code is simply its value.
- *
- * @return this Object's hash code
- */
- public int hashCode()
- {
- return value;
- }
-
- /**
- * Returns <code>true</code> if <code>obj</code> is an instance of
- * <code>Byte</code> and represents the same byte value.
- *
- * @param obj the object to compare
- * @return whether these Objects are semantically equal
- */
- public boolean equals(Object obj)
- {
- return obj instanceof Byte && value == ((Byte) obj).value;
- }
-
- /**
- * Compare two Bytes numerically by comparing their <code>byte</code> values.
- * The result is positive if the first is greater, negative if the second
- * is greater, and 0 if the two are equal.
- *
- * @param b the Byte to compare
- * @return the comparison
- * @since 1.2
- */
- public int compareTo(Byte b)
- {
- return value - b.value;
- }
-
-}
Deleted: trunk/core/src/classpath/java/java/lang/Integer.java
===================================================================
--- trunk/core/src/classpath/java/java/lang/Integer.java 2007-06-17 07:09:54 UTC (rev 3265)
+++ trunk/core/src/classpath/java/java/lang/Integer.java 2007-06-17 07:14:11 UTC (rev 3266)
@@ -1,757 +0,0 @@
-/* Integer.java -- object wrapper for int
- Copyright (C) 1998, 1999, 2001, 2002, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Instances of class <code>Integer</code> represent primitive
- * <code>int</code> values.
- *
- * Additionally, this class provides various helper functions and variables
- * related to ints.
- *
- * @author Paul Fisher
- * @author John Keiser
- * @author Warren Levy
- * @author Eric Blake (eb...@em...)
- * @author Tom Tromey (tr...@re...)
- * @author Andrew John Hughes (gnu...@me...)
- * @since 1.0
- * @status updated to 1.5
- */
-public final class Integer extends Number implements Comparable<Integer>
-{
- /**
- * Compatible with JDK 1.0.2+.
- */
- private static final long serialVersionUID = 1360826667806852920L;
-
- /**
- * The minimum value an <code>int</code> can represent is -2147483648 (or
- * -2<sup>31</sup>).
- */
- public static final int MIN_VALUE = 0x80000000;
-
- /**
- * The maximum value an <code>int</code> can represent is 2147483647 (or
- * 2<sup>31</sup> - 1).
- */
- public static final int MAX_VALUE = 0x7fffffff;
-
- /**
- * The primitive type <code>int</code> is represented by this
- * <code>Class</code> object.
- * @since 1.1
- */
- public static final Class<Integer> TYPE = (Class<Integer>) VMClassLoader.getPrimitiveClass('I');
-
- /**
- * The number of bits needed to represent an <code>int</code>.
- * @since 1.5
- */
- public static final int SIZE = 32;
-
- // This caches some Integer values, and is used by boxing
- // conversions via valueOf(). We must cache at least -128..127;
- // these constants control how much we actually cache.
- private static final int MIN_CACHE = -128;
- private static final int MAX_CACHE = 127;
- private static Integer[] intCache = new Integer[MAX_CACHE - MIN_CACHE + 1];
-
- /**
- * The immutable value of this Integer.
- *
- * @serial the wrapped int
- */
- private final int value;
-
- /**
- * Create an <code>Integer</code> object representing the value of the
- * <code>int</code> argument.
- *
- * @param value the value to use
- */
- public Integer(int value)
- {
- this.value = value;
- }
-
- /**
- * Create an <code>Integer</code> object representing the value of the
- * argument after conversion to an <code>int</code>.
- *
- * @param s the string to convert
- * @throws NumberFormatException if the String does not contain an int
- * @see #valueOf(String)
- */
- public Integer(String s)
- {
- value = parseInt(s, 10, false);
- }
-
- /**
- * Converts the <code>int</code> to a <code>String</code> using
- * the specified radix (base). If the radix exceeds
- * <code>Character.MIN_RADIX</code> or <code>Character.MAX_RADIX</code>, 10
- * is used instead. If the result is negative, the leading character is
- * '-' ('\\u002D'). The remaining characters come from
- * <code>Character.forDigit(digit, radix)</code> ('0'-'9','a'-'z').
- *
- * @param num the <code>int</code> to convert to <code>String</code>
- * @param radix the radix (base) to use in the conversion
- * @return the <code>String</code> representation of the argument
- */
- public static String toString(int num, int radix)
- {
- if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
- radix = 10;
-
- // For negative numbers, print out the absolute value w/ a leading '-'.
- // Use an array large enough for a binary number.
- char[] buffer = new char[33];
- int i = 33;
- boolean isNeg = false;
- if (num < 0)
- {
- isNeg = true;
- num = -num;
-
- // When the value is MIN_VALUE, it overflows when made positive
- if (num < 0)
- {
- buffer[--i] = digits[(int) (-(num + radix) % radix)];
- num = -(num / radix);
- }
- }
-
- do
- {
- buffer[--i] = digits[num % radix];
- num /= radix;
- }
- while (num > 0);
-
- if (isNeg)
- buffer[--i] = '-';
-
- // Package constructor avoids an array copy.
- return new String(buffer, i, 33 - i, true);
- }
-
- /**
- * Converts the <code>int</code> to a <code>String</code> assuming it is
- * unsigned in base 16.
- *
- * @param i the <code>int</code> to convert to <code>String</code>
- * @return the <code>String</code> representation of the argument
- */
- public static String toHexString(int i)
- {
- return toUnsignedString(i, 4);
- }
-
- /**
- * Converts the <code>int</code> to a <code>String</code> assuming it is
- * unsigned in base 8.
- *
- * @param i the <code>int</code> to convert to <code>String</code>
- * @return the <code>String</code> representation of the argument
- */
- public static String toOctalString(int i)
- {
- return toUnsignedString(i, 3);
- }
-
- /**
- * Converts the <code>int</code> to a <code>String</code> assuming it is
- * unsigned in base 2.
- *
- * @param i the <code>int</code> to convert to <code>String</code>
- * @return the <code>String</code> representation of the argument
- */
- public static String toBinaryString(int i)
- {
- return toUnsignedString(i, 1);
- }
-
- /**
- * Converts the <code>int</code> to a <code>String</code> and assumes
- * a radix of 10.
- *
- * @param i the <code>int</code> to convert to <code>String</code>
- * @return the <code>String</code> representation of the argument
- * @see #toString(int, int)
- */
- public static String toString(int i)
- {
- // This is tricky: in libgcj, String.valueOf(int) is a fast native
- // implementation. In Classpath it just calls back to
- // Integer.toString(int, int).
- return String.valueOf(i);
- }
-
- /**
- * Converts the specified <code>String</code> into an <code>int</code>
- * using the specified radix (base). The string must not be <code>null</code>
- * or empty. It may begin with an optional '-', which will negate the answer,
- * provided that there are also valid digits. Each digit is parsed as if by
- * <code>Character.digit(d, radix)</code>, and must be in the range
- * <code>0</code> to <code>radix - 1</code>. Finally, the result must be
- * within <code>MIN_VALUE</code> to <code>MAX_VALUE</code>, inclusive.
- * Unlike Double.parseDouble, you may not have a leading '+'.
- *
- * @param str the <code>String</code> to convert
- * @param radix the radix (base) to use in the conversion
- * @return the <code>String</code> argument converted to <code>int</code>
- * @throws NumberFormatException if <code>s</code> cannot be parsed as an
- * <code>int</code>
- */
- public static int parseInt(String str, int radix)
- {
- return parseInt(str, radix, false);
- }
-
- /**
- * Converts the specified <code>String</code> into an <code>int</code>.
- * This function assumes a radix of 10.
- *
- * @param s the <code>String</code> to convert
- * @return the <code>int</code> value of <code>s</code>
- * @throws NumberFormatException if <code>s</code> cannot be parsed as an
- * <code>int</code>
- * @see #parseInt(String, int)
- */
- public static int parseInt(String s)
- {
- return parseInt(s, 10, false);
- }
-
- /**
- * Creates a new <code>Integer</code> object using the <code>String</code>
- * and specified radix (base).
- *
- * @param s the <code>String</code> to convert
- * @param radix the radix (base) to convert with
- * @return the new <code>Integer</code>
- * @throws NumberFormatException if <code>s</code> cannot be parsed as an
- * <code>int</code>
- * @see #parseInt(String, int)
- */
- public static Integer valueOf(String s, int radix)
- {
- return new Integer(parseInt(s, radix, false));
- }
-
- /**
- * Creates a new <code>Integer</code> object using the <code>String</code>,
- * assuming a radix of 10.
- *
- * @param s the <code>String</code> to convert
- * @return the new <code>Integer</code>
- * @throws NumberFormatException if <code>s</code> cannot be parsed as an
- * <code>int</code>
- * @see #Integer(String)
- * @see #parseInt(String)
- */
- public static Integer valueOf(String s)
- {
- return new Integer(parseInt(s, 10, false));
- }
-
- /**
- * Returns an <code>Integer</code> object wrapping the value.
- * In contrast to the <code>Integer</code> constructor, this method
- * will cache some values. It is used by boxing conversion.
- *
- * @param val the value to wrap
- * @return the <code>Integer</code>
- */
- public static Integer valueOf(int val)
- {
- if (val < MIN_CACHE || val > MAX_CACHE)
- return new Integer(val);
- synchronized (intCache)
- {
- if (intCache[val - MIN_CACHE] == null)
- intCache[val - MIN_CACHE] = new Integer(val);
- return intCache[val - MIN_CACHE];
- }
- }
-
- /**
- * Return the value of this <code>Integer</code> as a <code>byte</code>.
- *
- * @return the byte value
- */
- public byte byteValue()
- {
- return (byte) value;
- }
-
- /**
- * Return the value of this <code>Integer</code> as a <code>short</code>.
- *
- * @return the short value
- */
- public short shortValue()
- {
- return (short) value;
- }
-
- /**
- * Return the value of this <code>Integer</code>.
- * @return the int value
- */
- public int intValue()
- {
- return value;
- }
-
- /**
- * Return the value of this <code>Integer</code> as a <code>long</code>.
- *
- * @return the long value
- */
- public long longValue()
- {
- return value;
- }
-
- /**
- * Return the value of this <code>Integer</code> as a <code>float</code>.
- *
- * @return the float value
- */
- public float floatValue()
- {
- return value;
- }
-
- /**
- * Return the value of this <code>Integer</code> as a <code>double</code>.
- *
- * @return the double value
- */
- public double doubleValue()
- {
- return value;
- }
-
- /**
- * Converts the <code>Integer</code> value to a <code>String</code> and
- * assumes a radix of 10.
- *
- * @return the <code>String</code> representation
- */
- public String toString()
- {
- return String.valueOf(value);
- }
-
- /**
- * Return a hashcode representing this Object. <code>Integer</code>'s hash
- * code is simply its value.
- *
- * @return this Object's hash code
- */
- public int hashCode()
- {
- return value;
- }
-
- /**
- * Returns <code>true</code> if <code>obj</code> is an instance of
- * <code>Integer</code> and represents the same int value.
- *
- * @param obj the object to compare
- * @return whether these Objects are semantically equal
- */
- public boolean equals(Object obj)
- {
- return obj instanceof Integer && value == ((Integer) obj).value;
- }
-
- /**
- * Get the specified system property as an <code>Integer</code>. The
- * <code>decode()</code> method will be used to interpret the value of
- * the property.
- *
- * @param nm the name of the system property
- * @return the system property as an <code>Integer</code>, or null if the
- * property is not found or cannot be decoded
- * @throws SecurityException if accessing the system property is forbidden
- * @see System#getProperty(String)
- * @see #decode(String)
- */
- public static Integer getInteger(String nm)
- {
- return getInteger(nm, null);
- }
-
- /**
- * Get the specified system property as an <code>Integer</code>, or use a
- * default <code>int</code> value if the property is not found or is not
- * decodable. The <code>decode()</code> method will be used to interpret
- * the value of the property.
- *
- * @param nm the name of the system property
- * @param val the default value
- * @return the value of the system property, or the default
- * @throws SecurityException if accessing the system property is forbidden
- * @see System#getProperty(String)
- * @see #decode(String)
- */
- public static Integer getInteger(String nm, int val)
- {
- Integer result = getInteger(nm, null);
- return result == null ? new Integer(val) : result;
- }
-
- /**
- * Get the specified system property as an <code>Integer</code>, or use a
- * default <code>Integer</code> value if the property is not found or is
- * not decodable. The <code>decode()</code> method will be used to
- * interpret the value of the property.
- *
- * @param nm the name of the system property
- * @param def the default value
- * @return the value of the system property, or the default
- * @throws SecurityException if accessing the system property is forbidden
- * @see System#getProperty(String)
- * @see #decode(String)
- */
- public static Integer getInteger(String nm, Integer def)
- {
- if (nm == null || "".equals(nm))
- return def;
- nm = System.getProperty(nm);
- if (nm == null)
- return def;
- try
- {
- return decode(nm);
- }
- catch (NumberFormatException e)
- {
- return def;
- }
- }
-
- /**
- * Convert the specified <code>String</code> into an <code>Integer</code>.
- * The <code>String</code> may represent decimal, hexadecimal, or
- * octal numbers.
- *
- * <p>The extended BNF grammar is as follows:<br>
- * <pre>
- * <em>DecodableString</em>:
- * ( [ <code>-</code> ] <em>DecimalNumber</em> )
- * | ( [ <code>-</code> ] ( <code>0x</code> | <code>0X</code>
- * | <code>#</code> ) <em>HexDigit</em> { <em>HexDigit</em> } )
- * | ( [ <code>-</code> ] <code>0</code> { <em>OctalDigit</em> } )
- * <em>DecimalNumber</em>:
- * <em>DecimalDigit except '0'</em> { <em>DecimalDigit</em> }
- * <em>DecimalDigit</em>:
- * <em>Character.digit(d, 10) has value 0 to 9</em>
- * <em>OctalDigit</em>:
- * <em>Character.digit(d, 8) has value 0 to 7</em>
- * <em>DecimalDigit</em>:
- * <em>Character.digit(d, 16) has value 0 to 15</em>
- * </pre>
- * Finally, the value must be in the range <code>MIN_VALUE</code> to
- * <code>MAX_VALUE</code>, or an exception is thrown.
- *
- * @param str the <code>String</code> to interpret
- * @return the value of the String as an <code>Integer</code>
- * @throws NumberFormatException if <code>s</code> cannot be parsed as a
- * <code>int</code>
- * @throws NullPointerException if <code>s</code> is null
- * @since 1.2
- */
- public static Integer decode(String str)
- {
- return new Integer(parseInt(str, 10, true));
- }
-
- /**
- * Compare two Integers numerically by comparing their <code>int</code>
- * values. The result is positive if the first is greater, negative if the
- * second is greater, and 0 if the two are equal.
- *
- * @param i the Integer to compare
- * @return the comparison
- * @since 1.2
- */
- public int compareTo(Integer i)
- {
- if (value == i.value)
- return 0;
- // Returns just -1 or 1 on inequality; doing math might overflow.
- return value > i.value ? 1 : -1;
- }
-
- /**
- * Return the number of bits set in x.
- * @param x value to examine
- * @since 1.5
- */
- public static int bitCount(int x)
- {
- // Successively collapse alternating bit groups into a sum.
- x = ((x >> 1) & 0x55555555) + (x & 0x55555555);
- x = ((x >> 2) & 0x33333333) + (x & 0x33333333);
- x = ((x >> 4) & 0x0f0f0f0f) + (x & 0x0f0f0f0f);
- x = ((x >> 8) & 0x00ff00ff) + (x & 0x00ff00ff);
- return ((x >> 16) & 0x0000ffff) + (x & 0x0000ffff);
- }
-
- /**
- * Rotate x to the left by distance bits.
- * @param x the value to rotate
- * @param distance the number of bits by which to rotate
- * @since 1.5
- */
- public static int rotateLeft(int x, int distance)
- {
- // This trick works because the shift operators implicitly mask
- // the shift count.
- return (x << distance) | (x >>> - distance);
- }
-
- /**
- * Rotate x to the right by distance bits.
- * @param x the value to rotate
- * @param distance the number of bits by which to rotate
- * @since 1.5
- */
- public static int rotateRight(int x, int distance)
- {
- // This trick works because the shift operators implicitly mask
- // the shift count.
- return (x << - distance) | (x >>> distance);
- }
-
- /**
- * Find the highest set bit in value, and return a new value
- * with only that bit set.
- * @param value the value to examine
- * @since 1.5
- */
- public static int highestOneBit(int value)
- {
- value |= value >>> 1;
- value |= value >>> 2;
- value |= value >>> 4;
- value |= value >>> 8;
- value |= value >>> 16;
- return value ^ (value >>> 1);
- }
-
- /**
- * Return the number of leading zeros in value.
- * @param value the value to examine
- * @since 1.5
- */
- public static int numberOfLeadingZeros(int value)
- {
- value |= value >>> 1;
- value |= value >>> 2;
- value |= value >>> 4;
- value |= value >>> 8;
- value |= value >>> 16;
- return bitCount(~value);
- }
-
- /**
- * Find the lowest set bit in value, and return a new value
- * with only that bit set.
- * @param value the value to examine
- * @since 1.5
- */
- public static int lowestOneBit(int value)
- {
- // Classic assembly trick.
- return value & - value;
- }
-
- /**
- * Find the number of trailing zeros in value.
- * @param value the value to examine
- * @since 1.5
- */
- public static int numberOfTrailingZeros(int value)
- {
- return bitCount((value & -value) - 1);
- }
-
- /**
- * Return 1 if x is positive, -1 if it is negative, and 0 if it is
- * zero.
- * @param x the value to examine
- * @since 1.5
- */
- public static int signum(int x)
- {
- return x < 0 ? -1 : (x > 0 ? 1 : 0);
- }
-
- /**
- * Reverse the bytes in val.
- * @since 1.5
- */
- public static int reverseBytes(int val)
- {
- return ( ((val >> 24) & 0xff)
- | ((val >> 8) & 0xff00)
- | ((val << 8) & 0xff0000)
- | ((val << 24) & 0xff000000));
- }
-
- /**
- * Reverse the bits in val.
- * @since 1.5
- */
- public static int reverse(int val)
- {
- // Successively swap alternating bit groups.
- val = ((val >> 1) & 0x55555555) + ((val << 1) & ~0x55555555);
- val = ((val >> 2) & 0x33333333) + ((val << 2) & ~0x33333333);
- val = ((val >> 4) & 0x0f0f0f0f) + ((val << 4) & ~0x0f0f0f0f);
- val = ((val >> 8) & 0x00ff00ff) + ((val << 8) & ~0x00ff00ff);
- return ((val >> 16) & 0x0000ffff) + ((val << 16) & ~0x0000ffff);
- }
-
- /**
- * Helper for converting unsigned numbers to String.
- *
- * @param num the number
- * @param exp log2(digit) (ie. 1, 3, or 4 for binary, oct, hex)
- */
- // Package visible for use by Long.
- static String toUnsignedString(int num, int exp)
- {
- // Use an array large enough for a binary number.
- int mask = (1 << exp) - 1;
- char[] buffer = new char[32];
- int i = 32;
- do
- {
- buffer[--i] = digits[num & mask];
- num >>>= exp;
- }
- while (num != 0);
-
- // Package constructor avoids an array copy.
- return new String(buffer, i, 32 - i, true);
- }
-
- /**
- * Helper for parsing ints, used by Integer, Short, and Byte.
- *
- * @param str the string to parse
- * @param radix the radix to use, must be 10 if decode is true
- * @param decode if called from decode
- * @return the parsed int value
- * @throws NumberFormatException if there is an error
- * @throws NullPointerException if decode is true and str if null
- * @see #parseInt(String, int)
- * @see #decode(String)
- * @see Byte#parseByte(String, int)
- * @see Short#parseShort(String, int)
- */
- static int parseInt(String str, int radix, boolean decode)
- {
- if (! decode && str == null)
- throw new NumberFormatException();
- int index = 0;
- int len = str.length();
- boolean isNeg = false;
- if (len == 0)
- throw new NumberFormatException("string length is null");
- int ch = str.charAt(index);
- if (ch == '-')
- {
- if (len == 1)
- throw new NumberFormatException("pure '-'");
- isNeg = true;
- ch = str.charAt(++index);
- }
- if (decode)
- {
- if (ch == '0')
- {
- if (++index == len)
- return 0;
- if ((str.charAt(index) & ~('x' ^ 'X')) == 'X')
- {
- radix = 16;
- index++;
- }
- else
- radix = 8;
- }
- else if (ch == '#')
- {
- radix = 16;
- index++;
- }
- }
- if (index == len)
- throw new NumberFormatException("non terminated number: " + str);
-
- int max = MAX_VALUE / radix;
- // We can't directly write `max = (MAX_VALUE + 1) / radix'.
- // So instead we fake it.
- if (isNeg && MAX_VALUE % radix == radix - 1)
- ++max;
-
- int val = 0;
- while (index < len)
- {
- if (val < 0 || val > max)
- throw new NumberFormatException("number overflow (pos=" + index + ") : " + str);
-
- ch = Character.digit(str.charAt(index++), radix);
- val = val * radix + ch;
- if (ch < 0 || (val < 0 && (! isNeg || val != MIN_VALUE)))
- throw new NumberFormatException("invalid character at position " + index + " in " + str);
- }
- return isNeg ? -val : val;
- }
-}
Deleted: trunk/core/src/classpath/java/java/lang/Long.java
===================================================================
--- trunk/core/src/classpath/java/java/lang/Long.java 2007-06-17 07:09:54 UTC (rev 3265)
+++ trunk/core/src/classpath/java/java/lang/Long.java 2007-06-17 07:14:11 UTC (rev 3266)
@@ -1,750 +0,0 @@
-/* Long.java -- object wrapper for long
- Copyright (C) 1998, 1999, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Instances of class <code>Long</code> represent primitive
- * <code>long</code> values.
- *
- * Additionally, this class provides various helper functions and variables
- * related to longs.
- *
- * @author Paul Fisher
- * @author John Keiser
- * @author Warren Levy
- * @author Eric Blake (eb...@em...)
- * @author Tom Tromey (tr...@re...)
- * @author Andrew John Hughes (gnu...@me...)
- * @since 1.0
- * @status updated to 1.5
- */
-public final class Long extends Number implements Comparable<Long>
-{
- /**
- * Compatible with JDK 1.0.2+.
- */
- private static final long serialVersionUID = 4290774380558885855L;
-
- /**
- * The minimum value a <code>long</code> can represent is
- * -9223372036854775808L (or -2<sup>63</sup>).
- */
- public static final long MIN_VALUE = 0x8000000000000000L;
-
- /**
- * The maximum value a <code>long</code> can represent is
- * 9223372036854775807 (or 2<sup>63</sup> - 1).
- */
- public static final long MAX_VALUE = 0x7fffffffffffffffL;
-
- /**
- * The primitive type <code>long</code> is represented by this
- * <code>Class</code> object.
- * @since 1.1
- */
- public static final Class<Long> TYPE = (Class<Long>) VMClassLoader.getPrimitiveClass ('J');
-
- /**
- * The number of bits needed to represent a <code>long</code>.
- * @since 1.5
- */
- public static final int SIZE = 64;
-
- /**
- * The immutable value of this Long.
- *
- * @serial the wrapped long
- */
- private final long value;
-
- /**
- * Create a <code>Long</code> object representing the value of the
- * <code>long</code> argument.
- *
- * @param value the value to use
- */
- public Long(long value)
- {
- this.value = value;
- }
-
- /**
- * Create a <code>Long</code> object representing the value of the
- * argument after conversion to a <code>long</code>.
- *
- * @param s the string to convert
- * @throws NumberFormatException if the String does not contain a long
- * @see #valueOf(String)
- */
- public Long(String s)
- {
- value = parseLong(s, 10, false);
- }
-
- /**
- * Converts the <code>long</code> to a <code>String</code> using
- * the specified radix (base). If the radix exceeds
- * <code>Character.MIN_RADIX</code> or <code>Character.MAX_RADIX</code>, 10
- * is used instead. If the result is negative, the leading character is
- * '-' ('\\u002D'). The remaining characters come from
- * <code>Character.forDigit(digit, radix)</code> ('0'-'9','a'-'z').
- *
- * @param num the <code>long</code> to convert to <code>String</code>
- * @param radix the radix (base) to use in the conversion
- * @return the <code>String</code> representation of the argument
- */
- public static String toString(long num, int radix)
- {
- // Use the Integer toString for efficiency if possible.
- if ((int) num == num)
- return Integer.toString((int) num, radix);
-
- if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
- radix = 10;
-
- // For negative numbers, print out the absolute value w/ a leading '-'.
- // Use an array large enough for a binary number.
- char[] buffer = new char[65];
- int i = 65;
- boolean isNeg = false;
- if (num < 0)
- {
- isNeg = true;
- num = -num;
-
- // When the value is MIN_VALUE, it overflows when made positive
- if (num < 0)
- {
- buffer[--i] = digits[(int) (-(num + radix) % radix)];
- num = -(num / radix);
- }
- }
-
- do
- {
- buffer[--i] = digits[(int) (num % radix)];
- num /= radix;
- }
- while (num > 0);
-
- if (isNeg)
- buffer[--i] = '-';
-
- // Package constructor avoids an array copy.
- return new String(buffer, i, 65 - i, true);
- }
-
- /**
- * Converts the <code>long</code> to a <code>String</code> assuming it is
- * unsigned in base 16.
- *
- * @param l the <code>long</code> to convert to <code>String</code>
- * @return the <code>String</code> representation of the argument
- */
- public static String toHexString(long l)
- {
- return toUnsignedString(l, 4);
- }
-
- /**
- * Converts the <code>long</code> to a <code>String</code> assuming it is
- * unsigned in base 8.
- *
- * @param l the <code>long</code> to convert to <code>String</code>
- * @return the <code>String</code> representation of the argument
- */
- public static String toOctalString(long l)
- {
- return toUnsignedString(l, 3);
- }
-
- /**
- * Converts the <code>long</code> to a <code>String</code> assuming it is
- * unsigned in base 2.
- *
- * @param l the <code>long</code> to convert to <code>String</code>
- * @return the <code>String</code> representation of the argument
- */
- public static String toBinaryString(long l)
- {
- return toUnsignedString(l, 1);
- }
-
- /**
- * Converts the <code>long</code> to a <code>String</code> and assumes
- * a radix of 10.
- *
- * @param num the <code>long</code> to convert to <code>String</code>
- * @return the <code>String</code> representation of the argument
- * @see #toString(long, int)
- */
- public static String toString(long num)
- {
- return toString(num, 10);
- }
-
- /**
- * Converts the specified <code>String</code> into an <code>int</code>
- * using the specified radix (base). The string must not be <code>null</code>
- * or empty. It may begin with an optional '-', which will negate the answer,
- * provided that there are also valid digits. Each digit is parsed as if by
- * <code>Character.digit(d, radix)</code>, and must be in the range
- * <code>0</code> to <code>radix - 1</code>. Finally, the result must be
- * within <code>MIN_VALUE</code> to <code>MAX_VALUE</code>, inclusive.
- * Unlike Double.parseDouble, you may not have a leading '+'; and 'l' or
- * 'L' as the last character is only valid in radices 22 or greater, where
- * it is a digit and not a type indicator.
- *
- * @param str the <code>String</code> to convert
- * @param radix the radix (base) to use in the conversion
- * @return the <code>String</code> argument converted to <code>long</code>
- * @throws NumberFormatException if <code>s</code> cannot be parsed as a
- * <code>long</code>
- */
- public static long parseLong(String str, int radix)
- {
- return parseLong(str, radix, false);
- }
-
- /**
- * Converts the specified <code>String</code> into a <code>long</code>.
- * This function assumes a radix of 10.
- *
- * @param s the <code>String</code> to convert
- * @return the <code>int</code> value of <code>s</code>
- * @throws NumberFormatException if <code>s</code> cannot be parsed as a
- * <code>long</code>
- * @see #parseLong(String, int)
- */
- public static long parseLong(String s)
- {
- return parseLong(s, 10, false);
- }
-
- /**
- * Creates a new <code>Long</code> object using the <code>String</code>
- * and specified radix (base).
- *
- * @param s the <code>String</code> to convert
- * @param radix the radix (base) to convert with
- * @return the new <code>Long</code>
- * @throws NumberFormatException if <code>s</code> cannot be parsed as a
- * <code>long</code>
- * @see #parseLong(String, int)
- */
- public static Long valueOf(String s, int radix)
- {
- return new Long(parseLong(s, radix, false));
- }
-
- /**
- * Creates a new <code>Long</code> object using the <code>String</code>,
- * assuming a radix of 10.
- *
- * @param s the <code>String</code> to convert
- * @return the new <code>Long</code>
- * @throws NumberFormatException if <code>s</code> cannot be parsed as a
- * <code>long</code>
- * @see #Long(String)
- * @see #parseLong(String)
- */
- public static Long valueOf(String s)
- {
- return new Long(parseLong(s, 10, false));
- }
-
- /**
- * Returns a <code>Long</code> object wrapping the value.
- *
- * @param val the value to wrap
- * @return the <code>Long</code>
- * @since 1.5
- */
- public static synchronized Long valueOf(long val)
- {
- // We aren't required to cache here. We could, though perhaps we
- // ought to consider that as an empirical question.
- return new Long(val);
- }
-
- /**
- * Convert the specified <code>String</code> into a <code>Long</code>.
- * The <code>String</code> may represent decimal, hexadecimal, or
- * octal numbers.
- *
- * <p>The extended BNF grammar is as follows:<br>
- * <pre>
- * <em>DecodableString</em>:
- * ( [ <code>-</code> ] <em>DecimalNumber</em> )
- * | ( [ <code>-</code> ] ( <code>0x</code> | <code>0X</code>
- * | <code>#</code> ) <em>HexDigit</em> { <em>HexDigit</em> } )
- * | ( [ <code>-</code> ] <code>0</code> { <em>OctalDigit</em> } )
- * <em>DecimalNumber</em>:
- * <em>DecimalDigit except '0'</em> { <em>DecimalDigit</em> }
- * <em>DecimalDigit</em>:
- * <em>Character.digit(d, 10) has value 0 to 9</em>
- * <em>OctalDigit</em>:
- * <em>Character.digit(d, 8) has value 0 to 7</em>
- * <em>DecimalDigit</em>:
- * <em>Character.digit(d, 16) has value 0 to 15</em>
- * </pre>
- * Finally, the value must be in the range <code>MIN_VALUE</code> to
- * <code>MAX_VALUE</code>, or an exception is thrown. Note that you cannot
- * use a trailing 'l' or 'L', unlike in Java source code.
- *
- * @param str the <code>String</code> to interpret
- * @return the value of the String as a <code>Long</code>
- * @throws NumberFormatException if <code>s</code> cannot be parsed as a
- * <code>long</code>
- * @throws NullPointerException if <code>s</code> is null
- * @since 1.2
- */
- public static Long decode(String str)
- {
- return new Long(parseLong(str, 10, true));
- }
-
- /**
- * Return the value of this <code>Long</code> as a <code>byte</code>.
- *
- * @return the byte value
- */
- public byte byteValue()
- {
- return (byte) value;
- }
-
- /**
- * Return the value of this <code>Long</code> as a <code>short</code>.
- *
- * @return the short value
- */
- public short shortValue()
- {
- return (short) value;
- }
-
- /**
- * Return the value of this <code>Long</code> as an <code>int</code>.
- *
- * @return the int value
- */
- public int intValue()
- {
- return (int) value;
- }
-
- /**
- * Return the value of this <code>Long</code>.
- *
- * @return the long value
- */
- public long longValue()
- {
- return value;
- }
-
- /**
- * Return the value of this <code>Long</code> as a <code>float</code>.
- *
- * @return the float value
- */
- public float floatValue()
- {
- return value;
- }
-
- /**
- * Return the value of this <code>Long</code> as a <code>double</code>.
- *
- * @return the double value
- */
- public double doubleValue()
- {
- return value;
- }
-
- /**
- * Converts the <code>Long</code> value to a <code>String</code> and
- * assumes a radix of 10.
- *
- * @return the <code>String</code> representation
- */
- public String toString()
- {
- return toString(value, 10);
- }
-
- /**
- * Return a hashcode representing this Object. <code>Long</code>'s hash
- * code is calculated by <code>(int) (value ^ (value >> 32))</code>.
- *
- * @return this Object's hash code
- */
- public int hashCode()
- {
- return (int) (value ^ (value >>> 32));
- }
-
- /**
- * Returns <code>true</code> if <code>obj</code> is an instance of
- * <code>Long</code> and represents the same long value.
- *
- * @param obj the object to compare
- * @return whether these Objects are semantically equal
- */
- public boolean equals(Object obj)
- {
- return obj instanceof Long && value == ((Long) obj).value;
- }
-
- /**
- * Get the specified system property as a <code>Long</code>. The
- * <code>decode()</code> method will be used to interpret the value of
- * the property.
- *
- * @param nm the name of the system property
- * @return the system property as a <code>Long</code>, or null if the
- * property is not found or cannot be decoded
- * @throws SecurityException if accessing the system property is forbidden
- * @see System#getProperty(String)
- * @see #decode(String)
- */
- public static Long getLong(String nm)
- {
- return getLong(nm, null);
- }
-
- /**
- * Get the specified system property as a <code>Long</code>, or use a
- * default <code>long</code> value if the property is not found or is not
- * decodable. The <code>decode()</code> method will be used to interpret
- * the value of the property.
- *
- * @param nm the name of the system property
- * @param val the default value
- * @return the value of the system property, or the default
- * @throws SecurityException if accessing the system property is forbidden
- * @see System#getProperty(String)
- * @see #decode(String)
- */
- public static Long getLong(String nm, long val)
- {
- Long result = getLong(nm, null);
- return result == null ? new Long(val) : result;
- }
-
- /**
- * Get the specified system property as a <code>Long</code>, or use a
- * default <code>Long</code> value if the property is not found or is
- * not decodable. The <code>decode()</code> method will be used to
- * interpret the value of the property.
- *
- * @param nm the name of the system property
- * @param def the default value
- * @return the value of the system property, or the default
- * @throws SecurityException if accessing the system property is forbidden
- * @see System#getProperty(String)
- * @see #decode(String)
- */
- public static Long getLong(String nm, Long def)
- {
- if (nm == null || "".equals(nm))
- return def;
- nm = System.getProperty(nm);
- if (nm == null)
- return def;
- try
- {
- return decode(nm);
- }
- catch (NumberFormatException e)
- {
- return def;
- }
- }
-
- /**
- * Compare two Longs numerically by comparing their <code>long</code>
- * values. The result is positive if the first is greater, negative if the
- * second is greater, and 0 if the two are equal.
- *
- * @param l the Long to compare
- * @return the comparison
- * @since 1.2
- */
- public int compareTo(Long l)
- {
- if (value == l.value)
- return 0;
- // Returns just -1 or 1 on inequality; doing math might overflow the long.
- return value > l.value ? 1 : -1;
- }
-
- /**
- * Return the number of bits set in x.
- * @param x value to examine
- * @since 1.5
- */
- public static int bitCount(long x)
- {
- // Successively collapse alternating bit groups into a sum.
- x = ((x >> 1) & 0x5555555555555555L) + (x & 0x5555555555555555L);
- x = ((x >> 2) & 0x3333333333333333L) + (x & 0x3333333333333333L);
- int v = (int) ((x >>> 32) + x);
- v = ((v >> 4) & 0x0f0f0f0f) + (v & 0x0f0f0f0f);
- v = ((v >> 8) & 0x00ff00ff) + (v & 0x00ff00ff);
- return ((v >> 16) & 0x0000ffff) + (v & 0x0000ffff);
- }
-
- /**
- * Rotate x to the left by distance bits.
- * @param x the value to rotate
- * @param distance the number of bits by which to rotate
- * @since 1.5
- */
- public static long rotateLeft(long x, int distance)
- {
- // This trick works because the shift operators implicitly mask
- // the shift count.
- return (x << distance) | (x >>> - distance);
- }
-
- /**
- * Rotate x to the right by distance bits.
- * @param x the value to rotate
- * @param distance the number of bits by which to rotate
- * @since 1.5
- */
- public static long rotateRight(long x, int distance)
- {
- // This trick works because the shift operators implicitly mask
- // the shift count.
- return (x << - distance) | (x >>> distance);
- }
-
- /**
- * Find the highest set bit in value, and return a new value
- * with only that bit set.
- * @param value the value to examine
- * @since 1.5
- */
- public static long highestOneBit(long value)
- {
- value |= value >>> 1;
- value |= value >>> 2;
- value |= value >>> 4;
- value |= value >>> 8;
- value |= value >>> 16;
- value |= value >>> 32;
- return value ^ (value >>> 1);
- }
-
- /**
- * Return the number of leading zeros in value.
- * @param value the value to examine
- * @since 1.5
- */
- public static int numberOfLeadingZeros(long value)
- {
- value |= value >>> 1;
- value |= value >>> 2;
- value |= value >>> 4;
- value |= value >>> 8;
- value |= value >>> 16;
- value |= value >>> 32;
- return bitCount(~value);
- }
-
- /**
- * Find the lowest set bit in value, and return a new value
- * with only that bit set.
- * @param value the value to examine
- * @since 1.5
- */
- public static long lowestOneBit(long value)
- {
- // Classic assembly trick.
- return value & - value;
- }
-
- /**
- * Find the number of trailing zeros in value.
- * @param value the value to examine
- * @since 1.5
- */
- public static int numberOfTrailingZeros(long value)
- {
- return bitCount((value & -value) - 1);
- }
-
- /**
- * Return 1 if x is positive, -1 if it is negative, and 0 if it is
- * zero.
- * @param x the value to examine
- * @since 1.5
- */
- public static int signum(long x)
- {
- return x < 0 ? -1 : (x > 0 ? 1 : 0);
- }
-
- /**
- * Reverse the bytes in val.
- * @since 1.5
- */
- public static long reverseBytes(long val)
- {
- int hi = Integer.reverseBytes((int) val);
- int lo = Integer.reverseBytes((int) (val >>> 32));
- return (((long) hi) << 32) | lo;
- }
-
- /**
- * Reverse the bits in val.
- * @since 1.5
- */
- public static long reverse(long val)
- {
- long hi = Integer.reverse((int) val) & 0xffffffffL;
- long lo = Integer.reverse((int) (val >>> 32)) & 0xffffffffL;
- return (hi << 32) | lo;
- }
-
- /**
- * Helper for converting unsigned numbers to String.
- *
- * @param num the number
- * @param exp log2(digit) (ie. 1, 3, or 4 for binary, oct, hex)
- */
- private static String toUnsignedString(long num, int exp)
- {
- // Use the Integer toUnsignedString for efficiency if possible.
- // If NUM<0 then this particular optimization doesn't work
- // properly.
- if (num >= 0 && (int) num == num)
- return Integer.toUnsignedString((int) num, exp);
-
- // Use an array large enough for a binary number.
- int mask = (1 << exp) - 1;
- char[] buffer = new char[64];
- int i = 64;
- do
- {
- buffer[--i] = digits[(int) num & mask];
- num >>>= exp;
- }
- while (num != 0);
-
- // Package constructor avoids an array copy.
- return new String(buffer, i, 64 - i, true);
- }
-
- /**
- * Helper for parsing longs.
- *
- * @param str the string to parse
- * @param radix the radix to use, must be 10 if decode is true
- * @param decode if called from decode
- * @return the parsed long value
- * @throws NumberFormatException if there is an error
- * @throws NullPointerException if decode is true and str is null
- * @see #parseLong(String, int)
- * @see #decode(String)
- */
- private static long parseLong(String str, int radix, boolean decode)
- {
- if (! decode && str == null)
- throw new NumberFormatException();
- int index = 0;
- int len = str.length();
- boolean isNeg = false;
- if (len == 0)
- throw new NumberFormatException();
- int ch = str.charAt(index);
- if (ch == '-')
- {
- if (len == 1)
- throw new NumberFormatException();
- isNeg = true;
- ch = str.charAt(++index);
- }
- if (decode)
- {
- if (ch == '0')
- {
- if (++index == len)
- return 0;
- if ((str.charAt(index) & ~('x' ^ 'X')) == 'X')
- {
- radix = 16;
- index++;
- }
- else
- radix = 8;
- }
- else if (ch == '#')
- {
- radix = 16;
- index++;
- }
- }
- if (index == len)
- throw new NumberFormatException();
-
- long max = MAX_VALUE / radix;
- // We can't directly write `max = (MAX_VALUE + 1) / radix'.
- // So instead we fake it.
- if (isNeg && MAX_VALUE % radix == radix - 1)
- ++max;
-
- long val = 0;
- while (index < len)
- {
- if (val < 0 || val > max)
- throw new NumberFormatException();
-
- ch = Character.digit(str.charAt(index++), radix);
- val = val * radix + ch;
- if (ch < 0 || (val < 0 && (! isNeg || val != MIN_VALUE)))
- throw new NumberFormatException();
- }
- return isNeg ? -val : val;
- }
-}
Deleted: trunk/core/src/classpath/java/java/lang/NumberFormatException.java
===================================================================
--- trunk/core/src/classpath/java/java/lang/NumberFormatException.java 2007-06-17 07:09:54 UTC (rev 3265)
+++ trunk/core/src/classpath/java/java/lang/NumberFormatException.java 2007-06-17 07:14:11 UTC (rev 3266)
@@ -1,73 +0,0 @@
-/* NumberFormatException.java -- thrown when parsing a bad string as a number
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which...
[truncated message content] |
|
From: <ls...@us...> - 2007-06-17 07:09:58
|
Revision: 3265
http://jnode.svn.sourceforge.net/jnode/?rev=3265&view=rev
Author: lsantha
Date: 2007-06-17 00:09:54 -0700 (Sun, 17 Jun 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/java/java/io/Console.java
trunk/core/src/openjdk/java/java/lang/Byte.java
trunk/core/src/openjdk/java/java/lang/Integer.java
trunk/core/src/openjdk/java/java/lang/Long.java
trunk/core/src/openjdk/java/java/lang/NumberFormatException.java
trunk/core/src/openjdk/java/java/lang/Short.java
trunk/core/src/openjdk/java/java/util/Properties.java
trunk/core/src/openjdk/java/java/util/XMLUtils.java
trunk/core/src/openjdk/java/java/util/jar/
trunk/core/src/openjdk/java/java/util/jar/JavaUtilJarAccessImpl.java
trunk/core/src/openjdk/sun/sun/misc/BASE64Decoder.java
trunk/core/src/openjdk/sun/sun/misc/BASE64Encoder.java
trunk/core/src/openjdk/sun/sun/misc/CEFormatException.java
trunk/core/src/openjdk/sun/sun/misc/CEStreamExhausted.java
trunk/core/src/openjdk/sun/sun/misc/CRC16.java
trunk/core/src/openjdk/sun/sun/misc/Cache.java
trunk/core/src/openjdk/sun/sun/misc/CharacterDecoder.java
trunk/core/src/openjdk/sun/sun/misc/CharacterEncoder.java
trunk/core/src/openjdk/sun/sun/misc/ClassFileTransformer.java
trunk/core/src/openjdk/sun/sun/misc/ClassLoaderUtil.java
trunk/core/src/openjdk/sun/sun/misc/Cleaner.java
trunk/core/src/openjdk/sun/sun/misc/Compare.java
trunk/core/src/openjdk/sun/sun/misc/CompoundEnumeration.java
trunk/core/src/openjdk/sun/sun/misc/ConditionLock.java
trunk/core/src/openjdk/sun/sun/misc/ExtensionDependency.java
trunk/core/src/openjdk/sun/sun/misc/ExtensionInfo.java
trunk/core/src/openjdk/sun/sun/misc/ExtensionInstallationException.java
trunk/core/src/openjdk/sun/sun/misc/ExtensionInstallationProvider.java
trunk/core/src/openjdk/sun/sun/misc/FileURLMapper.java
trunk/core/src/openjdk/sun/sun/misc/FormattedFloatingDecimal.java
trunk/core/src/openjdk/sun/sun/misc/GC.java
trunk/core/src/openjdk/sun/sun/misc/HexDumpEncoder.java
trunk/core/src/openjdk/sun/sun/misc/InvalidJarIndexException.java
trunk/core/src/openjdk/sun/sun/misc/JarFilter.java
trunk/core/src/openjdk/sun/sun/misc/JarIndex.java
trunk/core/src/openjdk/sun/sun/misc/JavaIOAccess.java
trunk/core/src/openjdk/sun/sun/misc/JavaLangAccess.java
trunk/core/src/openjdk/sun/sun/misc/JavaNetAccess.java
trunk/core/src/openjdk/sun/sun/misc/LRUCache.java
trunk/core/src/openjdk/sun/sun/misc/Launcher.java
trunk/core/src/openjdk/sun/sun/misc/Lock.java
trunk/core/src/openjdk/sun/sun/misc/MessageUtils.java
trunk/core/src/openjdk/sun/sun/misc/MetaIndex.java
trunk/core/src/openjdk/sun/sun/misc/NativeSignalHandler.java
trunk/core/src/openjdk/sun/sun/misc/OSEnvironment.java
trunk/core/src/openjdk/sun/sun/misc/Perf.java
trunk/core/src/openjdk/sun/sun/misc/PerformanceLogger.java
trunk/core/src/openjdk/sun/sun/misc/ProxyGenerator.java
trunk/core/src/openjdk/sun/sun/misc/Queue.java
trunk/core/src/openjdk/sun/sun/misc/REException.java
trunk/core/src/openjdk/sun/sun/misc/Ref.java
trunk/core/src/openjdk/sun/sun/misc/Regexp.java
trunk/core/src/openjdk/sun/sun/misc/RegexpPool.java
trunk/core/src/openjdk/sun/sun/misc/RegexpTarget.java
trunk/core/src/openjdk/sun/sun/misc/Request.java
trunk/core/src/openjdk/sun/sun/misc/RequestProcessor.java
trunk/core/src/openjdk/sun/sun/misc/Resource.java
trunk/core/src/openjdk/sun/sun/misc/SharedSecrets.java
trunk/core/src/openjdk/sun/sun/misc/Signal.java
trunk/core/src/openjdk/sun/sun/misc/SignalHandler.java
trunk/core/src/openjdk/sun/sun/misc/SoftCache.java
trunk/core/src/openjdk/sun/sun/misc/Sort.java
trunk/core/src/openjdk/sun/sun/misc/Timeable.java
trunk/core/src/openjdk/sun/sun/misc/Timer.java
trunk/core/src/openjdk/sun/sun/misc/UCDecoder.java
trunk/core/src/openjdk/sun/sun/misc/UCEncoder.java
trunk/core/src/openjdk/sun/sun/misc/URLClassPath.java
trunk/core/src/openjdk/sun/sun/misc/UUDecoder.java
trunk/core/src/openjdk/sun/sun/misc/UUEncoder.java
trunk/core/src/openjdk/sun/sun/misc/VM.java
trunk/core/src/openjdk/sun/sun/misc/VMNotification.java
trunk/core/src/openjdk/sun/sun/misc/VMSupport.java
trunk/core/src/openjdk/sun/sun/misc/Version-template.java
trunk/core/src/openjdk/sun/sun/misc/resources/
trunk/core/src/openjdk/sun/sun/misc/resources/Messages.java
trunk/core/src/openjdk/sun/sun/misc/resources/Messages_de.java
trunk/core/src/openjdk/sun/sun/misc/resources/Messages_es.java
trunk/core/src/openjdk/sun/sun/misc/resources/Messages_fr.java
trunk/core/src/openjdk/sun/sun/misc/resources/Messages_it.java
trunk/core/src/openjdk/sun/sun/misc/resources/Messages_ja.java
trunk/core/src/openjdk/sun/sun/misc/resources/Messages_ko.java
trunk/core/src/openjdk/sun/sun/misc/resources/Messages_sv.java
trunk/core/src/openjdk/sun/sun/misc/resources/Messages_zh_CN.java
trunk/core/src/openjdk/sun/sun/misc/resources/Messages_zh_TW.java
trunk/core/src/openjdk/sun/sun/net/
trunk/core/src/openjdk/sun/sun/net/www/
trunk/core/src/openjdk/sun/sun/net/www/ParseUtil.java
trunk/core/src/openjdk/sun/sun/nio/cs/
trunk/core/src/openjdk/sun/sun/nio/cs/AbstractCharsetProvider.java
trunk/core/src/openjdk/sun/sun/nio/cs/FastCharsetProvider.java
trunk/core/src/openjdk/sun/sun/nio/cs/HistoricallyNamedCharset.java
trunk/core/src/openjdk/sun/sun/nio/cs/IBM437.java
trunk/core/src/openjdk/sun/sun/nio/cs/IBM737.java
trunk/core/src/openjdk/sun/sun/nio/cs/IBM775.java
trunk/core/src/openjdk/sun/sun/nio/cs/IBM850.java
trunk/core/src/openjdk/sun/sun/nio/cs/IBM852.java
trunk/core/src/openjdk/sun/sun/nio/cs/IBM855.java
trunk/core/src/openjdk/sun/sun/nio/cs/IBM857.java
trunk/core/src/openjdk/sun/sun/nio/cs/IBM858.java
trunk/core/src/openjdk/sun/sun/nio/cs/IBM862.java
trunk/core/src/openjdk/sun/sun/nio/cs/IBM866.java
trunk/core/src/openjdk/sun/sun/nio/cs/IBM874.java
trunk/core/src/openjdk/sun/sun/nio/cs/ISO_8859_1.java
trunk/core/src/openjdk/sun/sun/nio/cs/ISO_8859_13.java
trunk/core/src/openjdk/sun/sun/nio/cs/ISO_8859_15.java
trunk/core/src/openjdk/sun/sun/nio/cs/ISO_8859_2.java
trunk/core/src/openjdk/sun/sun/nio/cs/ISO_8859_4.java
trunk/core/src/openjdk/sun/sun/nio/cs/ISO_8859_5.java
trunk/core/src/openjdk/sun/sun/nio/cs/ISO_8859_7.java
trunk/core/src/openjdk/sun/sun/nio/cs/ISO_8859_9.java
trunk/core/src/openjdk/sun/sun/nio/cs/KOI8_R.java
trunk/core/src/openjdk/sun/sun/nio/cs/KOI8_U.java
trunk/core/src/openjdk/sun/sun/nio/cs/MS1250.java
trunk/core/src/openjdk/sun/sun/nio/cs/MS1251.java
trunk/core/src/openjdk/sun/sun/nio/cs/MS1252.java
trunk/core/src/openjdk/sun/sun/nio/cs/MS1253.java
trunk/core/src/openjdk/sun/sun/nio/cs/MS1254.java
trunk/core/src/openjdk/sun/sun/nio/cs/MS1257.java
trunk/core/src/openjdk/sun/sun/nio/cs/SingleByteDecoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/SingleByteEncoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/StreamDecoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/StreamEncoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/Surrogate.java
trunk/core/src/openjdk/sun/sun/nio/cs/ThreadLocalCoders.java
trunk/core/src/openjdk/sun/sun/nio/cs/US_ASCII.java
trunk/core/src/openjdk/sun/sun/nio/cs/UTF_16.java
trunk/core/src/openjdk/sun/sun/nio/cs/UTF_16BE.java
trunk/core/src/openjdk/sun/sun/nio/cs/UTF_16LE.java
trunk/core/src/openjdk/sun/sun/nio/cs/UTF_16LE_BOM.java
trunk/core/src/openjdk/sun/sun/nio/cs/UTF_32.java
trunk/core/src/openjdk/sun/sun/nio/cs/UTF_32BE.java
trunk/core/src/openjdk/sun/sun/nio/cs/UTF_32BE_BOM.java
trunk/core/src/openjdk/sun/sun/nio/cs/UTF_32Coder.java
trunk/core/src/openjdk/sun/sun/nio/cs/UTF_32LE.java
trunk/core/src/openjdk/sun/sun/nio/cs/UTF_32LE_BOM.java
trunk/core/src/openjdk/sun/sun/nio/cs/UTF_8.java
trunk/core/src/openjdk/sun/sun/nio/cs/Unicode.java
trunk/core/src/openjdk/sun/sun/nio/cs/UnicodeDecoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/UnicodeEncoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/
trunk/core/src/openjdk/sun/sun/nio/cs/ext/Big5.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/Big5_HKSCS.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/Big5_Solaris.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/DBCSDecoderMapping.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/DBCS_IBM_ASCII_Decoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/DBCS_IBM_ASCII_Encoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/DBCS_IBM_EBCDIC_Decoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/DBCS_IBM_EBCDIC_Encoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/DBCS_ONLY_IBM_EBCDIC_Decoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/DelegatableDecoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/DoubleByteDecoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/DoubleByteEncoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/EUC_CN.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/EUC_JP.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/EUC_JP_LINUX.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/EUC_JP_Open.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/EUC_KR.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/EUC_TW.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/ExtendedCharsets.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/GB18030.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/GBK.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/HKSCS.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/HKSCS_2001.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM037.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1006.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1025.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1026.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1046.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1047.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1097.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1098.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1112.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1122.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1123.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1124.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1140.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1141.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1142.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1143.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1144.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1145.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1146.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1147.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1148.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1149.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1381.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM1383.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM273.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM277.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM278.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM280.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM284.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM285.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM297.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM33722.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM420.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM424.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM500.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM834.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM838.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM856.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM860.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM861.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM863.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM864.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM865.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM868.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM869.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM870.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM871.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM875.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM918.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM921.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM922.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM930.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM933.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM935.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM937.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM939.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM942.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM942C.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM943.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM943C.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM948.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM949.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM949C.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM950.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM964.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/IBM970.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/ISCII91.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/ISO2022.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/ISO2022_CN.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/ISO2022_CN_CNS.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/ISO2022_CN_GB.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/ISO2022_JP.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/ISO2022_JP_2.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/ISO2022_KR.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/ISO_8859_11.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/ISO_8859_3.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/ISO_8859_6.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/ISO_8859_8.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/JISAutoDetect.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/JIS_X_0201.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/JIS_X_0208.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/JIS_X_0208_Decoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/JIS_X_0208_Encoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/JIS_X_0208_MS5022X_Decoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/JIS_X_0208_MS5022X_Encoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/JIS_X_0208_MS932_Decoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/JIS_X_0208_MS932_Encoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/JIS_X_0208_Solaris_Decoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/JIS_X_0208_Solaris_Encoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/JIS_X_0212.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/JIS_X_0212_Decoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/JIS_X_0212_Encoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/JIS_X_0212_MS5022X_Decoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/JIS_X_0212_MS5022X_Encoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/JIS_X_0212_Solaris_Decoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/JIS_X_0212_Solaris_Encoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/Johab.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/META-INF/
trunk/core/src/openjdk/sun/sun/nio/cs/ext/META-INF/services/
trunk/core/src/openjdk/sun/sun/nio/cs/ext/META-INF/services/java.nio.charset.spi.CharsetProvider
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MS1255.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MS1256.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MS1258.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MS50220.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MS50221.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MS874.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MS932.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MS932DB.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MS936.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MS949.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MS950.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MS950_HKSCS.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MSISO2022JP.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MacArabic.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MacCentralEurope.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MacCroatian.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MacCyrillic.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MacDingbat.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MacGreek.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MacHebrew.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MacIceland.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MacRoman.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MacRomania.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MacSymbol.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MacThai.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MacTurkish.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/MacUkraine.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/PCK.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/SJIS.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/SimpleEUCDecoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/SimpleEUCEncoder.java
trunk/core/src/openjdk/sun/sun/nio/cs/ext/TIS_620.java
trunk/core/src/openjdk/sun/sun/nio/cs/standard-charsets
trunk/core/src/openjdk/sun/sun/reflect/ConstantPool.java
Added: trunk/core/src/openjdk/java/java/io/Console.java
===================================================================
--- trunk/core/src/openjdk/java/java/io/Console.java (rev 0)
+++ trunk/core/src/openjdk/java/java/io/Console.java 2007-06-17 07:09:54 UTC (rev 3265)
@@ -0,0 +1,564 @@
+/*
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.io;
+
+import java.util.*;
+import java.nio.charset.Charset;
+import sun.nio.cs.StreamDecoder;
+import sun.nio.cs.StreamEncoder;
+
+/**
+ * Methods to access the character-based console device, if any, associated
+ * with the current Java virtual machine.
+ *
+ * <p> Whether a virtual machine has a console is dependent upon the
+ * underlying platform and also upon the manner in which the virtual
+ * machine is invoked. If the virtual machine is started from an
+ * interactive command line without redirecting the standard input and
+ * output streams then its console will exist and will typically be
+ * connected to the keyboard and display from which the virtual machine
+ * was launched. If the virtual machine is started automatically, for
+ * example by a background job scheduler, then it will typically not
+ * have a console.
+ * <p>
+ * If this virtual machine has a console then it is represented by a
+ * unique instance of this class which can be obtained by invoking the
+ * {@link java.lang.System#console()} method. If no console device is
+ * available then an invocation of that method will return <tt>null</tt>.
+ * <p>
+ * Read and write operations are synchronized to guarantee the atomic
+ * completion of critical operations; therefore invoking methods
+ * {@link #readLine()}, {@link #readPassword()}, {@link #format format()},
+ * {@link #printf printf()} as well as the read, format and write operations
+ * on the objects returned by {@link #reader()} and {@link #writer()} may
+ * block in multithreaded scenarios.
+ * <p>
+ * Invoking <tt>close()</tt> on the objects returned by the {@link #reader()}
+ * and the {@link #writer()} will not close the underlying stream of those
+ * objects.
+ * <p>
+ * The console-read methods return <tt>null</tt> when the end of the
+ * console input stream is reached, for example by typing control-D on
+ * Unix or control-Z on Windows. Subsequent read operations will succeed
+ * if additional characters are later entered on the console's input
+ * device.
+ * <p>
+ * Unless otherwise specified, passing a <tt>null</tt> argument to any method
+ * in this class will cause a {@link NullPointerException} to be thrown.
+ * <p>
+ * <b>Security note:</b>
+ * If an application needs to read a password or other secure data, it should
+ * use {@link #readPassword()} or {@link #readPassword(String, Object...)} and
+ * manually zero the returned character array after processing to minimize the
+ * lifetime of sensitive data in memory.
+ *
+ * <blockquote><pre>
+ * Console cons;
+ * char[] passwd;
+ * if ((cons = System.console()) != null &&
+ * (passwd = cons.readPassword("[%s]", "Password:")) != null) {
+ * ...
+ * java.util.Arrays.fill(passwd, ' ');
+ * }
+ * </pre></blockquote>
+ *
+ * @author Xueming Shen
+ * @version 1.17, 05/05/07
+ * @since 1.6
+ */
+
+public final class Console implements Flushable
+{
+ /**
+ * Retrieves the unique {@link java.io.PrintWriter PrintWriter} object
+ * associated with this console.
+ *
+ * @return The printwriter associated with this console
+ */
+ public PrintWriter writer() {
+ return pw;
+ }
+
+ /**
+ * Retrieves the unique {@link java.io.Reader Reader} object associated
+ * with this console.
+ * <p>
+ * This method is intended to be used by sophisticated applications, for
+ * example, a {@link java.util.Scanner} object which utilizes the rich
+ * parsing/scanning functionality provided by the <tt>Scanner</tt>:
+ * <blockquote><pre>
+ * Console con = System.console();
+ * if (con != null) {
+ * Scanner sc = new Scanner(con.reader());
+ * ...
+ * }
+ * </pre></blockquote>
+ * <p>
+ * For simple applications requiring only line-oriented reading, use
+ * <tt>{@link #readLine}</tt>.
+ * <p>
+ * The bulk read operations {@link java.io.Reader#read(char[]) read(char[]) },
+ * {@link java.io.Reader#read(char[], int, int) read(char[], int, int) } and
+ * {@link java.io.Reader#read(java.nio.CharBuffer) read(java.nio.CharBuffer)}
+ * on the returned object will not read in characters beyond the line
+ * bound for each invocation, even if the destination buffer has space for
+ * more characters. A line bound is considered to be any one of a line feed
+ * (<tt>'\n'</tt>), a carriage return (<tt>'\r'</tt>), a carriage return
+ * followed immediately by a linefeed, or an end of stream.
+ *
+ * @return The reader associated with this console
+ */
+ public Reader reader() {
+ return reader;
+ }
+
+ /**
+ * Writes a formatted string to this console's output stream using
+ * the specified format string and arguments.
+ *
+ * @param fmt
+ * A format string as described in <a
+ * href="../util/Formatter.html#syntax">Format string syntax</a>
+ *
+ * @param args
+ * Arguments referenced by the format specifiers in the format
+ * string. If there are more arguments than format specifiers, the
+ * extra arguments are ignored. The number of arguments is
+ * variable and may be zero. The maximum number of arguments is
+ * limited by the maximum dimension of a Java array as defined by
+ * the <a href="http://java.sun.com/docs/books/vmspec/">Java
+ * Virtual Machine Specification</a>. The behaviour on a
+ * <tt>null</tt> argument depends on the <a
+ * href="../util/Formatter.html#syntax">conversion</a>.
+ *
+ * @throws IllegalFormatException
+ * If a format string contains an illegal syntax, a format
+ * specifier that is incompatible with the given arguments,
+ * insufficient arguments given the format string, or other
+ * illegal conditions. For specification of all possible
+ * formatting errors, see the <a
+ * href="../util/Formatter.html#detail">Details</a> section
+ * of the formatter class specification.
+ *
+ * @return This console
+ */
+ public Console format(String fmt, Object ...args) {
+ formatter.format(fmt, args).flush();
+ return this;
+ }
+
+ /**
+ * A convenience method to write a formatted string to this console's
+ * output stream using the specified format string and arguments.
+ *
+ * <p> An invocation of this method of the form <tt>con.printf(format,
+ * args)</tt> behaves in exactly the same way as the invocation of
+ * <pre>con.format(format, args)</pre>.
+ *
+ * @param format
+ * A format string as described in <a
+ * href="../util/Formatter.html#syntax">Format string syntax</a>.
+ *
+ * @param args
+ * Arguments referenced by the format specifiers in the format
+ * string. If there are more arguments than format specifiers, the
+ * extra arguments are ignored. The number of arguments is
+ * variable and may be zero. The maximum number of arguments is
+ * limited by the maximum dimension of a Java array as defined by
+ * the <a href="http://java.sun.com/docs/books/vmspec/">Java
+ * Virtual Machine Specification</a>. The behaviour on a
+ * <tt>null</tt> argument depends on the <a
+ * href="../util/Formatter.html#syntax">conversion</a>.
+ *
+ * @throws IllegalFormatException
+ * If a format string contains an illegal syntax, a format
+ * specifier that is incompatible with the given arguments,
+ * insufficient arguments given the format string, or other
+ * illegal conditions. For specification of all possible
+ * formatting errors, see the <a
+ * href="../util/Formatter.html#detail">Details</a> section of the
+ * formatter class specification.
+ *
+ * @return This console
+ */
+ public Console printf(String format, Object ... args) {
+ return format(format, args);
+ }
+
+ /**
+ * Provides a formatted prompt, then reads a single line of text from the
+ * console.
+ *
+ * @param fmt
+ * A format string as described in <a
+ * href="../util/Formatter.html#syntax">Format string syntax</a>.
+ *
+ * @param args
+ * Arguments referenced by the format specifiers in the format
+ * string. If there are more arguments than format specifiers, the
+ * extra arguments are ignored. The maximum number of arguments is
+ * limited by the maximum dimension of a Java array as defined by
+ * the <a href="http://java.sun.com/docs/books/vmspec/">Java
+ * Virtual Machine Specification</a>.
+ *
+ * @throws IllegalFormatException
+ * If a format string contains an illegal syntax, a format
+ * specifier that is incompatible with the given arguments,
+ * insufficient arguments given the format string, or other
+ * illegal conditions. For specification of all possible
+ * formatting errors, see the <a
+ * href="../util/Formatter.html#detail">Details</a> section
+ * of the formatter class specification.
+ *
+ * @throws IOError
+ * If an I/O error occurs.
+ *
+ * @return A string containing the line read from the console, not
+ * including any line-termination characters, or <tt>null</tt>
+ * if an end of stream has been reached.
+ */
+ public String readLine(String fmt, Object ... args) {
+ String line = null;
+ synchronized (writeLock) {
+ synchronized(readLock) {
+ if (fmt.length() != 0)
+ pw.format(fmt, args);
+ try {
+ char[] ca = readline(false);
+ if (ca != null)
+ line = new String(ca);
+ } catch (IOException x) {
+ throw new IOError(x);
+ }
+ }
+ }
+ return line;
+ }
+
+ /**
+ * Reads a single line of text from the console.
+ *
+ * @throws IOError
+ * If an I/O error occurs.
+ *
+ * @return A string containing the line read from the console, not
+ * including any line-termination characters, or <tt>null</tt>
+ * if an end of stream has been reached.
+ */
+ public String readLine() {
+ return readLine("");
+ }
+
+ /**
+ * Provides a formatted prompt, then reads a password or passphrase from
+ * the console with echoing disabled.
+ *
+ * @param fmt
+ * A format string as described in <a
+ * href="../util/Formatter.html#syntax">Format string syntax</a>
+ * for the prompt text.
+ *
+ * @param args
+ * Arguments referenced by the format specifiers in the format
+ * string. If there are more arguments than format specifiers, the
+ * extra arguments are ignored. The maximum number of arguments is
+ * limited by the maximum dimension of a Java array as defined by
+ * the <a href="http://java.sun.com/docs/books/vmspec/">Java
+ * Virtual Machine Specification</a>.
+ *
+ * @throws IllegalFormatException
+ * If a format string contains an illegal syntax, a format
+ * specifier that is incompatible with the given arguments,
+ * insufficient arguments given the format string, or other
+ * illegal conditions. For specification of all possible
+ * formatting errors, see the <a
+ * href="../util/Formatter.html#detail">Details</a>
+ * section of the formatter class specification.
+ *
+ * @throws IOError
+ * If an I/O error occurs.
+ *
+ * @return A character array containing the password or passphrase read
+ * from the console, not including any line-termination characters,
+ * or <tt>null</tt> if an end of stream has been reached.
+ */
+ public char[] readPassword(String fmt, Object ... args) {
+ char[] passwd = null;
+ synchronized (writeLock) {
+ synchronized(readLock) {
+ if (fmt.length() != 0)
+ pw.format(fmt, args);
+ try {
+ echoOff = echo(false);
+ passwd = readline(true);
+ } catch (IOException x) {
+ throw new IOError(x);
+ } finally {
+ try {
+ echoOff = echo(true);
+ } catch (IOException xx) {}
+ }
+ pw.println();
+ }
+ }
+ return passwd;
+ }
+
+ /**
+ * Reads a password or passphrase from the console with echoing disabled
+ *
+ * @throws IOError
+ * If an I/O error occurs.
+ *
+ * @return A character array containing the password or passphrase read
+ * from the console, not including any line-termination characters,
+ * or <tt>null</tt> if an end of stream has been reached.
+ */
+ public char[] readPassword() {
+ return readPassword("");
+ }
+
+ /**
+ * Flushes the console and forces any buffered output to be written
+ * immediately .
+ */
+ public void flush() {
+ pw.flush();
+ }
+
+ private Object readLock;
+ private Object writeLock;
+ private Reader reader;
+ private Writer out;
+ private PrintWriter pw;
+ private Formatter formatter;
+ private Charset cs;
+ private char[] rcb;
+ private static native String encoding();
+ private static native boolean echo(boolean on) throws IOException;
+ private static boolean echoOff;
+
+ private char[] readline(boolean zeroOut) throws IOException {
+ int len = reader.read(rcb, 0, rcb.length);
+ if (len < 0)
+ return null; //EOL
+ if (rcb[len-1] == '\r')
+ len--; //remove CR at end;
+ else if (rcb[len-1] == '\n') {
+ len--; //remove LF at end;
+ if (len > 0 && rcb[len-1] == '\r')
+ len--; //remove the CR, if there is one
+ }
+ char[] b = new char[len];
+ if (len > 0) {
+ System.arraycopy(rcb, 0, b, 0, len);
+ if (zeroOut) {
+ Arrays.fill(rcb, 0, len, ' ');
+ }
+ }
+ return b;
+ }
+
+ private char[] grow() {
+ assert Thread.holdsLock(readLock);
+ char[] t = new char[rcb.length * 2];
+ System.arraycopy(rcb, 0, t, 0, rcb.length);
+ rcb = t;
+ return rcb;
+ }
+
+ class LineReader extends Reader {
+ private Reader in;
+ private char[] cb;
+ private int nChars, nextChar;
+ boolean leftoverLF;
+ LineReader(Reader in) {
+ this.in = in;
+ cb = new char[1024];
+ nextChar = nChars = 0;
+ leftoverLF = false;
+ }
+ public void close () {}
+ public boolean ready() throws IOException {
+ //in.ready synchronizes on readLock already
+ return in.ready();
+ }
+
+ public int read(char cbuf[], int offset, int length)
+ throws IOException
+ {
+ int off = offset;
+ int end = offset + length;
+ if (offset < 0 || offset > cbuf.length || length < 0 ||
+ end < 0 || end > cbuf.length) {
+ throw new IndexOutOfBoundsException();
+ }
+ synchronized(readLock) {
+ boolean eof = false;
+ char c = 0;
+ for (;;) {
+ if (nextChar >= nChars) { //fill
+ int n = 0;
+ do {
+ n = in.read(cb, 0, cb.length);
+ } while (n == 0);
+ if (n > 0) {
+ nChars = n;
+ nextChar = 0;
+ if (n < cb.length &&
+ cb[n-1] != '\n' && cb[n-1] != '\r') {
+ /*
+ * we're in canonical mode so each "fill" should
+ * come back with an eol. if there no lf or nl at
+ * the end of returned bytes we reached an eof.
+ */
+ eof = true;
+ }
+ } else { /*EOF*/
+ if (off - offset == 0)
+ return -1;
+ return off - offset;
+ }
+ }
+ if (leftoverLF && cbuf == rcb && cb[nextChar] == '\n') {
+ /*
+ * if invoked by our readline, skip the leftover, otherwise
+ * return the LF.
+ */
+ nextChar++;
+ }
+ leftoverLF = false;
+ while (nextChar < nChars) {
+ c = cbuf[off++] = cb[nextChar];
+ cb[nextChar++] = 0;
+ if (c == '\n') {
+ return off - offset;
+ } else if (c == '\r') {
+ if (off == end) {
+ /* no space left even the next is LF, so return
+ * whatever we have if the invoker is not our
+ * readLine()
+ */
+ if (cbuf == rcb) {
+ cbuf = grow();
+ end = cbuf.length;
+ } else {
+ leftoverLF = true;
+ return off - offset;
+ }
+ }
+ if (nextChar == nChars && in.ready()) {
+ /*
+ * we have a CR and we reached the end of
+ * the read in buffer, fill to make sure we
+ * don't miss a LF, if there is one, it's possible
+ * that it got cut off during last round reading
+ * simply because the read in buffer was full.
+ */
+ nChars = in.read(cb, 0, cb.length);
+ nextChar = 0;
+ }
+ if (nextChar < nChars && cb[nextChar] == '\n') {
+ cbuf[off++] = '\n';
+ nextChar++;
+ }
+ return off - offset;
+ } else if (off == end) {
+ if (cbuf == rcb) {
+ cbuf = grow();
+ end = cbuf.length;
+ } else {
+ return off - offset;
+ }
+ }
+ }
+ if (eof)
+ return off - offset;
+ }
+ }
+ }
+ }
+
+ // Set up JavaIOAccess in SharedSecrets
+ static {
+ sun.misc.SharedSecrets.setJavaIOAccess(new sun.misc.JavaIOAccess() {
+ public Console console() {
+ if (istty()) {
+ if (cons == null)
+ cons = new Console();
+ return cons;
+ }
+ return null;
+ }
+
+ // Add a shutdown hook to restore console's echo state should
+ // it be necessary.
+ public Runnable consoleRestoreHook() {
+ return new Runnable() {
+ public void run() {
+ try {
+ if (echoOff) {
+ echo(true);
+ }
+ } catch (IOException x) {}
+ }
+ };
+ }
+
+ public Charset charset() {
+ // This method is called in sun.security.util.Password,
+ // cons already exists when this method is called
+ return cons.cs;
+ }
+ });
+ }
+ private static Console cons;
+ private native static boolean istty();
+ private Console() {
+ readLock = new Object();
+ writeLock = new Object();
+ String csname = encoding();
+ if (csname != null) {
+ try {
+ cs = Charset.forName(csname);
+ } catch (Exception x) {}
+ }
+ if (cs == null)
+ cs = Charset.defaultCharset();
+ out = StreamEncoder.forOutputStreamWriter(
+ new FileOutputStream(FileDescriptor.out),
+ writeLock,
+ cs);
+ pw = new PrintWriter(out, true) { public void close() {} };
+ formatter = new Formatter(out);
+ reader = new LineReader(StreamDecoder.forInputStreamReader(
+ new FileInputStream(FileDescriptor.in),
+ readLock,
+ cs));
+ rcb = new char[1024];
+ }
+}
+
Added: trunk/core/src/openjdk/java/java/lang/Byte.java
===================================================================
--- trunk/core/src/openjdk/java/java/lang/Byte.java (rev 0)
+++ trunk/core/src/openjdk/java/java/lang/Byte.java 2007-06-17 07:09:54 UTC (rev 3265)
@@ -0,0 +1,432 @@
+/*
+ * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.lang;
+
+/**
+ *
+ * The {@code Byte} class wraps a value of primitive type {@code byte}
+ * in an object. An object of type {@code Byte} contains a single
+ * field whose type is {@code byte}.
+ *
+ * <p>In addition, this class provides several methods for converting
+ * a {@code byte} to a {@code String} and a {@code String} to a {@code
+ * byte}, as well as other constants and methods useful when dealing
+ * with a {@code byte}.
+ *
+ * @author Nakul Saraiya
+ * @author Joseph D. Darcy
+ * @version 1.49, 05/05/07
+ * @see java.lang.Number
+ * @since JDK1.1
+ */
+public final class Byte extends Number implements Comparable<Byte> {
+
+ /**
+ * A constant holding the minimum value a {@code byte} can
+ * have, -2<sup>7</sup>.
+ */
+ public static final byte MIN_VALUE = -128;
+
+ /**
+ * A constant holding the maximum value a {@code byte} can
+ * have, 2<sup>7</sup>-1.
+ */
+ public static final byte MAX_VALUE = 127;
+
+ /**
+ * The {@code Class} instance representing the primitive type
+ * {@code byte}.
+ */
+ public static final Class<Byte> TYPE = (Class<Byte>) Class.getPrimitiveClass("byte");
+
+ /**
+ * Returns a new {@code String} object representing the
+ * specified {@code byte}. The radix is assumed to be 10.
+ *
+ * @param b the {@code byte} to be converted
+ * @return the string representation of the specified {@code byte}
+ * @see java.lang.Integer#toString(int)
+ */
+ public static String toString(byte b) {
+ return Integer.toString((int)b, 10);
+ }
+
+ private static class ByteCache {
+ private ByteCache(){}
+
+ static final Byte cache[] = new Byte[-(-128) + 127 + 1];
+
+ static {
+ for(int i = 0; i < cache.length; i++)
+ cache[i] = new Byte((byte)(i - 128));
+ }
+ }
+
+ /**
+ * Returns a {@code Byte} instance representing the specified
+ * {@code byte} value.
+ * If a new {@code Byte} instance is not required, this method
+ * should generally be used in preference to the constructor
+ * {@link #Byte(byte)}, as this method is likely to yield
+ * significantly better space and time performance by caching
+ * frequently requested values.
+ *
+ * @param b a byte value.
+ * @return a {@code Byte} instance representing {@code b}.
+ * @since 1.5
+ */
+ public static Byte valueOf(byte b) {
+ final int offset = 128;
+ return ByteCache.cache[(int)b + offset];
+ }
+
+ /**
+ * Parses the string argument as a signed {@code byte} in the
+ * radix specified by the second argument. The characters in the
+ * string must all be digits, of the specified radix (as
+ * determined by whether {@link java.lang.Character#digit(char,
+ * int)} returns a nonnegative value) except that the first
+ * character may be an ASCII minus sign {@code '-'}
+ * (<code>'\u002D'</code>) to indicate a negative value or an
+ * ASCII plus sign {@code '+'} (<code>'\u002B'</code>) to
+ * indicate a positive value. The resulting {@code byte} value is
+ * returned.
+ *
+ * <p>An exception of type {@code NumberFormatException} is
+ * thrown if any of the following situations occurs:
+ * <ul>
+ * <li> The first argument is {@code null} or is a string of
+ * length zero.
+ *
+ * <li> The radix is either smaller than {@link
+ * java.lang.Character#MIN_RADIX} or larger than {@link
+ * java.lang.Character#MAX_RADIX}.
+ *
+ * <li> Any character of the string is not a digit of the
+ * specified radix, except that the first character may be a minus
+ * sign {@code '-'} (<code>'\u002D'</code>) or plus sign
+ * {@code '+'} (<code>'\u002B'</code>) provided that the
+ * string is longer than length 1.
+ *
+ * <li> The value represented by the string is not a value of type
+ * {@code byte}.
+ * </ul>
+ *
+ * @param s the {@code String} containing the
+ * {@code byte}
+ * representation to be parsed
+ * @param radix the radix to be used while parsing {@code s}
+ * @return the {@code byte} value represented by the string
+ * argument in the specified radix
+ * @throws NumberFormatException If the string does
+ * not contain a parsable {@code byte}.
+ */
+ public static byte parseByte(String s, int radix)
+ throws NumberFormatException {
+ int i = Integer.parseInt(s, radix);
+ if (i < MIN_VALUE || i > MAX_VALUE)
+ throw new NumberFormatException(
+ "Value out of range. Value:\"" + s + "\" Radix:" + radix);
+ return (byte)i;
+ }
+
+ /**
+ * Parses the string argument as a signed decimal {@code
+ * byte}. The characters in the string must all be decimal digits,
+ * except that the first character may be an ASCII minus sign
+ * {@code '-'} (<code>'\u002D'</code>) to indicate a negative
+ * value or an ASCII plus sign {@code '+'}
+ * (<code>'\u002B'</code>) to indicate a positive value. The
+ * resulting {@code byte} value is returned, exactly as if the
+ * argument and the radix 10 were given as arguments to the {@link
+ * #parseByte(java.lang.String, int)} method.
+ *
+ * @param s a {@code String} containing the
+ * {@code byte} representation to be parsed
+ * @return the {@code byte} value represented by the
+ * argument in decimal
+ * @throws NumberFormatException if the string does not
+ * contain a parsable {@code byte}.
+ */
+ public static byte parseByte(String s) throws NumberFormatException {
+ return parseByte(s, 10);
+ }
+
+ /**
+ * Returns a {@code Byte} object holding the value
+ * extracted from the specified {@code String} when parsed
+ * with the radix given by the second argument. The first argument
+ * is interpreted as representing a signed {@code byte} in
+ * the radix specified by the second argument, exactly as if the
+ * argument were given to the {@link #parseByte(java.lang.String,
+ * int)} method. The result is a {@code Byte} object that
+ * represents the {@code byte} value specified by the string.
+ *
+ * <p> In other words, this method returns a {@code Byte} object
+ * equal to the value of:
+ *
+ * <blockquote>
+ * {@code new Byte(Byte.parseByte(s, radix))}
+ * </blockquote>
+ *
+ * @param s the string to be parsed
+ * @param radix the radix to be used in interpreting {@code s}
+ * @return a {@code Byte} object holding the value
+ * represented by the string argument in the
+ * specified radix.
+ * @throws NumberFormatException If the {@code String} does
+ * not contain a parsable {@code byte}.
+ */
+ public static Byte valueOf(String s, int radix)
+ throws NumberFormatException {
+ return new Byte(parseByte(s, radix));
+ }
+
+ /**
+ * Returns a {@code Byte} object holding the value
+ * given by the specified {@code String}. The argument is
+ * interpreted as representing a signed decimal {@code byte},
+ * exactly as if the argument were given to the {@link
+ * #parseByte(java.lang.String)} method. The result is a
+ * {@code Byte} object that represents the {@code byte}
+ * value specified by the string.
+ *
+ * <p> In other words, this method returns a {@code Byte} object
+ * equal to the value of:
+ *
+ * <blockquote>
+ * {@code new Byte(Byte.parseByte(s))}
+ * </blockquote>
+ *
+ * @param s the string to be parsed
+ * @return a {@code Byte} object holding the value
+ * represented by the string argument
+ * @throws NumberFormatException If the {@code String} does
+ * not contain a parsable {@code byte}.
+ */
+ public static Byte valueOf(String s) throws NumberFormatException {
+ return valueOf(s, 10);
+ }
+
+ /**
+ * Decodes a {@code String} into a {@code Byte}.
+ * Accepts decimal, hexadecimal, and octal numbers given by
+ * the following grammar:
+ *
+ * <blockquote>
+ * <dl>
+ * <dt><i>DecodableString:</i>
+ * <dd><i>Sign<sub>opt</sub> DecimalNumeral</i>
+ * <dd><i>Sign<sub>opt</sub></i> {@code 0x} <i>HexDigits</i>
+ * <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i>
+ * <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i>
+ * <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i>
+ * <p>
+ * <dt><i>Sign:</i>
+ * <dd>{@code -}
+ * <dd>{@code +}
+ * </dl>
+ * </blockquote>
+ *
+ * <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i>
+ * are defined in <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">§3.10.1</a>
+ * of the <a href="http://java.sun.com/docs/books/jls/html/">Java
+ * Language Specification</a>.
+ *
+ * <p>The sequence of characters following an optional
+ * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
+ * "{@code #}", or leading zero) is parsed as by the {@code
+ * Byte.parseByte} method with the indicated radix (10, 16, or 8).
+ * This sequence of characters must represent a positive value or
+ * a {@link NumberFormatException} will be thrown. The result is
+ * negated if first character of the specified {@code String} is
+ * the minus sign. No whitespace characters are permitted in the
+ * {@code String}.
+ *
+ * @param nm the {@code String} to decode.
+ * @return a {@code Byte} object holding the {@code byte}
+ * value represented by {@code nm}
+ * @throws NumberFormatException if the {@code String} does not
+ * contain a parsable {@code byte}.
+ * @see java.lang.Byte#parseByte(java.lang.String, int)
+ */
+ public static Byte decode(String nm) throws NumberFormatException {
+ int i = Integer.decode(nm);
+ if (i < MIN_VALUE || i > MAX_VALUE)
+ throw new NumberFormatException(
+ "Value " + i + " out of range from input " + nm);
+ return (byte)i;
+ }
+
+ /**
+ * The value of the {@code Byte}.
+ *
+ * @serial
+ */
+ private final byte value;
+
+ /**
+ * Constructs a newly allocated {@code Byte} object that
+ * represents the specified {@code byte} value.
+ *
+ * @param value the value to be represented by the
+ * {@code Byte}.
+ */
+ public Byte(byte value) {
+ this.value = value;
+ }
+
+ /**
+ * Constructs a newly allocated {@code Byte} object that
+ * represents the {@code byte} value indicated by the
+ * {@code String} parameter. The string is converted to a
+ * {@code byte} value in exactly the manner used by the
+ * {@code parseByte} method for radix 10.
+ *
+ * @param s the {@code String} to be converted to a
+ * {@code Byte}
+ * @throws NumberFormatException If the {@code String}
+ * does not contain a parsable {@code byte}.
+ * @see java.lang.Byte#parseByte(java.lang.String, int)
+ */
+ public Byte(String s) throws NumberFormatException {
+ this.value = parseByte(s, 10);
+ }
+
+ /**
+ * Returns the value of this {@code Byte} as a
+ * {@code byte}.
+ */
+ public byte byteValue() {
+ return value;
+ }
+
+ /**
+ * Returns the value of this {@code Byte} as a
+ * {@code short}.
+ */
+ public short shortValue() {
+ return (short)value;
+ }
+
+ /**
+ * Returns the value of this {@code Byte} as an
+ * {@code int}.
+ */
+ public int intValue() {
+ return (int)value;
+ }
+
+ /**
+ * Returns the value of this {@code Byte} as a
+ * {@code long}.
+ */
+ public long longValue() {
+ return (long)value;
+ }
+
+ /**
+ * Returns the value of this {@code Byte} as a
+ * {@code float}.
+ */
+ public float floatValue() {
+ return (float)value;
+ }
+
+ /**
+ * Returns the value of this {@code Byte} as a
+ * {@code double}.
+ */
+ public double doubleValue() {
+ return (double)value;
+ }
+
+ /**
+ * Returns a {@code String} object representing this
+ * {@code Byte}'s value. The value is converted to signed
+ * decimal representation and returned as a string, exactly as if
+ * the {@code byte} value were given as an argument to the
+ * {@link java.lang.Byte#toString(byte)} method.
+ *
+ * @return a string representation of the value of this object in
+ * base 10.
+ */
+ public String toString() {
+ return String.valueOf((int)value);
+ }
+
+ /**
+ * Returns a hash code for this {@code Byte}.
+ */
+ public int hashCode() {
+ return (int)value;
+ }
+
+ /**
+ * Compares this object to the specified object. The result is
+ * {@code true} if and only if the argument is not
+ * {@code null} and is a {@code Byte} object that
+ * contains the same {@code byte} value as this object.
+ *
+ * @param obj the object to compare with
+ * @return {@code true} if the objects are the same;
+ * {@code false} otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof Byte) {
+ return value == ((Byte)obj).byteValue();
+ }
+ return false;
+ }
+
+ /**
+ * Compares two {@code Byte} objects numerically.
+ *
+ * @param anotherByte the {@code Byte} to be compared.
+ * @return the value {@code 0} if this {@code Byte} is
+ * equal to the argument {@code Byte}; a value less than
+ * {@code 0} if this {@code Byte} is numerically less
+ * than the argument {@code Byte}; and a value greater than
+ * {@code 0} if this {@code Byte} is numerically
+ * greater than the argument {@code Byte} (signed
+ * comparison).
+ * @since 1.2
+ */
+ public int compareTo(Byte anotherByte) {
+ return this.value - anotherByte.value;
+ }
+
+ /**
+ * The number of bits used to represent a {@code byte} value in two's
+ * complement binary form.
+ *
+ * @since 1.5
+ */
+ public static final int SIZE = 8;
+
+ /** use serialVersionUID from JDK 1.1. for interoperability */
+ private static final long serialVersionUID = -7183698231559129828L;
+}
Added: trunk/core/src/openjdk/java/java/lang/Integer.java
===================================================================
--- trunk/core/src/openjdk/java/java/lang/Integer.java (rev 0)
+++ trunk/core/src/openjdk/java/java/lang/Integer.java 2007-06-17 07:09:54 UTC (rev 3265)
@@ -0,0 +1,1207 @@
+/*
+ * Copyright 1994-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.lang;
+
+/**
+ * The {@code Integer} class wraps a value of the primitive type
+ * {@code int} in an object. An object of type {@code Integer}
+ * contains a single field whose type is {@code int}.
+ *
+ * <p>In addition, this class provides several methods for converting
+ * an {@code int} to a {@code String} and a {@code String} to an
+ * {@code int}, as well as other constants and methods useful when
+ * dealing with an {@code int}.
+ *
+ * <p>Implementation note: The implementations of the "bit twiddling"
+ * methods (such as {@link #highestOneBit(int) highestOneBit} and
+ * {@link #numberOfTrailingZeros(int) numberOfTrailingZeros}) are
+ * based on material from Henry S. Warren, Jr.'s <i>Hacker's
+ * Delight</i>, (Addison Wesley, 2002).
+ *
+ * @author Lee Boynton
+ * @author Arthur van Hoff
+ * @author Josh Bloch
+ * @author Joseph D. Darcy
+ * @version 1.100, 05/05/07
+ * @since JDK1.0
+ */
+public final class Integer extends Number implements Comparable<Integer> {
+ /**
+ * A constant holding the minimum value an {@code int} can
+ * have, -2<sup>31</sup>.
+ */
+ public static final int MIN_VALUE = 0x80000000;
+
+ /**
+ * A constant holding the maximum value an {@code int} can
+ * have, 2<sup>31</sup>-1.
+ */
+ public static final int MAX_VALUE = 0x7fffffff;
+
+ /**
+ * The {@code Class} instance representing the primitive type
+ * {@code int}.
+ *
+ * @since JDK1.1
+ */
+ public static final Class<Integer> TYPE = (Class<Integer>) Class.getPrimitiveClass("int");
+
+ /**
+ * All possible chars for representing a number as a String
+ */
+ final static char[] digits = {
+ '0' , '1' , '2' , '3' , '4' , '5' ,
+ '6' , '7' , '8' , '9' , 'a' , 'b' ,
+ 'c' , 'd' , 'e' , 'f' , 'g' , 'h' ,
+ 'i' , 'j' , 'k' , 'l' , 'm' , 'n' ,
+ 'o' , 'p' , 'q' , 'r' , 's' , 't' ,
+ 'u' , 'v' , 'w' , 'x' , 'y' , 'z'
+ };
+
+ /**
+ * Returns a string representation of the first argument in the
+ * radix specified by the second argument.
+ *
+ * <p>If the radix is smaller than {@code Character.MIN_RADIX}
+ * or larger than {@code Character.MAX_RADIX}, then the radix
+ * {@code 10} is used instead.
+ *
+ * <p>If the first argument is negative, the first element of the
+ * result is the ASCII minus character {@code '-'}
+ * (<code>'\u002D'</code>). If the first argument is not
+ * negative, no sign character appears in the result.
+ *
+ * <p>The remaining characters of the result represent the magnitude
+ * of the first argume...
[truncated message content] |
|
From: <ls...@us...> - 2007-06-17 06:57:37
|
Revision: 3264
http://jnode.svn.sourceforge.net/jnode/?rev=3264&view=rev
Author: lsantha
Date: 2007-06-16 23:57:33 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Added icedtea sourcetree.
Modified Paths:
--------------
trunk/core/build.xml
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-06-17 06:56:25 UTC (rev 3263)
+++ trunk/core/build.xml 2007-06-17 06:57:33 UTC (rev 3264)
@@ -40,7 +40,7 @@
<pathelement location="${my-src.dir}/vmmagic"/>
<pathelement location="${my-src.dir}/mmtk-vm"/>
<pathelement location="${my-src.dir}/driver"/>
-<!-- <pathelement location="${my-src.dir}/icedtea"/> -->
+ <pathelement location="${my-src.dir}/icedtea"/>
<pathelement location="${my-src.dir}/test"/>
</path>
<path id="my-sources">
@@ -137,7 +137,7 @@
<fileset dir="${my-src.dir}/openjdk/com" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/openjdk/sun" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/openjdk/vm" excludes="${my-non-resources}"/>
-<!-- <fileset dir="${my-src.dir}/icedtea" excludes="${my-non-resources}"/> -->
+ <fileset dir="${my-src.dir}/icedtea" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/core" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/nanoxml" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/vmmagic" excludes="${my-non-resources}"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-17 06:56:28
|
Revision: 3263
http://jnode.svn.sourceforge.net/jnode/?rev=3263&view=rev
Author: lsantha
Date: 2007-06-16 23:56:25 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Added icedtea sourcetree.
Added Paths:
-----------
trunk/core/src/icedtea/
trunk/core/src/icedtea/sun/
trunk/core/src/icedtea/sun/nio/
trunk/core/src/icedtea/sun/nio/cs/
trunk/core/src/icedtea/sun/nio/cs/StandardCharsets.java
Added: trunk/core/src/icedtea/sun/nio/cs/StandardCharsets.java
===================================================================
--- trunk/core/src/icedtea/sun/nio/cs/StandardCharsets.java (rev 0)
+++ trunk/core/src/icedtea/sun/nio/cs/StandardCharsets.java 2007-06-17 06:56:25 UTC (rev 3263)
@@ -0,0 +1,680 @@
+/*
+ * @(#)StandardCharsets.java 1.30 06/01/20
+ */
+
+// -- This file was mechanically generated: Do not edit! -- //
+
+package sun.nio.cs;
+
+import java.nio.charset.*;
+
+
+public class StandardCharsets
+ extends FastCharsetProvider
+{
+
+ static final String[] aliases_US_ASCII = new String[] {
+ "iso-ir-6",
+ "ANSI_X3.4-1986",
+ "ISO_646.irv:1991",
+ "ASCII",
+ "ISO646-US",
+ "us",
+ "IBM367",
+ "cp367",
+ "csASCII",
+ "default",
+ "646",
+ "iso_646.irv:1983",
+ "ANSI_X3.4-1968",
+ "ascii7",
+ };
+
+ static final String[] aliases_UTF_8 = new String[] {
+ "UTF8",
+ "unicode-1-1-utf-8",
+ };
+
+ static final String[] aliases_UTF_16 = new String[] {
+ "UTF_16",
+ "utf16",
+ "unicode",
+ "UnicodeBig",
+ };
+
+ static final String[] aliases_UTF_16BE = new String[] {
+ "UTF_16BE",
+ "ISO-10646-UCS-2",
+ "X-UTF-16BE",
+ "UnicodeBigUnmarked",
+ };
+
+ static final String[] aliases_UTF_16LE = new String[] {
+ "UTF_16LE",
+ "X-UTF-16LE",
+ "UnicodeLittleUnmarked",
+ };
+
+ static final String[] aliases_UTF_16LE_BOM = new String[] {
+ "UnicodeLittle",
+ };
+
+ static final String[] aliases_UTF_32 = new String[] {
+ "UTF_32",
+ "UTF32",
+ };
+
+ static final String[] aliases_UTF_32LE = new String[] {
+ "UTF_32LE",
+ "X-UTF-32LE",
+ };
+
+ static final String[] aliases_UTF_32BE = new String[] {
+ "UTF_32BE",
+ "X-UTF-32BE",
+ };
+
+ static final String[] aliases_UTF_32LE_BOM = new String[] {
+ "UTF_32LE_BOM",
+ "UTF-32LE-BOM",
+ };
+
+ static final String[] aliases_UTF_32BE_BOM = new String[] {
+ "UTF_32BE_BOM",
+ "UTF-32BE-BOM",
+ };
+
+ static final String[] aliases_ISO_8859_1 = new String[] {
+ "iso-ir-100",
+ "ISO_8859-1",
+ "latin1",
+ "l1",
+ "IBM819",
+ "cp819",
+ "csISOLatin1",
+ "819",
+ "IBM-819",
+ "ISO8859_1",
+ "ISO_8859-1:1987",
+ "ISO_8859_1",
+ "8859_1",
+ "ISO8859-1",
+ };
+
+ static final String[] aliases_ISO_8859_2 = new String[] {
+ "iso8859_2",
+ "8859_2",
+ "iso-ir-101",
+ "ISO_8859-2",
+ "ISO_8859-2:1987",
+ "ISO8859-2",
+ "latin2",
+ "l2",
+ "ibm912",
+ "ibm-912",
+ "cp912",
+ "912",
+ "csISOLatin2",
+ };
+
+ static final String[] aliases_ISO_8859_4 = new String[] {
+ "iso8859_4",
+ "iso8859-4",
+ "8859_4",
+ "iso-ir-110",
+ "ISO_8859-4",
+ "ISO_8859-4:1988",
+ "latin4",
+ "l4",
+ "ibm914",
+ "ibm-914",
+ "cp914",
+ "914",
+ "csISOLatin4",
+ };
+
+ static final String[] aliases_ISO_8859_5 = new String[] {
+ "iso8859_5",
+ "8859_5",
+ "iso-ir-144",
+ "ISO_8859-5",
+ "ISO_8859-5:1988",
+ "ISO8859-5",
+ "cyrillic",
+ "ibm915",
+ "ibm-915",
+ "cp915",
+ "915",
+ "csISOLatinCyrillic",
+ };
+
+ static final String[] aliases_ISO_8859_7 = new String[] {
+ "iso8859_7",
+ "8859_7",
+ "iso-ir-126",
+ "ISO_8859-7",
+ "ISO_8859-7:1987",
+ "ELOT_928",
+ "ECMA-118",
+ "greek",
+ "greek8",
+ "csISOLatinGreek",
+ "sun_eu_greek",
+ "ibm813",
+ "ibm-813",
+ "813",
+ "cp813",
+ "iso8859-7",
+ };
+
+ static final String[] aliases_ISO_8859_9 = new String[] {
+ "iso8859_9",
+ "8859_9",
+ "iso-ir-148",
+ "ISO_8859-9",
+ "ISO_8859-9:1989",
+ "ISO8859-9",
+ "latin5",
+ "l5",
+ "ibm920",
+ "ibm-920",
+ "920",
+ "cp920",
+ "csISOLatin5",
+ };
+
+ static final String[] aliases_ISO_8859_13 = new String[] {
+ "iso8859_13",
+ "8859_13",
+ "iso_8859-13",
+ "ISO8859-13",
+ };
+
+ static final String[] aliases_ISO_8859_15 = new String[] {
+ "ISO_8859-15",
+ "8859_15",
+ "ISO-8859-15",
+ "ISO8859_15",
+ "ISO8859-15",
+ "IBM923",
+ "IBM-923",
+ "cp923",
+ "923",
+ "LATIN0",
+ "LATIN9",
+ "L9",
+ "csISOlatin0",
+ "csISOlatin9",
+ "ISO8859_15_FDIS",
+ };
+
+ static final String[] aliases_KOI8_R = new String[] {
+ "koi8_r",
+ "koi8",
+ "cskoi8r",
+ };
+
+ static final String[] aliases_KOI8_U = new String[] {
+ "koi8_u",
+ };
+
+ static final String[] aliases_MS1250 = new String[] {
+ "cp1250",
+ "cp5346",
+ };
+
+ static final String[] aliases_MS1251 = new String[] {
+ "cp1251",
+ "cp5347",
+ "ansi-1251",
+ };
+
+ static final String[] aliases_MS1252 = new String[] {
+ "cp1252",
+ "cp5348",
+ };
+
+ static final String[] aliases_MS1253 = new String[] {
+ "cp1253",
+ "cp5349",
+ };
+
+ static final String[] aliases_MS1254 = new String[] {
+ "cp1254",
+ "cp5350",
+ };
+
+ static final String[] aliases_MS1257 = new String[] {
+ "cp1257",
+ "cp5353",
+ };
+
+ static final String[] aliases_IBM437 = new String[] {
+ "cp437",
+ "ibm437",
+ "ibm-437",
+ "437",
+ "cspc8codepage437",
+ "windows-437",
+ };
+
+ static final String[] aliases_IBM737 = new String[] {
+ "cp737",
+ "ibm737",
+ "ibm-737",
+ "737",
+ };
+
+ static final String[] aliases_IBM775 = new String[] {
+ "cp775",
+ "ibm775",
+ "ibm-775",
+ "775",
+ };
+
+ static final String[] aliases_IBM850 = new String[] {
+ "cp850",
+ "ibm-850",
+ "ibm850",
+ "850",
+ "cspc850multilingual",
+ };
+
+ static final String[] aliases_IBM852 = new String[] {
+ "cp852",
+ "ibm852",
+ "ibm-852",
+ "852",
+ "csPCp852",
+ };
+
+ static final String[] aliases_IBM855 = new String[] {
+ "cp855",
+ "ibm-855",
+ "ibm855",
+ "855",
+ "cspcp855",
+ };
+
+ static final String[] aliases_IBM857 = new String[] {
+ "cp857",
+ "ibm857",
+ "ibm-857",
+ "857",
+ "csIBM857",
+ };
+
+ static final String[] aliases_IBM858 = new String[] {
+ "cp858",
+ "ccsid00858",
+ "cp00858",
+ "858",
+ };
+
+ static final String[] aliases_IBM862 = new String[] {
+ "cp862",
+ "ibm862",
+ "ibm-862",
+ "862",
+ "csIBM862",
+ "cspc862latinhebrew",
+ };
+
+ static final String[] aliases_IBM866 = new String[] {
+ "cp866",
+ "ibm866",
+ "ibm-866",
+ "866",
+ "csIBM866",
+ };
+
+ static final String[] aliases_IBM874 = new String[] {
+ "cp874",
+ "ibm874",
+ "ibm-874",
+ "874",
+ };
+
+ private static final class Aliases
+ extends sun.util.PreHashedMap<String>
+ {
+
+ private static final int ROWS = 1024;
+ private static final int SIZE = 208;
+ private static final int SHIFT = 0;
+ private static final int MASK = 0x3ff;
+
+ private Aliases() {
+ super(ROWS, SIZE, SHIFT, MASK);
+ }
+
+ protected void init(Object[] ht) {
+ ht[1] = new Object[] { "csisolatin0", "iso-8859-15" };
+ ht[2] = new Object[] { "csisolatin1", "iso-8859-1" };
+ ht[3] = new Object[] { "csisolatin2", "iso-8859-2" };
+ ht[5] = new Object[] { "csisolatin4", "iso-8859-4" };
+ ht[6] = new Object[] { "csisolatin5", "iso-8859-9" };
+ ht[10] = new Object[] { "csisolatin9", "iso-8859-15" };
+ ht[19] = new Object[] { "unicodelittle", "x-utf-16le-bom" };
+ ht[24] = new Object[] { "iso646-us", "us-ascii" };
+ ht[25] = new Object[] { "iso_8859-7:1987", "iso-8859-7" };
+ ht[26] = new Object[] { "912", "iso-8859-2" };
+ ht[28] = new Object[] { "914", "iso-8859-4" };
+ ht[29] = new Object[] { "915", "iso-8859-5" };
+ ht[55] = new Object[] { "920", "iso-8859-9" };
+ ht[58] = new Object[] { "923", "iso-8859-15" };
+ ht[86] = new Object[] { "csisolatincyrillic", "iso-8859-5",
+ new Object[] { "8859_1", "iso-8859-1" } };
+ ht[87] = new Object[] { "8859_2", "iso-8859-2" };
+ ht[89] = new Object[] { "8859_4", "iso-8859-4" };
+ ht[90] = new Object[] { "813", "iso-8859-7",
+ new Object[] { "8859_5", "iso-8859-5" } };
+ ht[92] = new Object[] { "8859_7", "iso-8859-7" };
+ ht[94] = new Object[] { "8859_9", "iso-8859-9" };
+ ht[95] = new Object[] { "iso_8859-1:1987", "iso-8859-1" };
+ ht[96] = new Object[] { "819", "iso-8859-1" };
+ ht[106] = new Object[] { "unicode-1-1-utf-8", "utf-8" };
+ ht[121] = new Object[] { "x-utf-16le", "utf-16le" };
+ ht[125] = new Object[] { "ecma-118", "iso-8859-7" };
+ ht[134] = new Object[] { "koi8_r", "koi8-r" };
+ ht[137] = new Object[] { "koi8_u", "koi8-u" };
+ ht[141] = new Object[] { "cp912", "iso-8859-2" };
+ ht[143] = new Object[] { "cp914", "iso-8859-4" };
+ ht[144] = new Object[] { "cp915", "iso-8859-5" };
+ ht[170] = new Object[] { "cp920", "iso-8859-9" };
+ ht[173] = new Object[] { "cp923", "iso-8859-15" };
+ ht[177] = new Object[] { "utf_32le_bom", "x-utf-32le-bom" };
+ ht[192] = new Object[] { "utf_16be", "utf-16be" };
+ ht[199] = new Object[] { "cspc8codepage437", "ibm437",
+ new Object[] { "ansi-1251", "windows-1251" } };
+ ht[205] = new Object[] { "cp813", "iso-8859-7" };
+ ht[211] = new Object[] { "850", "ibm850",
+ new Object[] { "cp819", "iso-8859-1" } };
+ ht[213] = new Object[] { "852", "ibm852" };
+ ht[216] = new Object[] { "855", "ibm855" };
+ ht[218] = new Object[] { "857", "ibm857",
+ new Object[] { "iso-ir-6", "us-ascii" } };
+ ht[219] = new Object[] { "858", "ibm00858",
+ new Object[] { "737", "x-ibm737" } };
+ ht[225] = new Object[] { "csascii", "us-ascii" };
+ ht[244] = new Object[] { "862", "ibm862" };
+ ht[248] = new Object[] { "866", "ibm866" };
+ ht[253] = new Object[] { "x-utf-32be", "utf-32be" };
+ ht[254] = new Object[] { "iso_8859-2:1987", "iso-8859-2" };
+ ht[259] = new Object[] { "unicodebig", "utf-16" };
+ ht[269] = new Object[] { "iso8859_15_fdis", "iso-8859-15" };
+ ht[277] = new Object[] { "874", "x-ibm874" };
+ ht[280] = new Object[] { "unicodelittleunmarked", "utf-16le" };
+ ht[283] = new Object[] { "iso8859_1", "iso-8859-1" };
+ ht[284] = new Object[] { "iso8859_2", "iso-8859-2" };
+ ht[286] = new Object[] { "iso8859_4", "iso-8859-4" };
+ ht[287] = new Object[] { "iso8859_5", "iso-8859-5" };
+ ht[289] = new Object[] { "iso8859_7", "iso-8859-7" };
+ ht[291] = new Object[] { "iso8859_9", "iso-8859-9" };
+ ht[294] = new Object[] { "ibm912", "iso-8859-2" };
+ ht[296] = new Object[] { "ibm914", "iso-8859-4" };
+ ht[297] = new Object[] { "ibm915", "iso-8859-5" };
+ ht[305] = new Object[] { "iso_8859-13", "iso-8859-13" };
+ ht[307] = new Object[] { "iso_8859-15", "iso-8859-15" };
+ ht[312] = new Object[] { "greek8", "iso-8859-7",
+ new Object[] { "646", "us-ascii" } };
+ ht[321] = new Object[] { "ibm-912", "iso-8859-2" };
+ ht[323] = new Object[] { "ibm920", "iso-8859-9",
+ new Object[] { "ibm-914", "iso-8859-4" } };
+ ht[324] = new Object[] { "ibm-915", "iso-8859-5" };
+ ht[325] = new Object[] { "l1", "iso-8859-1" };
+ ht[326] = new Object[] { "cp850", "ibm850",
+ new Object[] { "ibm923", "iso-8859-15",
+ new Object[] { "l2", "iso-8859-2" } } };
+ ht[327] = new Object[] { "cyrillic", "iso-8859-5" };
+ ht[328] = new Object[] { "cp852", "ibm852",
+ new Object[] { "l4", "iso-8859-4" } };
+ ht[329] = new Object[] { "l5", "iso-8859-9" };
+ ht[331] = new Object[] { "cp855", "ibm855" };
+ ht[333] = new Object[] { "cp857", "ibm857",
+ new Object[] { "l9", "iso-8859-15" } };
+ ht[334] = new Object[] { "cp858", "ibm00858",
+ new Object[] { "cp737", "x-ibm737" } };
+ ht[336] = new Object[] { "iso_8859_1", "iso-8859-1" };
+ ht[339] = new Object[] { "koi8", "koi8-r" };
+ ht[341] = new Object[] { "775", "ibm775" };
+ ht[345] = new Object[] { "iso_8859-9:1989", "iso-8859-9" };
+ ht[350] = new Object[] { "ibm-920", "iso-8859-9" };
+ ht[353] = new Object[] { "ibm-923", "iso-8859-15" };
+ ht[358] = new Object[] { "ibm813", "iso-8859-7" };
+ ht[359] = new Object[] { "cp862", "ibm862" };
+ ht[363] = new Object[] { "cp866", "ibm866" };
+ ht[364] = new Object[] { "ibm819", "iso-8859-1" };
+ ht[378] = new Object[] { "ansi_x3.4-1968", "us-ascii" };
+ ht[385] = new Object[] { "ibm-813", "iso-8859-7" };
+ ht[391] = new Object[] { "ibm-819", "iso-8859-1" };
+ ht[392] = new Object[] { "cp874", "x-ibm874" };
+ ht[405] = new Object[] { "iso-ir-100", "iso-8859-1" };
+ ht[406] = new Object[] { "iso-ir-101", "iso-8859-2" };
+ ht[408] = new Object[] { "437", "ibm437" };
+ ht[421] = new Object[] { "iso-8859-15", "iso-8859-15" };
+ ht[428] = new Object[] { "latin0", "iso-8859-15" };
+ ht[429] = new Object[] { "latin1", "iso-8859-1" };
+ ht[430] = new Object[] { "latin2", "iso-8859-2" };
+ ht[432] = new Object[] { "latin4", "iso-8859-4" };
+ ht[433] = new Object[] { "latin5", "iso-8859-9" };
+ ht[436] = new Object[] { "iso-ir-110", "iso-8859-4" };
+ ht[437] = new Object[] { "latin9", "iso-8859-15" };
+ ht[438] = new Object[] { "ansi_x3.4-1986", "us-ascii" };
+ ht[443] = new Object[] { "utf-32be-bom", "x-utf-32be-bom" };
+ ht[456] = new Object[] { "cp775", "ibm775" };
+ ht[473] = new Object[] { "iso-ir-126", "iso-8859-7" };
+ ht[479] = new Object[] { "ibm850", "ibm850" };
+ ht[481] = new Object[] { "ibm852", "ibm852" };
+ ht[484] = new Object[] { "ibm855", "ibm855" };
+ ht[486] = new Object[] { "ibm857", "ibm857" };
+ ht[487] = new Object[] { "ibm737", "x-ibm737" };
+ ht[502] = new Object[] { "utf_16le", "utf-16le" };
+ ht[506] = new Object[] { "ibm-850", "ibm850" };
+ ht[508] = new Object[] { "ibm-852", "ibm852" };
+ ht[511] = new Object[] { "ibm-855", "ibm855" };
+ ht[512] = new Object[] { "ibm862", "ibm862" };
+ ht[513] = new Object[] { "ibm-857", "ibm857" };
+ ht[514] = new Object[] { "ibm-737", "x-ibm737" };
+ ht[516] = new Object[] { "ibm866", "ibm866" };
+ ht[520] = new Object[] { "unicodebigunmarked", "utf-16be" };
+ ht[523] = new Object[] { "cp437", "ibm437" };
+ ht[524] = new Object[] { "utf16", "utf-16" };
+ ht[533] = new Object[] { "iso-ir-144", "iso-8859-5" };
+ ht[537] = new Object[] { "iso-ir-148", "iso-8859-9" };
+ ht[539] = new Object[] { "ibm-862", "ibm862" };
+ ht[543] = new Object[] { "ibm-866", "ibm866" };
+ ht[545] = new Object[] { "ibm874", "x-ibm874" };
+ ht[563] = new Object[] { "x-utf-32le", "utf-32le" };
+ ht[572] = new Object[] { "ibm-874", "x-ibm874" };
+ ht[573] = new Object[] { "iso_8859-4:1988", "iso-8859-4" };
+ ht[577] = new Object[] { "default", "us-ascii" };
+ ht[582] = new Object[] { "utf32", "utf-32" };
+ ht[588] = new Object[] { "elot_928", "iso-8859-7" };
+ ht[593] = new Object[] { "csisolatingreek", "iso-8859-7" };
+ ht[598] = new Object[] { "csibm857", "ibm857" };
+ ht[609] = new Object[] { "ibm775", "ibm775" };
+ ht[617] = new Object[] { "cp1250", "windows-1250" };
+ ht[618] = new Object[] { "cp1251", "windows-1251" };
+ ht[619] = new Object[] { "cp1252", "windows-1252" };
+ ht[620] = new Object[] { "cp1253", "windows-1253" };
+ ht[621] = new Object[] { "cp1254", "windows-1254" };
+ ht[624] = new Object[] { "csibm862", "ibm862",
+ new Object[] { "cp1257", "windows-1257" } };
+ ht[628] = new Object[] { "csibm866", "ibm866" };
+ ht[632] = new Object[] { "iso8859_13", "iso-8859-13" };
+ ht[634] = new Object[] { "iso8859_15", "iso-8859-15",
+ new Object[] { "utf_32be", "utf-32be" } };
+ ht[635] = new Object[] { "utf_32be_bom", "x-utf-32be-bom" };
+ ht[636] = new Object[] { "ibm-775", "ibm775" };
+ ht[654] = new Object[] { "cp00858", "ibm00858" };
+ ht[669] = new Object[] { "8859_13", "iso-8859-13" };
+ ht[670] = new Object[] { "us", "us-ascii" };
+ ht[671] = new Object[] { "8859_15", "iso-8859-15" };
+ ht[676] = new Object[] { "ibm437", "ibm437" };
+ ht[679] = new Object[] { "cp367", "us-ascii" };
+ ht[686] = new Object[] { "iso-10646-ucs-2", "utf-16be" };
+ ht[703] = new Object[] { "ibm-437", "ibm437" };
+ ht[710] = new Object[] { "iso8859-13", "iso-8859-13" };
+ ht[712] = new Object[] { "iso8859-15", "iso-8859-15" };
+ ht[732] = new Object[] { "iso_8859-5:1988", "iso-8859-5" };
+ ht[733] = new Object[] { "unicode", "utf-16" };
+ ht[768] = new Object[] { "greek", "iso-8859-7" };
+ ht[774] = new Object[] { "ascii7", "us-ascii" };
+ ht[781] = new Object[] { "iso8859-1", "iso-8859-1" };
+ ht[782] = new Object[] { "iso8859-2", "iso-8859-2" };
+ ht[783] = new Object[] { "cskoi8r", "koi8-r" };
+ ht[784] = new Object[] { "iso8859-4", "iso-8859-4" };
+ ht[785] = new Object[] { "iso8859-5", "iso-8859-5" };
+ ht[787] = new Object[] { "iso8859-7", "iso-8859-7" };
+ ht[789] = new Object[] { "iso8859-9", "iso-8859-9" };
+ ht[813] = new Object[] { "ccsid00858", "ibm00858" };
+ ht[818] = new Object[] { "cspc862latinhebrew", "ibm862" };
+ ht[832] = new Object[] { "ibm367", "us-ascii" };
+ ht[834] = new Object[] { "iso_8859-1", "iso-8859-1" };
+ ht[835] = new Object[] { "iso_8859-2", "iso-8859-2",
+ new Object[] { "x-utf-16be", "utf-16be" } };
+ ht[836] = new Object[] { "sun_eu_greek", "iso-8859-7" };
+ ht[837] = new Object[] { "iso_8859-4", "iso-8859-4" };
+ ht[838] = new Object[] { "iso_8859-5", "iso-8859-5" };
+ ht[840] = new Object[] { "cspcp852", "ibm852",
+ new Object[] { "iso_8859-7", "iso-8859-7" } };
+ ht[842] = new Object[] { "iso_8859-9", "iso-8859-9" };
+ ht[843] = new Object[] { "cspcp855", "ibm855" };
+ ht[846] = new Object[] { "windows-437", "ibm437" };
+ ht[849] = new Object[] { "ascii", "us-ascii" };
+ ht[881] = new Object[] { "utf8", "utf-8" };
+ ht[896] = new Object[] { "iso_646.irv:1983", "us-ascii" };
+ ht[909] = new Object[] { "cp5346", "windows-1250" };
+ ht[910] = new Object[] { "cp5347", "windows-1251" };
+ ht[911] = new Object[] { "cp5348", "windows-1252" };
+ ht[912] = new Object[] { "cp5349", "windows-1253" };
+ ht[925] = new Object[] { "iso_646.irv:1991", "us-ascii" };
+ ht[934] = new Object[] { "cp5350", "windows-1254" };
+ ht[937] = new Object[] { "cp5353", "windows-1257" };
+ ht[944] = new Object[] { "utf_32le", "utf-32le" };
+ ht[957] = new Object[] { "utf_16", "utf-16" };
+ ht[993] = new Object[] { "cspc850multilingual", "ibm850" };
+ ht[1009] = new Object[] { "utf-32le-bom", "x-utf-32le-bom" };
+ ht[1015] = new Object[] { "utf_32", "utf-32" };
+ }
+
+ }
+
+ private static final class Classes
+ extends sun.util.PreHashedMap<String>
+ {
+
+ private static final int ROWS = 32;
+ private static final int SIZE = 38;
+ private static final int SHIFT = 1;
+ private static final int MASK = 0x1f;
+
+ private Classes() {
+ super(ROWS, SIZE, SHIFT, MASK);
+ }
+
+ protected void init(Object[] ht) {
+ ht[0] = new Object[] { "ibm862", "IBM862" };
+ ht[2] = new Object[] { "ibm866", "IBM866",
+ new Object[] { "utf-32", "UTF_32",
+ new Object[] { "utf-16le", "UTF_16LE" } } };
+ ht[3] = new Object[] { "windows-1251", "MS1251",
+ new Object[] { "windows-1250", "MS1250" } };
+ ht[4] = new Object[] { "windows-1253", "MS1253",
+ new Object[] { "windows-1252", "MS1252",
+ new Object[] { "utf-32be", "UTF_32BE" } } };
+ ht[5] = new Object[] { "windows-1254", "MS1254",
+ new Object[] { "utf-16", "UTF_16" } };
+ ht[6] = new Object[] { "windows-1257", "MS1257" };
+ ht[7] = new Object[] { "utf-16be", "UTF_16BE" };
+ ht[8] = new Object[] { "iso-8859-2", "ISO_8859_2",
+ new Object[] { "iso-8859-1", "ISO_8859_1" } };
+ ht[9] = new Object[] { "iso-8859-4", "ISO_8859_4",
+ new Object[] { "utf-8", "UTF_8" } };
+ ht[10] = new Object[] { "iso-8859-5", "ISO_8859_5" };
+ ht[11] = new Object[] { "x-ibm874", "IBM874",
+ new Object[] { "iso-8859-7", "ISO_8859_7" } };
+ ht[12] = new Object[] { "iso-8859-9", "ISO_8859_9" };
+ ht[14] = new Object[] { "x-ibm737", "IBM737" };
+ ht[15] = new Object[] { "ibm850", "IBM850" };
+ ht[16] = new Object[] { "ibm852", "IBM852",
+ new Object[] { "ibm775", "IBM775" } };
+ ht[17] = new Object[] { "iso-8859-13", "ISO_8859_13",
+ new Object[] { "us-ascii", "US_ASCII" } };
+ ht[18] = new Object[] { "ibm855", "IBM855",
+ new Object[] { "ibm437", "IBM437",
+ new Object[] { "iso-8859-15", "ISO_8859_15" } } };
+ ht[19] = new Object[] { "ibm00858", "IBM858",
+ new Object[] { "ibm857", "IBM857",
+ new Object[] { "x-utf-32le-bom", "UTF_32LE_BOM" } } };
+ ht[22] = new Object[] { "x-utf-16le-bom", "UTF_16LE_BOM" };
+ ht[24] = new Object[] { "x-utf-32be-bom", "UTF_32BE_BOM" };
+ ht[28] = new Object[] { "koi8-r", "KOI8_R" };
+ ht[29] = new Object[] { "koi8-u", "KOI8_U" };
+ ht[31] = new Object[] { "utf-32le", "UTF_32LE" };
+ }
+
+ }
+
+ private static final class Cache
+ extends sun.util.PreHashedMap<Charset>
+ {
+
+ private static final int ROWS = 32;
+ private static final int SIZE = 38;
+ private static final int SHIFT = 1;
+ private static final int MASK = 0x1f;
+
+ private Cache() {
+ super(ROWS, SIZE, SHIFT, MASK);
+ }
+
+ protected void init(Object[] ht) {
+ ht[0] = new Object[] { "ibm862", null };
+ ht[2] = new Object[] { "ibm866", null,
+ new Object[] { "utf-32", null,
+ new Object[] { "utf-16le", null } } };
+ ht[3] = new Object[] { "windows-1251", null,
+ new Object[] { "windows-1250", null } };
+ ht[4] = new Object[] { "windows-1253", null,
+ new Object[] { "windows-1252", null,
+ new Object[] { "utf-32be", null } } };
+ ht[5] = new Object[] { "windows-1254", null,
+ new Object[] { "utf-16", null } };
+ ht[6] = new Object[] { "windows-1257", null };
+ ht[7] = new Object[] { "utf-16be", null };
+ ht[8] = new Object[] { "iso-8859-2", null,
+ new Object[] { "iso-8859-1", null } };
+ ht[9] = new Object[] { "iso-8859-4", null,
+ new Object[] { "utf-8", null } };
+ ht[10] = new Object[] { "iso-8859-5", null };
+ ht[11] = new Object[] { "x-ibm874", null,
+ new Object[] { "iso-8859-7", null } };
+ ht[12] = new Object[] { "iso-8859-9", null };
+ ht[14] = new Object[] { "x-ibm737", null };
+ ht[15] = new Object[] { "ibm850", null };
+ ht[16] = new Object[] { "ibm852", null,
+ new Object[] { "ibm775", null } };
+ ht[17] = new Object[] { "iso-8859-13", null,
+ new Object[] { "us-ascii", null } };
+ ht[18] = new Object[] { "ibm855", null,
+ new Object[] { "ibm437", null,
+ new Object[] { "iso-8859-15", null } } };
+ ht[19] = new Object[] { "ibm00858", null,
+ new Object[] { "ibm857", null,
+ new Object[] { "x-utf-32le-bom", null } } };
+ ht[22] = new Object[] { "x-utf-16le-bom", null };
+ ht[24] = new Object[] { "x-utf-32be-bom", null };
+ ht[28] = new Object[] { "koi8-r", null };
+ ht[29] = new Object[] { "koi8-u", null };
+ ht[31] = new Object[] { "utf-32le", null };
+ }
+
+ }
+
+ public StandardCharsets() {
+ super("sun.nio.cs", new Aliases(), new Classes(), new Cache());
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2007-06-17 02:56:21
|
Revision: 3262
http://jnode.svn.sourceforge.net/jnode/?rev=3262&view=rev
Author: fduminy
Date: 2007-06-16 19:56:18 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
temporary fix : disabled reference to inexistent icedtea directory
Modified Paths:
--------------
trunk/core/build.xml
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-06-16 20:45:21 UTC (rev 3261)
+++ trunk/core/build.xml 2007-06-17 02:56:18 UTC (rev 3262)
@@ -40,7 +40,7 @@
<pathelement location="${my-src.dir}/vmmagic"/>
<pathelement location="${my-src.dir}/mmtk-vm"/>
<pathelement location="${my-src.dir}/driver"/>
- <pathelement location="${my-src.dir}/icedtea"/>
+<!-- <pathelement location="${my-src.dir}/icedtea"/> -->
<pathelement location="${my-src.dir}/test"/>
</path>
<path id="my-sources">
@@ -137,7 +137,7 @@
<fileset dir="${my-src.dir}/openjdk/com" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/openjdk/sun" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/openjdk/vm" excludes="${my-non-resources}"/>
- <fileset dir="${my-src.dir}/icedtea" excludes="${my-non-resources}"/>
+<!-- <fileset dir="${my-src.dir}/icedtea" excludes="${my-non-resources}"/> -->
<fileset dir="${my-src.dir}/core" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/nanoxml" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/vmmagic" excludes="${my-non-resources}"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-16 20:45:31
|
Revision: 3261
http://jnode.svn.sourceforge.net/jnode/?rev=3261&view=rev
Author: lsantha
Date: 2007-06-16 13:45:21 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Added icedtea sourcetree.
Modified Paths:
--------------
trunk/core/build.xml
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-06-16 20:39:39 UTC (rev 3260)
+++ trunk/core/build.xml 2007-06-16 20:45:21 UTC (rev 3261)
@@ -40,6 +40,7 @@
<pathelement location="${my-src.dir}/vmmagic"/>
<pathelement location="${my-src.dir}/mmtk-vm"/>
<pathelement location="${my-src.dir}/driver"/>
+ <pathelement location="${my-src.dir}/icedtea"/>
<pathelement location="${my-src.dir}/test"/>
</path>
<path id="my-sources">
@@ -136,6 +137,7 @@
<fileset dir="${my-src.dir}/openjdk/com" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/openjdk/sun" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/openjdk/vm" excludes="${my-non-resources}"/>
+ <fileset dir="${my-src.dir}/icedtea" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/core" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/nanoxml" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/vmmagic" excludes="${my-non-resources}"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-16 20:39:44
|
Revision: 3260
http://jnode.svn.sourceforge.net/jnode/?rev=3260&view=rev
Author: lsantha
Date: 2007-06-16 13:39:39 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/vm/java/io/
trunk/core/src/openjdk/vm/java/io/NativeConsole.java
Added: trunk/core/src/openjdk/vm/java/io/NativeConsole.java
===================================================================
--- trunk/core/src/openjdk/vm/java/io/NativeConsole.java (rev 0)
+++ trunk/core/src/openjdk/vm/java/io/NativeConsole.java 2007-06-16 20:39:39 UTC (rev 3260)
@@ -0,0 +1,22 @@
+/*
+ * $Id$
+ */
+package java.io;
+
+/**
+ * @author Levente S\xE1ntha
+ */
+class NativeConsole {
+ private static String encoding(){
+ //todo implement it
+ return null;
+ }
+ private static boolean echo(boolean on) throws IOException{
+ //todo implement it
+ return true;
+ }
+ private static boolean istty(){
+ //todo implement it
+ return true;
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-16 20:37:34
|
Revision: 3259
http://jnode.svn.sourceforge.net/jnode/?rev=3259&view=rev
Author: lsantha
Date: 2007-06-16 13:37:32 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/vm/sun/misc/
trunk/core/src/openjdk/vm/sun/misc/NativeUnsafe.java
Added: trunk/core/src/openjdk/vm/sun/misc/NativeUnsafe.java
===================================================================
--- trunk/core/src/openjdk/vm/sun/misc/NativeUnsafe.java (rev 0)
+++ trunk/core/src/openjdk/vm/sun/misc/NativeUnsafe.java 2007-06-16 20:37:32 UTC (rev 3259)
@@ -0,0 +1,352 @@
+/*
+ * $Id$
+ */
+package sun.misc;
+
+import java.lang.reflect.Field;
+import java.security.ProtectionDomain;
+
+/**
+ * @author Levente S\xE1ntha
+ */
+class NativeUnsafe {
+ static void registerNatives() {
+ }
+
+ public static int getInt(Unsafe instance, Object o, long offset) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putInt(Unsafe instance, Object o, long offset, int x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static Object getObject(Unsafe instance, Object o, long offset) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putObject(Unsafe instance, Object o, long offset, Object x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static boolean getBoolean(Unsafe instance, Object o, long offset) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putBoolean(Unsafe instance, Object o, long offset, boolean x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static byte getByte(Unsafe instance, Object o, long offset) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putByte(Unsafe instance, Object o, long offset, byte x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static short getShort(Unsafe instance, Object o, long offset) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putShort(Unsafe instance, Object o, long offset, short x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static char getChar(Unsafe instance, Object o, long offset) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putChar(Unsafe instance, Object o, long offset, char x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static long getLong(Unsafe instance, Object o, long offset) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putLong(Unsafe instance, Object o, long offset, long x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static float getFloat(Unsafe instance, Object o, long offset) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putFloat(Unsafe instance, Object o, long offset, float x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static double getDouble(Unsafe instance, Object o, long offset) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putDouble(Unsafe instance, Object o, long offset, double x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static byte getByte(Unsafe instance, long address) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putByte(Unsafe instance, long address, byte x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static short getShort(Unsafe instance, long address) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putShort(Unsafe instance, long address, short x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static char getChar(Unsafe instance, long address) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putChar(Unsafe instance, long address, char x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static int getInt(Unsafe instance, long address) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putInt(Unsafe instance, long address, int x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static long getLong(Unsafe instance, long address) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putLong(Unsafe instance, long address, long x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static float getFloat(Unsafe instance, long address) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putFloat(Unsafe instance, long address, float x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static double getDouble(Unsafe instance, long address) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putDouble(Unsafe instance, long address, double x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static long getAddress(Unsafe instance, long address) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putAddress(Unsafe instance, long address, long x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static long allocateMemory(Unsafe instance, long bytes) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static long reallocateMemory(Unsafe instance, long address, long bytes) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void setMemory(Unsafe instance, long address, long bytes, byte value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void copyMemory(Unsafe instance, long srcAddress, long destAddress,
+ long bytes) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void freeMemory(Unsafe instance, long address) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static long staticFieldOffset(Unsafe instance, Field f) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static long objectFieldOffset(Unsafe instance, Field f) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static Object staticFieldBase(Unsafe instance, Field f) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void ensureClassInitialized(Unsafe instance, Class c) {
+ c.getVmClass().initialize();
+ }
+
+ public static int arrayBaseOffset(Unsafe instance, Class arrayClass) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static int arrayIndexScale(Unsafe instance, Class arrayClass) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static int addressSize(Unsafe instance) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static int pageSize(Unsafe instance) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ public static Class defineClass(Unsafe instance, String name, byte[] b, int off, int len,
+ ClassLoader loader,
+ ProtectionDomain protectionDomain) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static Class defineClass(Unsafe instance, String name, byte[] b, int off, int len) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static Object allocateInstance(Unsafe instance, Class cls)
+ throws InstantiationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void monitorEnter(Unsafe instance, Object o) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void monitorExit(Unsafe instance, Object o) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static boolean tryMonitorEnter(Unsafe instance, Object o) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ public static void throwException(Unsafe instance, Throwable ee) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ public static final boolean compareAndSwapObject(Unsafe instance, Object o, long offset,
+ Object expected,
+ Object x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static final boolean compareAndSwapInt(Unsafe instance, Object o, long offset,
+ int expected,
+ int x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static final boolean compareAndSwapLong(Unsafe instance, Object o, long offset,
+ long expected,
+ long x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static Object getObjectVolatile(Unsafe instance, Object o, long offset) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putObjectVolatile(Unsafe instance, Object o, long offset, Object x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static int getIntVolatile(Unsafe instance, Object o, long offset) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putIntVolatile(Unsafe instance, Object o, long offset, int x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static boolean getBooleanVolatile(Unsafe instance, Object o, long offset) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putBooleanVolatile(Unsafe instance, Object o, long offset, boolean x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static byte getByteVolatile(Unsafe instance, Object o, long offset) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putByteVolatile(Unsafe instance, Object o, long offset, byte x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static short getShortVolatile(Unsafe instance, Object o, long offset) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putShortVolatile(Unsafe instance, Object o, long offset, short x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static char getCharVolatile(Unsafe instance, Object o, long offset) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putCharVolatile(Unsafe instance, Object o, long offset, char x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static long getLongVolatile(Unsafe instance, Object o, long offset) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putLongVolatile(Unsafe instance, Object o, long offset, long x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static float getFloatVolatile(Unsafe instance, Object o, long offset) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putFloatVolatile(Unsafe instance, Object o, long offset, float x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static double getDoubleVolatile(Unsafe instance, Object o, long offset) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putDoubleVolatile(Unsafe instance, Object o, long offset, double x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putOrderedObject(Unsafe instance, Object o, long offset, Object x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putOrderedInt(Unsafe instance, Object o, long offset, int x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void putOrderedLong(Unsafe instance, Object o, long offset, long x) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void unpark(Unsafe instance, Object thread) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void park(Unsafe instance, boolean isAbsolute, long time) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static int getLoadAverage(Unsafe instance, double[] loadavg, int nelems) {
+ throw new UnsupportedOperationException();
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-16 20:36:46
|
Revision: 3258
http://jnode.svn.sourceforge.net/jnode/?rev=3258&view=rev
Author: lsantha
Date: 2007-06-16 13:36:43 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/sun/sun/misc/Unsafe.java
Added: trunk/core/src/openjdk/sun/sun/misc/Unsafe.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/misc/Unsafe.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/misc/Unsafe.java 2007-06-16 20:36:43 UTC (rev 3258)
@@ -0,0 +1,862 @@
+/*
+ * Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.misc;
+
+import java.security.*;
+import java.lang.reflect.*;
+
+
+/**
+ * A collection of methods for performing low-level, unsafe operations.
+ * Although the class and all methods are public, use of this class is
+ * limited because only trusted code can obtain instances of it.
+ *
+ * @author John R. Rose
+ * @version 1.27, 07/05/05
+ * @see #getUnsafe
+ */
+
+public final class Unsafe {
+
+ private static native void registerNatives();
+ static {
+ registerNatives();
+ sun.reflect.Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe");
+ }
+
+ private Unsafe() {}
+
+ private static final Unsafe theUnsafe = new Unsafe();
+
+ /**
+ * Provides the caller with the capability of performing unsafe
+ * operations.
+ *
+ * <p> The returned <code>Unsafe</code> object should be carefully guarded
+ * by the caller, since it can be used to read and write data at arbitrary
+ * memory addresses. It must never be passed to untrusted code.
+ *
+ * <p> Most methods in this class are very low-level, and correspond to a
+ * small number of hardware instructions (on typical machines). Compilers
+ * are encouraged to optimize these methods accordingly.
+ *
+ * <p> Here is a suggested idiom for using unsafe operations:
+ *
+ * <blockquote><pre>
+ * class MyTrustedClass {
+ * private static final Unsafe unsafe = Unsafe.getUnsafe();
+ * ...
+ * private long myCountAddress = ...;
+ * public int getCount() { return unsafe.getByte(myCountAddress); }
+ * }
+ * </pre></blockquote>
+ *
+ * (It may assist compilers to make the local variable be
+ * <code>final</code>.)
+ *
+ * @exception SecurityException if a security manager exists and its
+ * <code>checkPropertiesAccess</code> method doesn't allow
+ * access to the system properties.
+ */
+ public static Unsafe getUnsafe() {
+ Class cc = sun.reflect.Reflection.getCallerClass(2);
+ if (cc.getClassLoader() != null)
+ throw new SecurityException("Unsafe");
+ return theUnsafe;
+ }
+
+ /// peek and poke operations
+ /// (compilers should optimize these to memory ops)
+
+ // These work on object fields in the Java heap.
+ // They will not work on elements of packed arrays.
+
+ /**
+ * Fetches a value from a given Java variable.
+ * More specifically, fetches a field or array element within the given
+ * object <code>o</code> at the given offset, or (if <code>o</code> is
+ * null) from the memory address whose numerical value is the given
+ * offset.
+ * <p>
+ * The results are undefined unless one of the following cases is true:
+ * <ul>
+ * <li>The offset was obtained from {@link #objectFieldOffset} on
+ * the {@link java.lang.reflect.Field} of some Java field and the object
+ * referred to by <code>o</code> is of a class compatible with that
+ * field's class.
+ *
+ * <li>The offset and object reference <code>o</code> (either null or
+ * non-null) were both obtained via {@link #staticFieldOffset}
+ * and {@link #staticFieldBase} (respectively) from the
+ * reflective {@link Field} representation of some Java field.
+ *
+ * <li>The object referred to by <code>o</code> is an array, and the offset
+ * is an integer of the form <code>B+N*S</code>, where <code>N</code> is
+ * a valid index into the array, and <code>B</code> and <code>S</code> are
+ * the values obtained by {@link #arrayBaseOffset} and {@link
+ * #arrayIndexScale} (respectively) from the array's class. The value
+ * referred to is the <code>N</code><em>th</em> element of the array.
+ *
+ * </ul>
+ * <p>
+ * If one of the above cases is true, the call references a specific Java
+ * variable (field or array element). However, the results are undefined
+ * if that variable is not in fact of the type returned by this method.
+ * <p>
+ * This method refers to a variable by means of two parameters, and so
+ * it provides (in effect) a <em>double-register</em> addressing mode
+ * for Java variables. When the object reference is null, this method
+ * uses its offset as an absolute address. This is similar in operation
+ * to methods such as {@link #getInt(long)}, which provide (in effect) a
+ * <em>single-register</em> addressing mode for non-Java variables.
+ * However, because Java variables may have a different layout in memory
+ * from non-Java variables, programmers should not assume that these
+ * two addressing modes are ever equivalent. Also, programmers should
+ * remember that offsets from the double-register addressing mode cannot
+ * be portably confused with longs used in the single-register addressing
+ * mode.
+ *
+ * @param o Java heap object in which the variable resides, if any, else
+ * null
+ * @param offset indication of where the variable resides in a Java heap
+ * object, if any, else a memory address locating the variable
+ * statically
+ * @return the value fetched from the indicated Java variable
+ * @throws RuntimeException No defined exceptions are thrown, not even
+ * {@link NullPointerException}
+ */
+ public native int getInt(Object o, long offset);
+
+ /**
+ * Stores a value into a given Java variable.
+ * <p>
+ * The first two parameters are interpreted exactly as with
+ * {@link #getInt(Object, long)} to refer to a specific
+ * Java variable (field or array element). The given value
+ * is stored into that variable.
+ * <p>
+ * The variable must be of the same type as the method
+ * parameter <code>x</code>.
+ *
+ * @param o Java heap object in which the variable resides, if any, else
+ * null
+ * @param offset indication of where the variable resides in a Java heap
+ * object, if any, else a memory address locating the variable
+ * statically
+ * @param x the value to store into the indicated Java variable
+ * @throws RuntimeException No defined exceptions are thrown, not even
+ * {@link NullPointerException}
+ */
+ public native void putInt(Object o, long offset, int x);
+
+ /**
+ * Fetches a reference value from a given Java variable.
+ * @see #getInt(Object, long)
+ */
+ public native Object getObject(Object o, long offset);
+
+ /**
+ * Stores a reference value into a given Java variable.
+ * <p>
+ * Unless the reference <code>x</code> being stored is either null
+ * or matches the field type, the results are undefined.
+ * If the reference <code>o</code> is non-null, car marks or
+ * other store barriers for that object (if the VM requires them)
+ * are updated.
+ * @see #putInt(Object, int, int)
+ */
+ public native void putObject(Object o, long offset, Object x);
+
+ /** @see #getInt(Object, long) */
+ public native boolean getBoolean(Object o, long offset);
+ /** @see #putInt(Object, int, int) */
+ public native void putBoolean(Object o, long offset, boolean x);
+ /** @see #getInt(Object, long) */
+ public native byte getByte(Object o, long offset);
+ /** @see #putInt(Object, int, int) */
+ public native void putByte(Object o, long offset, byte x);
+ /** @see #getInt(Object, long) */
+ public native short getShort(Object o, long offset);
+ /** @see #putInt(Object, int, int) */
+ public native void putShort(Object o, long offset, short x);
+ /** @see #getInt(Object, long) */
+ public native char getChar(Object o, long offset);
+ /** @see #putInt(Object, int, int) */
+ public native void putChar(Object o, long offset, char x);
+ /** @see #getInt(Object, long) */
+ public native long getLong(Object o, long offset);
+ /** @see #putInt(Object, int, int) */
+ public native void putLong(Object o, long offset, long x);
+ /** @see #getInt(Object, long) */
+ public native float getFloat(Object o, long offset);
+ /** @see #putInt(Object, int, int) */
+ public native void putFloat(Object o, long offset, float x);
+ /** @see #getInt(Object, long) */
+ public native double getDouble(Object o, long offset);
+ /** @see #putInt(Object, int, int) */
+ public native void putDouble(Object o, long offset, double x);
+
+ /**
+ * This method, like all others with 32-bit offsets, was native
+ * in a previous release but is now a wrapper which simply casts
+ * the offset to a long value. It provides backward compatibility
+ * with bytecodes compiled against 1.4.
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public int getInt(Object o, int offset) {
+ return getInt(o, (long)offset);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public void putInt(Object o, int offset, int x) {
+ putInt(o, (long)offset, x);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public Object getObject(Object o, int offset) {
+ return getObject(o, (long)offset);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public void putObject(Object o, int offset, Object x) {
+ putObject(o, (long)offset, x);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public boolean getBoolean(Object o, int offset) {
+ return getBoolean(o, (long)offset);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public void putBoolean(Object o, int offset, boolean x) {
+ putBoolean(o, (long)offset, x);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public byte getByte(Object o, int offset) {
+ return getByte(o, (long)offset);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public void putByte(Object o, int offset, byte x) {
+ putByte(o, (long)offset, x);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public short getShort(Object o, int offset) {
+ return getShort(o, (long)offset);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public void putShort(Object o, int offset, short x) {
+ putShort(o, (long)offset, x);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public char getChar(Object o, int offset) {
+ return getChar(o, (long)offset);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public void putChar(Object o, int offset, char x) {
+ putChar(o, (long)offset, x);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public long getLong(Object o, int offset) {
+ return getLong(o, (long)offset);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public void putLong(Object o, int offset, long x) {
+ putLong(o, (long)offset, x);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public float getFloat(Object o, int offset) {
+ return getFloat(o, (long)offset);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public void putFloat(Object o, int offset, float x) {
+ putFloat(o, (long)offset, x);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public double getDouble(Object o, int offset) {
+ return getDouble(o, (long)offset);
+ }
+
+ /**
+ * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
+ * See {@link #staticFieldOffset}.
+ */
+ @Deprecated
+ public void putDouble(Object o, int offset, double x) {
+ putDouble(o, (long)offset, x);
+ }
+
+ // These work on values in the C heap.
+
+ /**
+ * Fetches a value from a given memory address. If the address is zero, or
+ * does not point into a block obtained from {@link #allocateMemory}, the
+ * results are undefined.
+ *
+ * @see #allocateMemory
+ */
+ public native byte getByte(long address);
+
+ /**
+ * Stores a value into a given memory address. If the address is zero, or
+ * does not point into a block obtained from {@link #allocateMemory}, the
+ * results are undefined.
+ *
+ * @see #getByte(long)
+ */
+ public native void putByte(long address, byte x);
+
+ /** @see #getByte(long) */
+ public native short getShort(long address);
+ /** @see #putByte(long, byte) */
+ public native void putShort(long address, short x);
+ /** @see #getByte(long) */
+ public native char getChar(long address);
+ /** @see #putByte(long, byte) */
+ public native void putChar(long address, char x);
+ /** @see #getByte(long) */
+ public native int getInt(long address);
+ /** @see #putByte(long, byte) */
+ public native void putInt(long address, int x);
+ /** @see #getByte(long) */
+ public native long getLong(long address);
+ /** @see #putByte(long, byte) */
+ public native void putLong(long address, long x);
+ /** @see #getByte(long) */
+ public native float getFloat(long address);
+ /** @see #putByte(long, byte) */
+ public native void putFloat(long address, float x);
+ /** @see #getByte(long) */
+ public native double getDouble(long address);
+ /** @see #putByte(long, byte) */
+ public native void putDouble(long address, double x);
+
+ /**
+ * Fetches a native pointer from a given memory address. If the address is
+ * zero, or does not point into a block obtained from {@link
+ * #allocateMemory}, the results are undefined.
+ *
+ * <p> If the native pointer is less than 64 bits wide, it is extended as
+ * an unsigned number to a Java long. The pointer may be indexed by any
+ * given byte offset, simply by adding that offset (as a simple integer) to
+ * the long representing the pointer. The number of bytes actually read
+ * from the target address maybe determined by consulting {@link
+ * #addressSize}.
+ *
+ * @see #allocateMemory
+ */
+ public native long getAddress(long address);
+
+ /**
+ * Stores a native pointer into a given memory address. If the address is
+ * zero, or does not point into a block obtained from {@link
+ * #allocateMemory}, the results are undefined.
+ *
+ * <p> The number of bytes actually written at the target address maybe
+ * determined by consulting {@link #addressSize}.
+ *
+ * @see #getAddress(long)
+ */
+ public native void putAddress(long address, long x);
+
+ /// wrappers for malloc, realloc, free:
+
+ /**
+ * Allocates a new block of native memory, of the given size in bytes. The
+ * contents of the memory are uninitialized; they will generally be
+ * garbage. The resulting native pointer will never be zero, and will be
+ * aligned for all value types. Dispose of this memory by calling {@link
+ * #freeMemory}, or resize it with {@link #reallocateMemory}.
+ *
+ * @throws IllegalArgumentException if the size is negative or too large
+ * for the native size_t type
+ *
+ * @throws OutOfMemoryError if the allocation is refused by the system
+ *
+ * @see #getByte(long)
+ * @see #putByte(long, byte)
+ */
+ public native long allocateMemory(long bytes);
+
+ /**
+ * Resizes a new block of native memory, to the given size in bytes. The
+ * contents of the new block past the size of the old block are
+ * uninitialized; they will generally be garbage. The resulting native
+ * pointer will be zero if and only if the requested size is zero. The
+ * resulting native pointer will be aligned for all value types. Dispose
+ * of this memory by calling {@link #freeMemory}, or resize it with {@link
+ * #reallocateMemory}. The address passed to this method may be null, in
+ * which case an allocation will be performed.
+ *
+ * @throws IllegalArgumentException if the size is negative or too large
+ * for the native size_t type
+ *
+ * @throws OutOfMemoryError if the allocation is refused by the system
+ *
+ * @see #allocateMemory
+ */
+ public native long reallocateMemory(long address, long bytes);
+
+ /**
+ * Sets all bytes in a given block of memory to a fixed value
+ * (usually zero).
+ */
+ public native void setMemory(long address, long bytes, byte value);
+
+ /**
+ * Sets all bytes in a given block of memory to a copy of another
+ * block.
+ */
+ public native void copyMemory(long srcAddress, long destAddress,
+ long bytes);
+
+ /**
+ * Disposes of a block of native memory, as obtained from {@link
+ * #allocateMemory} or {@link #reallocateMemory}. The address passed to
+ * this method may be null, in which case no action is taken.
+ *
+ * @see #allocateMemory
+ */
+ public native void freeMemory(long address);
+
+ /// random queries
+
+ /**
+ * This constant differs from all results that will ever be returned from
+ * {@link #staticFieldOffset}, {@link #objectFieldOffset},
+ * or {@link #arrayBaseOffset}.
+ */
+ public static final int INVALID_FIELD_OFFSET = -1;
+
+ /**
+ * Returns the offset of a field, truncated to 32 bits.
+ * This method is implemented as follows:
+ * <blockquote><pre>
+ * public int fieldOffset(Field f) {
+ * if (Modifier.isStatic(f.getModifiers()))
+ * return (int) staticFieldOffset(f);
+ * else
+ * return (int) objectFieldOffset(f);
+ * }
+ * </pre></blockquote>
+ * @deprecated As of 1.4.1, use {@link #staticFieldOffset} for static
+ * fields and {@link #objectFieldOffset} for non-static fields.
+ */
+ @Deprecated
+ public int fieldOffset(Field f) {
+ if (Modifier.isStatic(f.getModifiers()))
+ return (int) staticFieldOffset(f);
+ else
+ return (int) objectFieldOffset(f);
+ }
+
+ /**
+ * Returns the base address for accessing some static field
+ * in the given class. This method is implemented as follows:
+ * <blockquote><pre>
+ * public Object staticFieldBase(Class c) {
+ * Field[] fields = c.getDeclaredFields();
+ * for (int i = 0; i < fields.length; i++) {
+ * if (Modifier.isStatic(fields[i].getModifiers())) {
+ * return staticFieldBase(fields[i]);
+ * }
+ * }
+ * return null;
+ * }
+ * </pre></blockquote>
+ * @deprecated As of 1.4.1, use {@link #staticFieldBase(Field)}
+ * to obtain the base pertaining to a specific {@link Field}.
+ * This method works only for JVMs which store all statics
+ * for a given class in one place.
+ */
+ @Deprecated
+ public Object staticFieldBase(Class c) {
+ Field[] fields = c.getDeclaredFields();
+ for (int i = 0; i < fields.length; i++) {
+ if (Modifier.isStatic(fields[i].getModifiers())) {
+ return staticFieldBase(fields[i]);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Report the location of a given field in the storage allocation of its
+ * class. Do not expect to perform any sort of arithmetic on this offset;
+ * it is just a cookie which is passed to the unsafe heap memory accessors.
+ *
+ * <p>Any given field will always have the same offset and base, and no
+ * two distinct fields of the same class will ever have the same offset
+ * and base.
+ *
+ * <p>As of 1.4.1, offsets for fields are represented as long values,
+ * although the Sun JVM does not use the most significant 32 bits.
+ * However, JVM implementations which store static fields at absolute
+ * addresses can use long offsets and null base pointers to express
+ * the field locations in a form usable by {@link #getInt(Object,long)}.
+ * Therefore, code which will be ported to such JVMs on 64-bit platforms
+ * must preserve all bits of static field offsets.
+ * @see #getInt(Object, long)
+ */
+ public native long staticFieldOffset(Field f);
+
+ /**
+ * Report the location of a given static field, in conjunction with {@link
+ * #staticFieldBase}.
+ * <p>Do not expect to perform any sort of arithmetic on this offset;
+ * it is just a cookie which is passed to the unsafe heap memory accessors.
+ *
+ * <p>Any given field will always have the same offset, and no two distinct
+ * fields of the same class will ever have the same offset.
+ *
+ * <p>As of 1.4.1, offsets for fields are represented as long values,
+ * although the Sun JVM does not use the most significant 32 bits.
+ * It is hard to imagine a JVM technology which needs more than
+ * a few bits to encode an offset within a non-array object,
+ * However, for consistency with other methods in this class,
+ * this method reports its result as a long value.
+ * @see #getInt(Object, long)
+ */
+ public native long objectFieldOffset(Field f);
+
+ /**
+ * Report the location of a given static field, in conjunction with {@link
+ * #staticFieldOffset}.
+ * <p>Fetch the base "Object", if any, with which static fields of the
+ * given class can be accessed via methods like {@link #getInt(Object,
+ * long)}. This value may be null. This value may refer to an object
+ * which is a "cookie", not guaranteed to be a real Object, and it should
+ * not be used in any way except as argument to the get and put routines in
+ * this class.
+ */
+ public native Object staticFieldBase(Field f);
+
+ /**
+ * Ensure the given class has been initialized. This is often
+ * needed in conjunction with obtaining the static field base of a
+ * class.
+ */
+ public native void ensureClassInitialized(Class c);
+
+ /**
+ * Report the offset of the first element in the storage allocation of a
+ * given array class. If {@link #arrayIndexScale} returns a non-zero value
+ * for the same class, you may use that scale factor, together with this
+ * base offset, to form new offsets to access elements of arrays of the
+ * given class.
+ *
+ * @see #getInt(Object, long)
+ * @see #putInt(Object, long, int)
+ */
+ public native int arrayBaseOffset(Class arrayClass);
+
+ /**
+ * Report the scale factor for addressing elements in the storage
+ * allocation of a given array class. However, arrays of "narrow" types
+ * will generally not work properly with accessors like {@link
+ * #getByte(Object, int)}, so the scale factor for such classes is reported
+ * as zero.
+ *
+ * @see #arrayBaseOffset
+ * @see #getInt(Object, long)
+ * @see #putInt(Object, long, int)
+ */
+ public native int arrayIndexScale(Class arrayClass);
+
+ /**
+ * Report the size in bytes of a native pointer, as stored via {@link
+ * #putAddress}. This value will be either 4 or 8. Note that the sizes of
+ * other primitive types (as stored in native memory blocks) is determined
+ * fully by their information content.
+ */
+ public native int addressSize();
+
+ /**
+ * Report the size in bytes of a native memory page (whatever that is).
+ * This value will always be a power of two.
+ */
+ public native int pageSize();
+
+
+ /// random trusted operations from JNI:
+
+ /**
+ * Tell the VM to define a class, without security checks. By default, the
+ * class loader and protection domain come from the caller's class.
+ */
+ public native Class defineClass(String name, byte[] b, int off, int len,
+ ClassLoader loader,
+ ProtectionDomain protectionDomain);
+
+ public native Class defineClass(String name, byte[] b, int off, int len);
+
+ /** Allocate an instance but do not run any constructor.
+ Initializes the class if it has not yet been. */
+ public native Object allocateInstance(Class cls)
+ throws InstantiationException;
+
+ /** Lock the object. It must get unlocked via {@link #monitorExit}. */
+ public native void monitorEnter(Object o);
+
+ /**
+ * Unlock the object. It must have been locked via {@link
+ * #monitorEnter}.
+ */
+ public native void monitorExit(Object o);
+
+ /**
+ * Tries to lock the object. Returns true or false to indicate
+ * whether the lock succeeded. If it did, the object must be
+ * unlocked via {@link #monitorExit}.
+ */
+ public native boolean tryMonitorEnter(Object o);
+
+ /** Throw the exception without telling the verifier. */
+ public native void throwException(Throwable ee);
+
+
+ /**
+ * Atomically update Java variable to <tt>x</tt> if it is currently
+ * holding <tt>expected</tt>.
+ * @return <tt>true</tt> if successful
+ */
+ public final native boolean compareAndSwapObject(Object o, long offset,
+ Object expected,
+ Object x);
+
+ /**
+ * Atomically update Java variable to <tt>x</tt> if it is currently
+ * holding <tt>expected</tt>.
+ * @return <tt>true</tt> if successful
+ */
+ public final native boolean compareAndSwapInt(Object o, long offset,
+ int expected,
+ int x);
+
+ /**
+ * Atomically update Java variable to <tt>x</tt> if it is currently
+ * holding <tt>expected</tt>.
+ * @return <tt>true</tt> if successful
+ */
+ public final native boolean compareAndSwapLong(Object o, long offset,
+ long expected,
+ long x);
+
+ /**
+ * Fetches a reference value from a given Java variable, with volatile
+ * load semantics. Otherwise identical to {@link #getObject(Object, long)}
+ */
+ public native Object getObjectVolatile(Object o, long offset);
+
+ /**
+ * Stores a reference value into a given Java variable, with
+ * volatile store semantics. Otherwise identical to {@link #putObject(Object, long, Object)}
+ */
+ public native void putObjectVolatile(Object o, long offset, Object x);
+
+ /** Volatile version of {@link #getInt(Object, long)} */
+ public native int getIntVolatile(Object o, long offset);
+
+ /** Volatile version of {@link #putInt(Object, long, int)} */
+ public native void putIntVolatile(Object o, long offset, int x);
+
+ /** Volatile version of {@link #getBoolean(Object, long)} */
+ public native boolean getBooleanVolatile(Object o, long offset);
+
+ /** Volatile version of {@link #putBoolean(Object, long, boolean)} */
+ public native void putBooleanVolatile(Object o, long offset, boolean x);
+
+ /** Volatile version of {@link #getByte(Object, long)} */
+ public native byte getByteVolatile(Object o, long offset);
+
+ /** Volatile version of {@link #putByte(Object, long, byte)} */
+ public native void putByteVolatile(Object o, long offset, byte x);
+
+ /** Volatile version of {@link #getShort(Object, long)} */
+ public native short getShortVolatile(Object o, long offset);
+
+ /** Volatile version of {@link #putShort(Object, long, short)} */
+ public native void putShortVolatile(Object o, long offset, short x);
+
+ /** Volatile version of {@link #getChar(Object, long)} */
+ public native char getCharVolatile(Object o, long offset);
+
+ /** Volatile version of {@link #putChar(Object, long, char)} */
+ public native void putCharVolatile(Object o, long offset, char x);
+
+ /** Volatile version of {@link #getLong(Object, long)} */
+ public native long getLongVolatile(Object o, long offset);
+
+ /** Volatile version of {@link #putLong(Object, long, long)} */
+ public native void putLongVolatile(Object o, long offset, long x);
+
+ /** Volatile version of {@link #getFloat(Object, long)} */
+ public native float getFloatVolatile(Object o, long offset);
+
+ /** Volatile version of {@link #putFloat(Object, long, float)} */
+ public native void putFloatVolatile(Object o, long offset, float x);
+
+ /** Volatile version of {@link #getDouble(Object, long)} */
+ public native double getDoubleVolatile(Object o, long offset);
+
+ /** Volatile version of {@link #putDouble(Object, long, double)} */
+ public native void putDoubleVolatile(Object o, long offset, double x);
+
+ /**
+ * Version of {@link #putObjectVolatile(Object, long, Object)}
+ * that does not guarantee immediate visibility of the store to
+ * other threads. This method is generally only useful if the
+ * underlying field is a Java volatile (or if an array cell, one
+ * that is otherwise only accessed using volatile accesses).
+ */
+ public native void putOrderedObject(Object o, long offset, Object x);
+
+ /** Ordered/Lazy version of {@link #putIntVolatile(Object, long, int)} */
+ public native void putOrderedInt(Object o, long offset, int x);
+
+ /** Ordered/Lazy version of {@link #putLongVolatile(Object, long, long)} */
+ public native void putOrderedLong(Object o, long offset, long x);
+
+ /**
+ * Unblock the given thread blocked on <tt>park</tt>, or, if it is
+ * not blocked, cause the subsequent call to <tt>park</tt> not to
+ * block. Note: this operation is "unsafe" solely because the
+ * caller must somehow ensure that the thread has not been
+ * destroyed. Nothing special is usually required to ensure this
+ * when called from Java (in which there will ordinarily be a live
+ * reference to the thread) but this is not nearly-automatically
+ * so when calling from native code.
+ * @param thread the thread to unpark.
+ *
+ */
+ public native void unpark(Object thread);
+
+ /**
+ * Block current thread, returning when a balancing
+ * <tt>unpark</tt> occurs, or a balancing <tt>unpark</tt> has
+ * already occurred, or the thread is interrupted, or, if not
+ * absolute and time is not zero, the given time nanoseconds have
+ * elapsed, or if absolute, the given deadline in milliseconds
+ * since Epoch has passed, or spuriously (i.e., returning for no
+ * "reason"). Note: This operation is in the Unsafe class only
+ * because <tt>unpark</tt> is, so it would be strange to place it
+ * elsewhere.
+ */
+ public native void park(boolean isAbsolute, long time);
+
+ /**
+ * Gets the load average in the system run queue assigned
+ * to the available processors averaged over various periods of time.
+ * This method retrieves the given <tt>nelem</tt> samples and
+ * assigns to the elements of the given <tt>loadavg</tt> array.
+ * The system imposes a maximum of 3 samples, representing
+ * averages over the last 1, 5, and 15 minutes, respectively.
+ *
+ * @params loadavg an array of double of size nelems
+ * @params nelems the number of samples to be retrieved and
+ * must be 1 to 3.
+ *
+ * @return the number of samples actually retrieved; or -1
+ * if the load average is unobtainable.
+ */
+ public native int getLoadAverage(double[] loadavg, int nelems);
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-16 20:36:10
|
Revision: 3257
http://jnode.svn.sourceforge.net/jnode/?rev=3257&view=rev
Author: lsantha
Date: 2007-06-16 13:36:05 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Openjdk integration.
Removed Paths:
-------------
trunk/core/src/classpath/vm/sun/misc/Unsafe.java
Deleted: trunk/core/src/classpath/vm/sun/misc/Unsafe.java
===================================================================
--- trunk/core/src/classpath/vm/sun/misc/Unsafe.java 2007-06-16 20:32:57 UTC (rev 3256)
+++ trunk/core/src/classpath/vm/sun/misc/Unsafe.java 2007-06-16 20:36:05 UTC (rev 3257)
@@ -1,328 +0,0 @@
-/* Unsafe.java - Unsafe operations needed for concurrency
- Copyright (C) 2006 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package sun.misc;
-
-import java.lang.reflect.Field;
-
-/**
- * This class should provide access to low-level operations and its
- * use should be limited to trusted code. Fields can be accessed using
- * memory addresses, with undefined behaviour occurring if invalid memory
- * addresses are given.
- *
- * @author Tom Tromey (tr...@re...)
- * @author Andrew John Hughes (gnu...@me...)
- */
-public class Unsafe
-{
- // Singleton class.
- private static Unsafe unsafe = new Unsafe();
-
- /**
- * Private default constructor to prevent creation of an arbitrary
- * number of instances.
- */
- private Unsafe()
- {
- }
-
- /**
- * Retrieve the singleton instance of <code>Unsafe</code>. The calling
- * method should guard this instance from untrusted code, as it provides
- * access to low-level operations such as direct memory access.
- *
- * @throws SecurityException if a security manager exists and prevents
- * access to the system properties.
- */
- public static Unsafe getUnsafe()
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null)
- sm.checkPropertiesAccess();
- return unsafe;
- }
-
- /**
- * Returns the memory address offset of the given static field.
- * The offset is merely used as a means to access a particular field
- * in the other methods of this class. The value is unique to the given
- * field and the same value should be returned on each subsequent call.
- *
- * @param field the field whose offset should be returned.
- * @return the offset of the given field.
- */
- public native long objectFieldOffset(Field field);
-
- /**
- * Compares the value of the integer field at the specified offset
- * in the supplied object with the given expected value, and updates
- * it if they match. The operation of this method should be atomic,
- * thus providing an uninterruptible way of updating an integer field.
- *
- * @param obj the object containing the field to modify.
- * @param offset the offset of the integer field within <code>obj</code>.
- * @param expect the expected value of the field.
- * @param update the new value of the field if it equals <code>expect</code>.
- * @return true if the field was changed.
- */
- public native boolean compareAndSwapInt(Object obj, long offset,
- int expect, int update);
-
- /**
- * Compares the value of the long field at the specified offset
- * in the supplied object with the given expected value, and updates
- * it if they match. The operation of this method should be atomic,
- * thus providing an uninterruptible way of updating a long field.
- *
- * @param obj the object containing the field to modify.
- * @param offset the offset of the long field within <code>obj</code>.
- * @param expect the expected value of the field.
- * @param update the new value of the field if it equals <code>expect</code>.
- * @return true if the field was changed.
- */
- public native boolean compareAndSwapLong(Object obj, long offset,
- long expect, long update);
-
- /**
- * Compares the value of the object field at the specified offset
- * in the supplied object with the given expected value, and updates
- * it if they match. The operation of this method should be atomic,
- * thus providing an uninterruptible way of updating an object field.
- *
- * @param obj the object containing the field to modify.
- * @param offset the offset of the object field within <code>obj</code>.
- * @param expect the expected value of the field.
- * @param update the new value of the field if it equals <code>expect</code>.
- * @return true if the field was changed.
- */
- public native boolean compareAndSwapObject(Object obj, long offset,
- Object expect, Object update);
-
- /**
- * Sets the value of the integer field at the specified offset in the
- * supplied object to the given value. This is an ordered or lazy
- * version of <code>putIntVolatile(Object,long,int)</code>, which
- * doesn't guarantee the immediate visibility of the change to other
- * threads. It is only really useful where the integer field is
- * <code>volatile</code>, and is thus expected to change unexpectedly.
- *
- * @param obj the object containing the field to modify.
- * @param offset the offset of the integer field within <code>obj</code>.
- * @param value the new value of the field.
- * @see #putIntVolatile(Object,long,int)
- */
- public native void putOrderedInt(Object obj, long offset, int value);
-
- /**
- * Sets the value of the long field at the specified offset in the
- * supplied object to the given value. This is an ordered or lazy
- * version of <code>putLongVolatile(Object,long,long)</code>, which
- * doesn't guarantee the immediate visibility of the change to other
- * threads. It is only really useful where the long field is
- * <code>volatile</code>, and is thus expected to change unexpectedly.
- *
- * @param obj the object containing the field to modify.
- * @param offset the offset of the long field within <code>obj</code>.
- * @param value the new value of the field.
- * @see #putLongVolatile(Object,long,long)
- */
- public native void putOrderedLong(Object obj, long offset, long value);
-
- /**
- * Sets the value of the object field at the specified offset in the
- * supplied object to the given value. This is an ordered or lazy
- * version of <code>putObjectVolatile(Object,long,Object)</code>, which
- * doesn't guarantee the immediate visibility of the change to other
- * threads. It is only really useful where the object field is
- * <code>volatile</code>, and is thus expected to change unexpectedly.
- *
- * @param obj the object containing the field to modify.
- * @param offset the offset of the object field within <code>obj</code>.
- * @param value the new value of the field.
- */
- public native void putOrderedObject(Object obj, long offset, Object value);
-
- /**
- * Sets the value of the integer field at the specified offset in the
- * supplied object to the given value, with volatile store semantics.
- *
- * @param obj the object containing the field to modify.
- * @param offset the offset of the integer field within <code>obj</code>.
- * @param value the new value of the field.
- */
- public native void putIntVolatile(Object obj, long offset, int value);
-
- /**
- * Retrieves the value of the integer field at the specified offset in the
- * supplied object with volatile load semantics.
- *
- * @param obj the object containing the field to read.
- * @param offset the offset of the integer field within <code>obj</code>.
- */
- public native int getIntVolatile(Object obj, long offset);
-
- /**
- * Sets the value of the long field at the specified offset in the
- * supplied object to the given value, with volatile store semantics.
- *
- * @param obj the object containing the field to modify.
- * @param offset the offset of the long field within <code>obj</code>.
- * @param value the new value of the field.
- * @see #putLong(Object,long,long)
- */
- public native void putLongVolatile(Object obj, long offset, long value);
-
- /**
- * Sets the value of the long field at the specified offset in the
- * supplied object to the given value.
- *
- * @param obj the object containing the field to modify.
- * @param offset the offset of the long field within <code>obj</code>.
- * @param value the new value of the field.
- * @see #putLongVolatile(Object,long,long)
- */
- public native void putLong(Object obj, long offset, long value);
-
- /**
- * Retrieves the value of the long field at the specified offset in the
- * supplied object with volatile load semantics.
- *
- * @param obj the object containing the field to read.
- * @param offset the offset of the long field within <code>obj</code>.
- * @see #getLong(Object,long)
- */
- public native long getLongVolatile(Object obj, long offset);
-
- /**
- * Retrieves the value of the long field at the specified offset in the
- * supplied object.
- *
- * @param obj the object containing the field to read.
- * @param offset the offset of the long field within <code>obj</code>.
- * @see #getLongVolatile(Object,long)
- */
- public native long getLong(Object obj, long offset);
-
- /**
- * Sets the value of the object field at the specified offset in the
- * supplied object to the given value, with volatile store semantics.
- *
- * @param obj the object containing the field to modify.
- * @param offset the offset of the object field within <code>obj</code>.
- * @param value the new value of the field.
- * @see #putObject(Object,long,Object)
- */
- public native void putObjectVolatile(Object obj, long offset, Object value);
-
- /**
- * Sets the value of the object field at the specified offset in the
- * supplied object to the given value.
- *
- * @param obj the object containing the field to modify.
- * @param offset the offset of the object field within <code>obj</code>.
- * @param value the new value of the field.
- * @see #putObjectVolatile(Object,long,Object)
- */
- public native void putObject(Object obj, long offset, Object value);
-
- /**
- * Retrieves the value of the object field at the specified offset in the
- * supplied object with volatile load semantics.
- *
- * @param obj the object containing the field to read.
- * @param offset the offset of the object field within <code>obj</code>.
- */
- public native Object getObjectVolatile(Object obj, long offset);
-
- /**
- * Returns the offset of the first element for a given array class.
- * To access elements of the array class, this value may be used along
- * with that returned by
- * <a href="#arrayIndexScale"><code>arrayIndexScale</code></a>,
- * if non-zero.
- *
- * @param arrayClass the class for which the first element's address should
- * be obtained.
- * @return the offset of the first element of the array class.
- * @see arrayIndexScale(Class)
- */
- public native int arrayBaseOffset(Class arrayClass);
-
- /**
- * Returns the scale factor used for addressing elements of the supplied
- * array class. Where a suitable scale factor can not be returned (e.g.
- * for primitive types), zero should be returned. The returned value
- * can be used with
- * <a href="#arrayBaseOffset"><code>arrayBaseOffset</code></a>
- * to access elements of the class.
- *
- * @param arrayClass the class whose scale factor should be returned.
- * @return the scale factor, or zero if not supported for this array class.
- */
- public native int arrayIndexScale(Class arrayClass);
-
- /**
- * Releases the block on a thread created by
- * <a href="#park"><code>park</code></a>. This method can also be used
- * to terminate a blockage caused by a prior call to <code>park</code>.
- * This operation is unsafe, as the thread must be guaranteed to be
- * live. This is true of Java, but not native code.
- *
- * @param thread the thread to unblock.
- */
- public native void unpark(Thread thread);
-
- /**
- * Blocks the thread until a matching
- * <a href="#unpark"><code>unpark</code></a> occurs, the thread is
- * interrupted or the optional timeout expires. If an <code>unpark</code>
- * call has already occurred, this also counts. A timeout value of zero
- * is defined as no timeout. When <code>isAbsolute</code> is
- * <code>true</code>, the timeout is in milliseconds relative to the
- * epoch. Otherwise, the value is the number of nanoseconds which must
- * occur before timeout. This call may also return spuriously (i.e.
- * for no apparent reason).
- *
- * @param isAbsolute true if the timeout is specified in milliseconds from
- * the epoch.
- * @param time either the number of nanoseconds to wait, or a time in
- * milliseconds from the epoch to wait for.
- */
- public native void park(boolean isAbsolute, long time);
-
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-16 20:32:59
|
Revision: 3256
http://jnode.svn.sourceforge.net/jnode/?rev=3256&view=rev
Author: lsantha
Date: 2007-06-16 13:32:57 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/sun/sun/security/action/GetBooleanAction.java
trunk/core/src/openjdk/sun/sun/security/action/GetIntegerAction.java
trunk/core/src/openjdk/sun/sun/security/action/GetLongAction.java
trunk/core/src/openjdk/sun/sun/security/action/PutAllAction.java
Added: trunk/core/src/openjdk/sun/sun/security/action/GetBooleanAction.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/security/action/GetBooleanAction.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/security/action/GetBooleanAction.java 2007-06-16 20:32:57 UTC (rev 3256)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.security.action;
+
+/**
+ * A convenience class for retrieving the boolean value of a system property
+ * as a privileged action.
+ *
+ * <p>An instance of this class can be used as the argument of
+ * <code>AccessController.doPrivileged</code>.
+ *
+ * <p>The following code retrieves the boolean value of the system
+ * property named <code>"prop"</code> as a privileged action: <p>
+ *
+ * <pre>
+ * boolean b = java.security.AccessController.doPrivileged
+ * (new GetBooleanAction("prop")).booleanValue();
+ * </pre>
+ *
+ * @author Roland Schemers
+ * @version 1.18, 05/05/07
+ * @see java.security.PrivilegedAction
+ * @see java.security.AccessController
+ * @since 1.2
+ */
+
+public class GetBooleanAction
+ implements java.security.PrivilegedAction<Boolean> {
+ private String theProp;
+
+ /**
+ * Constructor that takes the name of the system property whose boolean
+ * value needs to be determined.
+ *
+ * @param theProp the name of the system property.
+ */
+ public GetBooleanAction(String theProp) {
+ this.theProp = theProp;
+ }
+
+ /**
+ * Determines the boolean value of the system property whose name was
+ * specified in the constructor.
+ *
+ * @return the <code>Boolean</code> value of the system property.
+ */
+ public Boolean run() {
+ return Boolean.getBoolean(theProp);
+ }
+}
Added: trunk/core/src/openjdk/sun/sun/security/action/GetIntegerAction.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/security/action/GetIntegerAction.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/security/action/GetIntegerAction.java 2007-06-16 20:32:57 UTC (rev 3256)
@@ -0,0 +1,114 @@
+/*
+ * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.security.action;
+
+/**
+ * A convenience class for retrieving the integer value of a system property
+ * as a privileged action.
+ *
+ * <p>An instance of this class can be used as the argument of
+ * <code>AccessController.doPrivileged</code>.
+ *
+ * <p>The following code retrieves the integer value of the system
+ * property named <code>"prop"</code> as a privileged action. Since it does
+ * not pass a default value to be used in case the property
+ * <code>"prop"</code> is not defined, it has to check the result for
+ * <code>null</code>: <p>
+ *
+ * <pre>
+ * Integer tmp = java.security.AccessController.doPrivileged
+ * (new sun.security.action.GetIntegerAction("prop"));
+ * int i;
+ * if (tmp != null) {
+ * i = tmp.intValue();
+ * }
+ * </pre>
+ *
+ * <p>The following code retrieves the integer value of the system
+ * property named <code>"prop"</code> as a privileged action, and also passes
+ * a default value to be used in case the property <code>"prop"</code> is not
+ * defined: <p>
+ *
+ * <pre>
+ * int i = ((Integer)java.security.AccessController.doPrivileged(
+ * new GetIntegerAction("prop", 3))).intValue();
+ * </pre>
+ *
+ * @author Roland Schemers
+ * @version 1.19, 05/05/07
+ * @see java.security.PrivilegedAction
+ * @see java.security.AccessController
+ * @since 1.2
+ */
+
+public class GetIntegerAction
+ implements java.security.PrivilegedAction<Integer> {
+ private String theProp;
+ private int defaultVal;
+ private boolean defaultSet = false;
+
+ /**
+ * Constructor that takes the name of the system property whose integer
+ * value needs to be determined.
+ *
+ * @param theProp the name of the system property.
+ */
+ public GetIntegerAction(String theProp) {
+ this.theProp = theProp;
+ }
+
+ /**
+ * Constructor that takes the name of the system property and the default
+ * value of that property.
+ *
+ * @param theProp the name of the system property.
+ * @param defaulVal the default value.
+ */
+ public GetIntegerAction(String theProp, int defaultVal) {
+ this.theProp = theProp;
+ this.defaultVal = defaultVal;
+ this.defaultSet = true;
+ }
+
+ /**
+ * Determines the integer value of the system property whose name was
+ * specified in the constructor.
+ *
+ * <p>If there is no property of the specified name, or if the property
+ * does not have the correct numeric format, then an <code>Integer</code>
+ * object representing the default value that was specified in the
+ * constructor is returned, or <code>null</code> if no default value was
+ * specified.
+ *
+ * @return the <code>Integer</code> value of the property.
+ */
+ public Integer run() {
+ Integer value = Integer.getInteger(theProp);
+ if ((value == null) && defaultSet)
+ return new Integer(defaultVal);
+ return value;
+ }
+}
Added: trunk/core/src/openjdk/sun/sun/security/action/GetLongAction.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/security/action/GetLongAction.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/security/action/GetLongAction.java 2007-06-16 20:32:57 UTC (rev 3256)
@@ -0,0 +1,113 @@
+/*
+ * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.security.action;
+
+/**
+ * A convenience class for retrieving the <code>Long</code> value of a system
+ * property as a privileged action.
+ *
+ * <p>An instance of this class can be used as the argument of
+ * <code>AccessController.doPrivileged</code>.
+ *
+ * <p>The following code retrieves the <code>Long</code> value of the system
+ * property named <code>"prop"</code> as a privileged action. Since it does
+ * not pass a default value to be used in case the property
+ * <code>"prop"</code> is not defined, it has to check the result for
+ * <code>null</code>: <p>
+ *
+ * <pre>
+ * Long tmp = java.security.AccessController.doPrivileged
+ * (new sun.security.action.GetLongAction("prop"));
+ * long l;
+ * if (tmp != null) {
+ * l = tmp.longValue();
+ * }
+ * </pre>
+ *
+ * <p>The following code retrieves the <code>Long</code> value of the system
+ * property named <code>"prop"</code> as a privileged action, and also passes
+ * a default value to be used in case the property <code>"prop"</code> is not
+ * defined: <p>
+ *
+ * <pre>
+ * long l = java.security.AccessController.doPrivileged
+ * (new GetLongAction("prop")).longValue();
+ * </pre>
+ *
+ * @author Roland Schemers
+ * @version 1.18, 05/05/07
+ * @see java.security.PrivilegedAction
+ * @see java.security.AccessController
+ * @since 1.2
+ */
+
+public class GetLongAction implements java.security.PrivilegedAction<Long> {
+ private String theProp;
+ private long defaultVal;
+ private boolean defaultSet = false;
+
+ /**
+ * Constructor that takes the name of the system property whose
+ * <code>Long</code> value needs to be determined.
+ *
+ * @param theProp the name of the system property.
+ */
+ public GetLongAction(String theProp) {
+ this.theProp = theProp;
+ }
+
+ /**
+ * Constructor that takes the name of the system property and the default
+ * value of that property.
+ *
+ * @param theProp the name of the system property.
+ * @param defaulVal the default value.
+ */
+ public GetLongAction(String theProp, long defaultVal) {
+ this.theProp = theProp;
+ this.defaultVal = defaultVal;
+ this.defaultSet = true;
+ }
+
+ /**
+ * Determines the <code>Long</code> value of the system property whose
+ * name was specified in the constructor.
+ *
+ * <p>If there is no property of the specified name, or if the property
+ * does not have the correct numeric format, then a <code>Long</code>
+ * object representing the default value that was specified in the
+ * constructor is returned, or <code>null</code> if no default value was
+ * specified.
+ *
+ * @return the <code>Long</code> value of the property.
+ */
+ public Long run() {
+ Long value = Long.getLong(theProp);
+ if ((value == null) && defaultSet)
+ return new Long(defaultVal);
+ return value;
+ }
+}
Added: trunk/core/src/openjdk/sun/sun/security/action/PutAllAction.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/security/action/PutAllAction.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/security/action/PutAllAction.java 2007-06-16 20:32:57 UTC (rev 3256)
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.security.action;
+
+import java.util.Map;
+
+import java.security.Provider;
+import java.security.PrivilegedAction;
+
+/**
+ * A convenience PrivilegedAction class for setting the properties of
+ * a provider. See the SunRsaSign provider for a usage example.
+ *
+ * @see sun.security.rsa.SunRsaSign
+ * @author Andreas Sterbenz
+ * @version 1.10, 05/05/07
+ * @since 1.5
+ */
+public class PutAllAction implements PrivilegedAction<Void> {
+
+ private final Provider provider;
+ private final Map map;
+
+ public PutAllAction(Provider provider, Map map) {
+ this.provider = provider;
+ this.map = map;
+ }
+
+ public Void run() {
+ provider.putAll(map);
+ return null;
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-16 20:26:18
|
Revision: 3255
http://jnode.svn.sourceforge.net/jnode/?rev=3255&view=rev
Author: lsantha
Date: 2007-06-16 13:26:16 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/java/java/security/
trunk/core/src/openjdk/java/java/security/CodeSigner.java
trunk/core/src/openjdk/java/java/security/Timestamp.java
Added: trunk/core/src/openjdk/java/java/security/CodeSigner.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/CodeSigner.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/CodeSigner.java 2007-06-16 20:26:16 UTC (rev 3255)
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security;
+
+import java.io.Serializable;
+import java.security.cert.CertPath;
+
+/**
+ * This class encapsulates information about a code signer.
+ * It is immutable.
+ *
+ * @since 1.5
+ * @version 1.11, 05/05/07
+ * @author Vincent Ryan
+ */
+
+public final class CodeSigner implements Serializable {
+
+ private static final long serialVersionUID = 6819288105193937581L;
+
+ /**
+ * The signer's certificate path.
+ *
+ * @serial
+ */
+ private CertPath signerCertPath;
+
+ /*
+ * The signature timestamp.
+ *
+ * @serial
+ */
+ private Timestamp timestamp;
+
+ /*
+ * Hash code for this code signer.
+ */
+ private transient int myhash = -1;
+
+ /**
+ * Constructs a CodeSigner object.
+ *
+ * @param signerCertPath The signer's certificate path.
+ * It must not be <code>null</code>.
+ * @param timestamp A signature timestamp.
+ * If <code>null</code> then no timestamp was generated
+ * for the signature.
+ * @throws NullPointerException if <code>signerCertPath</code> is
+ * <code>null</code>.
+ */
+ public CodeSigner(CertPath signerCertPath, Timestamp timestamp) {
+ if (signerCertPath == null) {
+ throw new NullPointerException();
+ }
+ this.signerCertPath = signerCertPath;
+ this.timestamp = timestamp;
+ }
+
+ /**
+ * Returns the signer's certificate path.
+ *
+ * @return A certificate path.
+ */
+ public CertPath getSignerCertPath() {
+ return signerCertPath;
+ }
+
+ /**
+ * Returns the signature timestamp.
+ *
+ * @return The timestamp or <code>null</code> if none is present.
+ */
+ public Timestamp getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * Returns the hash code value for this code signer.
+ * The hash code is generated using the signer's certificate path and the
+ * timestamp, if present.
+ *
+ * @return a hash code value for this code signer.
+ */
+ public int hashCode() {
+ if (myhash == -1) {
+ if (timestamp == null) {
+ myhash = signerCertPath.hashCode();
+ } else {
+ myhash = signerCertPath.hashCode() + timestamp.hashCode();
+ }
+ }
+ return myhash;
+ }
+
+ /**
+ * Tests for equality between the specified object and this
+ * code signer. Two code signers are considered equal if their
+ * signer certificate paths are equal and if their timestamps are equal,
+ * if present in both.
+ *
+ * @param obj the object to test for equality with this object.
+ *
+ * @return true if the objects are considered equal, false otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj == null || (!(obj instanceof CodeSigner))) {
+ return false;
+ }
+ CodeSigner that = (CodeSigner)obj;
+
+ if (this == that) {
+ return true;
+ }
+ Timestamp thatTimestamp = that.getTimestamp();
+ if (timestamp == null) {
+ if (thatTimestamp != null) {
+ return false;
+ }
+ } else {
+ if (thatTimestamp == null ||
+ (! timestamp.equals(thatTimestamp))) {
+ return false;
+ }
+ }
+ return signerCertPath.equals(that.getSignerCertPath());
+ }
+
+ /**
+ * Returns a string describing this code signer.
+ *
+ * @return A string comprising the signer's certificate and a timestamp,
+ * if present.
+ */
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append("(");
+ sb.append("Signer: " + signerCertPath.getCertificates().get(0));
+ if (timestamp != null) {
+ sb.append("timestamp: " + timestamp);
+ }
+ sb.append(")");
+ return sb.toString();
+ }
+}
Added: trunk/core/src/openjdk/java/java/security/Timestamp.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/Timestamp.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/Timestamp.java 2007-06-16 20:26:16 UTC (rev 3255)
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security;
+
+import java.io.Serializable;
+import java.security.cert.CertPath;
+import java.security.cert.X509Extension;
+import java.util.Date;
+
+/**
+ * This class encapsulates information about a signed timestamp.
+ * It is immutable.
+ * It includes the timestamp's date and time as well as information about the
+ * Timestamping Authority (TSA) which generated and signed the timestamp.
+ *
+ * @since 1.5
+ * @version 1.9, 05/05/07
+ * @author Vincent Ryan
+ */
+
+public final class Timestamp implements Serializable {
+
+ private static final long serialVersionUID = -5502683707821851294L;
+
+ /**
+ * The timestamp's date and time
+ *
+ * @serial
+ */
+ private Date timestamp;
+
+ /**
+ * The TSA's certificate path.
+ *
+ * @serial
+ */
+ private CertPath signerCertPath;
+
+ /*
+ * Hash code for this timestamp.
+ */
+ private transient int myhash = -1;
+
+ /**
+ * Constructs a Timestamp.
+ *
+ * @param timestamp is the timestamp's date and time. It must not be null.
+ * @param signerCertPath is the TSA's certificate path. It must not be null.
+ * @throws NullPointerException if timestamp or signerCertPath is null.
+ */
+ public Timestamp(Date timestamp, CertPath signerCertPath) {
+ if (timestamp == null || signerCertPath == null) {
+ throw new NullPointerException();
+ }
+ this.timestamp = new Date(timestamp.getTime()); // clone
+ this.signerCertPath = signerCertPath;
+ }
+
+ /**
+ * Returns the date and time when the timestamp was generated.
+ *
+ * @return The timestamp's date and time.
+ */
+ public Date getTimestamp() {
+ return new Date(timestamp.getTime()); // clone
+ }
+
+ /**
+ * Returns the certificate path for the Timestamping Authority.
+ *
+ * @return The TSA's certificate path.
+ */
+ public CertPath getSignerCertPath() {
+ return signerCertPath;
+ }
+
+ /**
+ * Returns the hash code value for this timestamp.
+ * The hash code is generated using the date and time of the timestamp
+ * and the TSA's certificate path.
+ *
+ * @return a hash code value for this timestamp.
+ */
+ public int hashCode() {
+ if (myhash == -1) {
+ myhash = timestamp.hashCode() + signerCertPath.hashCode();
+ }
+ return myhash;
+ }
+
+ /**
+ * Tests for equality between the specified object and this
+ * timestamp. Two timestamps are considered equal if the date and time of
+ * their timestamp's and their signer's certificate paths are equal.
+ *
+ * @param obj the object to test for equality with this timestamp.
+ *
+ * @return true if the timestamp are considered equal, false otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj == null || (!(obj instanceof Timestamp))) {
+ return false;
+ }
+ Timestamp that = (Timestamp)obj;
+
+ if (this == that) {
+ return true;
+ }
+ return (timestamp.equals(that.getTimestamp()) &&
+ signerCertPath.equals(that.getSignerCertPath()));
+ }
+
+ /**
+ * Returns a string describing this timestamp.
+ *
+ * @return A string comprising the date and time of the timestamp and
+ * its signer's certificate.
+ */
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append("(");
+ sb.append("timestamp: " + timestamp);
+ sb.append("TSA: " + signerCertPath.getCertificates().get(0));
+ sb.append(")");
+ return sb.toString();
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-16 20:23:33
|
Revision: 3254
http://jnode.svn.sourceforge.net/jnode/?rev=3254&view=rev
Author: lsantha
Date: 2007-06-16 13:23:30 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/java/java/io/
trunk/core/src/openjdk/java/java/io/IOError.java
Added: trunk/core/src/openjdk/java/java/io/IOError.java
===================================================================
--- trunk/core/src/openjdk/java/java/io/IOError.java (rev 0)
+++ trunk/core/src/openjdk/java/java/io/IOError.java 2007-06-16 20:23:30 UTC (rev 3254)
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.io;
+
+/**
+ * Thrown when a serious I/O error has occurred.
+ *
+ * @author Xueming Shen
+ * @version 1.9 05/05/07
+ * @since 1.6
+ */
+public class IOError extends Error {
+ /**
+ * Constructs a new instance of IOError with the specified cause. The
+ * IOError is created with the detail message of
+ * <tt>(cause==null ? null : cause.toString())</tt> (which typically
+ * contains the class and detail message of cause).
+ *
+ * @param cause
+ * The cause of this error, or <tt>null</tt> if the cause
+ * is not known
+ */
+ public IOError(Throwable cause) {
+ super(cause);
+ }
+
+ private static final long serialVersionUID = 67100927991680413L;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-16 20:22:39
|
Revision: 3253
http://jnode.svn.sourceforge.net/jnode/?rev=3253&view=rev
Author: lsantha
Date: 2007-06-16 13:22:36 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/sun/sun/util/
trunk/core/src/openjdk/sun/sun/util/PreHashedMap.java
Added: trunk/core/src/openjdk/sun/sun/util/PreHashedMap.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/util/PreHashedMap.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/util/PreHashedMap.java 2007-06-16 20:22:36 UTC (rev 3253)
@@ -0,0 +1,290 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.util;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.AbstractMap;
+import java.util.AbstractSet;
+import java.util.NoSuchElementException;
+
+
+/**
+ * A precomputed hash map.
+ *
+ * <p> Subclasses of this class are of the following form:
+ *
+ * <blockquote><pre>
+ * class FooMap
+ * extends sun.util.PreHashedMap<String>
+ * {
+ *
+ * private FooMap() {
+ * super(ROWS, SIZE, SHIFT, MASK);
+ * }
+ *
+ * protected void init(Object[] ht) {
+ * ht[0] = new Object[] { "key-1", value_1 };
+ * ht[1] = new Object[] { "key-2", value_2,
+ * new Object { "key-3", value_3 } };
+ * ...
+ * }
+ *
+ * }</pre></blockquote>
+ *
+ * <p> The <tt>init</tt> method is invoked by the <tt>PreHashedMap</tt>
+ * constructor with an object array long enough for the map's rows. The method
+ * must construct the hash chain for each row and store it in the appropriate
+ * element of the array.
+ *
+ * <p> Each entry in the map is represented by a unique hash-chain node. The
+ * final node of a hash chain is a two-element object array whose first element
+ * is the entry's key and whose second element is the entry's value. A
+ * non-final node of a hash chain is a three-element object array whose first
+ * two elements are the entry's key and value and whose third element is the
+ * next node in the chain.
+ *
+ * <p> Instances of this class are mutable and are not safe for concurrent
+ * access. They may be made immutable and thread-safe via the appropriate
+ * methods in the {@link java.util.Collections} utility class.
+ *
+ * <p> In the JDK build, subclasses of this class are typically created via the
+ * <tt>Hasher</tt> program in the <tt>make/tools/Hasher</tt> directory.
+ *
+ * @author Mark Reinhold
+ * @version 1.8 07/05/05
+ * @since 1.5
+ *
+ * @see java.util.AbstractMap
+ */
+
+public abstract class PreHashedMap<V>
+ extends AbstractMap<String,V>
+{
+
+ private final int rows;
+ private final int size;
+ private final int shift;
+ private final int mask;
+ private final Object[] ht;
+
+ /**
+ * Creates a new map.
+ *
+ * <p> This constructor invokes the {@link #init init} method, passing it a
+ * newly-constructed row array that is <tt>rows</tt> elements long.
+ *
+ * @param rows
+ * The number of rows in the map
+ * @param size
+ * The number of entries in the map
+ * @param shift
+ * The value by which hash codes are right-shifted
+ * @param mask
+ * The value with which hash codes are masked after being shifted
+ */
+ protected PreHashedMap(int rows, int size, int shift, int mask) {
+ this.rows = rows;
+ this.size = size;
+ this.shift = shift;
+ this.mask = mask;
+ this.ht = new Object[rows];
+ init(ht);
+ }
+
+ /**
+ * Initializes this map.
+ *
+ * <p> This method must construct the map's hash chains and store them into
+ * the appropriate elements of the given hash-table row array.
+ *
+ * @param rows
+ * The row array to be initialized
+ */
+ protected abstract void init(Object[] ht);
+
+ // @SuppressWarnings("unchecked")
+ private V toV(Object x) {
+ return (V)x;
+ }
+
+ public V get(Object k) {
+ int h = (k.hashCode() >> shift) & mask;
+ Object[] a = (Object[])ht[h];
+ if (a == null) return null;
+ for (;;) {
+ if (a[0].equals(k))
+ return toV(a[1]);
+ if (a.length < 3)
+ return null;
+ a = (Object[])a[2];
+ }
+ }
+
+ /**
+ * @throws UnsupportedOperationException
+ * If the given key is not part of this map's initial key set
+ */
+ public V put(String k, V v) {
+ int h = (k.hashCode() >> shift) & mask;
+ Object[] a = (Object[])ht[h];
+ if (a == null)
+ throw new UnsupportedOperationException(k);
+ for (;;) {
+ if (a[0].equals(k)) {
+ V ov = toV(a[1]);
+ a[1] = v;
+ return ov;
+ }
+ if (a.length < 3)
+ throw new UnsupportedOperationException(k);
+ a = (Object[])a[2];
+ }
+ }
+
+ public Set<String> keySet() {
+ return new AbstractSet<String> () {
+
+ public int size() {
+ return size;
+ }
+
+ public Iterator<String> iterator() {
+ return new Iterator<String>() {
+ private int i = -1;
+ Object[] a = null;
+ String cur = null;
+
+ private boolean findNext() {
+ if (a != null) {
+ if (a.length == 3) {
+ a = (Object[])a[2];
+ cur = (String)a[0];
+ return true;
+ }
+ i++;
+ a = null;
+ }
+ cur = null;
+ if (i >= rows)
+ return false;
+ if (i < 0 || ht[i] == null) {
+ do {
+ if (++i >= rows)
+ return false;
+ } while (ht[i] == null);
+ }
+ a = (Object[])ht[i];
+ cur = (String)a[0];
+ return true;
+ }
+
+ public boolean hasNext() {
+ if (cur != null)
+ return true;
+ return findNext();
+ }
+
+ public String next() {
+ if (cur == null) {
+ if (!findNext())
+ throw new NoSuchElementException();
+ }
+ String s = cur;
+ cur = null;
+ return s;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ };
+ }
+ };
+ }
+
+ public Set<Map.Entry<String,V>> entrySet() {
+ return new AbstractSet<Map.Entry<String,V>> () {
+
+ public int size() {
+ return size;
+ }
+
+ public Iterator<Map.Entry<String,V>> iterator() {
+ return new Iterator<Map.Entry<String,V>>() {
+ final Iterator<String> i = keySet().iterator();
+
+ public boolean hasNext() {
+ return i.hasNext();
+ }
+
+ public Map.Entry<String,V> next() {
+ return new Map.Entry<String,V>() {
+ String k = i.next();
+ public String getKey() { return k; }
+ public V getValue() { return get(k); }
+ public int hashCode() {
+ V v = get(k);
+ return (k.hashCode()
+ + (v == null
+ ? 0
+ : v.hashCode()));
+ }
+ public boolean equals(Object ob) {
+ if (ob == this)
+ return true;
+ if (!(ob instanceof Map.Entry))
+ return false;
+ Map.Entry<String,V> that
+ = (Map.Entry<String,V>)ob;
+ return ((this.getKey() == null
+ ? that.getKey() == null
+ : this.getKey()
+ .equals(that.getKey()))
+ &&
+ (this.getValue() == null
+ ? that.getValue() == null
+ : this.getValue()
+ .equals(that.getValue())));
+ }
+ public V setValue(V v) {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ };
+ }
+ };
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-16 20:21:03
|
Revision: 3252
http://jnode.svn.sourceforge.net/jnode/?rev=3252&view=rev
Author: lsantha
Date: 2007-06-16 13:20:56 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/sun/sun/nio/ByteBuffered.java
Added: trunk/core/src/openjdk/sun/sun/nio/ByteBuffered.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/nio/ByteBuffered.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/nio/ByteBuffered.java 2007-06-16 20:20:56 UTC (rev 3252)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.nio;
+
+import java.nio.ByteBuffer;
+import java.io.IOException;
+
+/** This is an interface to adapt existing APIs to use {@link java.nio.ByteBuffer
+ * <tt>ByteBuffers</tt>} as the underlying
+ * data format. Only the initial producer and final consumer have to be changed.<p>
+ *
+ * For example, the Zip/Jar code supports {@link java.io.InputStream <tt>InputStreams</tt>}.
+ * To make the Zip code use {@link java.nio.MappedByteBuffer <tt>MappedByteBuffers</tt>} as
+ * the underlying data structure, it can create a class of InputStream that wraps the ByteBuffer,
+ * and implements the ByteBuffered interface. A co-operating class several layers
+ * away can ask the InputStream if it is an instance of ByteBuffered, then
+ * call the {@link #getByteBuffer()} method.
+ */
+public interface ByteBuffered {
+
+ /**
+ * Returns the <tt>ByteBuffer</tt> behind this object, if this particular
+ * instance has one. An implementation of <tt>getByteBuffer()</tt> is allowed
+ * to return <tt>null</tt> for any reason.
+ *
+ * @return The <tt>ByteBuffer</tt>, if this particular instance has one,
+ * or <tt>null</tt> otherwise.
+ *
+ * @throws IOException
+ * If the ByteBuffer is no longer valid.
+ *
+ * @since 1.5
+ */
+ public ByteBuffer getByteBuffer() throws IOException;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-16 20:20:26
|
Revision: 3251
http://jnode.svn.sourceforge.net/jnode/?rev=3251&view=rev
Author: lsantha
Date: 2007-06-16 13:20:24 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/sun/sun/nio/
trunk/core/src/openjdk/sun/sun/nio/ch/
trunk/core/src/openjdk/sun/sun/nio/ch/Interruptible.java
Added: trunk/core/src/openjdk/sun/sun/nio/ch/Interruptible.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/nio/ch/Interruptible.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/nio/ch/Interruptible.java 2007-06-16 20:20:24 UTC (rev 3251)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @(#)Interruptible.java 1.13 07/05/05
+ */
+
+package sun.nio.ch;
+
+
+public interface Interruptible {
+
+ public void interrupt();
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-16 19:49:10
|
Revision: 3250
http://jnode.svn.sourceforge.net/jnode/?rev=3250&view=rev
Author: lsantha
Date: 2007-06-16 12:49:07 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Improved getCallerClass() to compile with sun.misc.Unsafe.getUnsafe().
Modified Paths:
--------------
trunk/core/src/openjdk/vm/sun/reflect/NativeReflection.java
Modified: trunk/core/src/openjdk/vm/sun/reflect/NativeReflection.java
===================================================================
--- trunk/core/src/openjdk/vm/sun/reflect/NativeReflection.java 2007-06-16 19:46:39 UTC (rev 3249)
+++ trunk/core/src/openjdk/vm/sun/reflect/NativeReflection.java 2007-06-16 19:49:07 UTC (rev 3250)
@@ -17,8 +17,8 @@
* @see Reflection#getCallerClass(int)
*/
static Class getCallerClass(int realFramesToSkip){
- //todo test it
- return VmSystem.getClassContext()[realFramesToSkip];
+ // using realFramesToSkip + 1 to skip VmSystem
+ return VmSystem.getRealClassContext()[realFramesToSkip + 1];
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-16 19:46:41
|
Revision: 3249
http://jnode.svn.sourceforge.net/jnode/?rev=3249&view=rev
Author: lsantha
Date: 2007-06-16 12:46:39 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Openjdk style getClassContext() implementation to support NativeReflection..
Modified Paths:
--------------
trunk/core/src/core/org/jnode/vm/VmSystem.java
Modified: trunk/core/src/core/org/jnode/vm/VmSystem.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/VmSystem.java 2007-06-16 19:28:56 UTC (rev 3248)
+++ trunk/core/src/core/org/jnode/vm/VmSystem.java 2007-06-16 19:46:39 UTC (rev 3249)
@@ -402,6 +402,37 @@
}
/**
+ * Gets the current stacktrace as array of classes excluding the calls to
+ * java.lang.reflect.Method.invoke() and org.jnode.vm.VmReflection.invoke().
+ *
+ * @return Class[]
+ */
+ public static Class[] getRealClassContext() {
+ final VmStackReader reader = VmProcessor.current().getArchitecture()
+ .getStackReader();
+ final VmStackFrame[] stack = reader.getVmStackTrace(VmMagic
+ .getCurrentFrame(), null, VmThread.STACKTRACE_LIMIT);
+ final int count = stack.length;
+ final Class[] result = new Class[count];
+ int real_count = 0;
+ for (int i = 0; i < count; i++) {
+ VmMethod method = stack[i].getMethod();
+ VmType<?> clazz = method.getDeclaringClass();
+ if((method.getName().equals("invoke") && (
+ clazz.getName().equals("java.lang.reflect.Method") ||
+ clazz.getName().equals("org.jnode.vm.VmReflection"))))
+ continue;
+
+ result[real_count++] = clazz.asClass();
+ }
+
+ Class[] real_result = new Class[real_count];
+ System.arraycopy(result, 0, real_result, 0, real_count);
+
+ return real_result;
+ }
+
+ /**
* Do nothing, until interrupted by an interrupts.
*/
public static void idle() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-16 19:28:58
|
Revision: 3248
http://jnode.svn.sourceforge.net/jnode/?rev=3248&view=rev
Author: lsantha
Date: 2007-06-16 12:28:56 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Added core openjdk classes.
Modified Paths:
--------------
trunk/core/descriptors/org.classpath.core.xml
Modified: trunk/core/descriptors/org.classpath.core.xml
===================================================================
--- trunk/core/descriptors/org.classpath.core.xml 2007-06-16 19:27:50 UTC (rev 3247)
+++ trunk/core/descriptors/org.classpath.core.xml 2007-06-16 19:28:56 UTC (rev 3248)
@@ -13,6 +13,8 @@
<library name="jnode-core.jar">
<export name="sun.misc.*"/>
+ <export name="sun.nio.cs.StreamEncoder"/>
+ <export name="sun.nio.cs.StreamDecoder"/>
<export name="gnu.classpath.Configuration"/>
<export name="gnu.classpath.Pointer"/>
@@ -109,6 +111,10 @@
<export name="javax.naming.NamingException"/>
<export name="javax.naming.NameNotFoundException"/>
+ <export name="javax.xml.parsers.*"/>
+ <export name="javax.xml.transform.*"/>
+ <export name="javax.xml.transform.dom.*"/>
+ <export name="javax.xml.transform.stream.*"/>
<export name="javax.xml.stream.*"/>
<export name="javax.xml.stream.events.*"/>
<export name="javax.xml.stream.util.*"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-16 19:28:06
|
Revision: 3247
http://jnode.svn.sourceforge.net/jnode/?rev=3247&view=rev
Author: lsantha
Date: 2007-06-16 12:27:50 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Exclude from compile java class templates and package-info files.
Modified Paths:
--------------
trunk/all/lib/jnode.xml
Modified: trunk/all/lib/jnode.xml
===================================================================
--- trunk/all/lib/jnode.xml 2007-06-16 19:26:27 UTC (rev 3246)
+++ trunk/all/lib/jnode.xml 2007-06-16 19:27:50 UTC (rev 3247)
@@ -14,7 +14,7 @@
target="${java.target}"
source="${java.source}"
encoding="${java.encoding}"
- excludes="**/resources/*-template.java">
+ excludes="**/*-template.java,**/package-info.java">
<bootclasspath path="${jnode-core.jar}"/>
<compilerarg value="${compilerarg}"/>
</javac>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-16 19:26:32
|
Revision: 3246
http://jnode.svn.sourceforge.net/jnode/?rev=3246&view=rev
Author: lsantha
Date: 2007-06-16 12:26:27 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Do not return the system classloader in getClassLoader().
Modified Paths:
--------------
trunk/core/src/classpath/vm/java/lang/Class.java
Modified: trunk/core/src/classpath/vm/java/lang/Class.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/Class.java 2007-06-12 20:00:46 UTC (rev 3245)
+++ trunk/core/src/classpath/vm/java/lang/Class.java 2007-06-16 19:26:27 UTC (rev 3246)
@@ -72,6 +72,7 @@
import org.jnode.vm.classmgr.VmField;
import org.jnode.vm.classmgr.VmMethod;
import org.jnode.vm.classmgr.VmType;
+import org.jnode.vm.classmgr.VmClassLoader;
/**
* A Class represents a Java type. There will never be multiple Class
@@ -401,7 +402,8 @@
* @return ClassLoader
*/
public final ClassLoader getClassLoader() {
- return vmClass.getLoader().asClassLoader();
+ VmClassLoader loader = vmClass.getLoader();
+ return loader.isSystemClassLoader() ? null : loader.asClassLoader();
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-12 20:00:48
|
Revision: 3245
http://jnode.svn.sourceforge.net/jnode/?rev=3245&view=rev
Author: lsantha
Date: 2007-06-12 13:00:46 -0700 (Tue, 12 Jun 2007)
Log Message:
-----------
Improved support for native methods.
Modified Paths:
--------------
trunk/core/src/core/org/jnode/vm/classmgr/ClassDecoder.java
trunk/core/src/core/org/jnode/vm/classmgr/Signature.java
trunk/core/src/core/org/jnode/vm/classmgr/VmType.java
Modified: trunk/core/src/core/org/jnode/vm/classmgr/ClassDecoder.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/ClassDecoder.java 2007-06-10 19:44:27 UTC (rev 3244)
+++ trunk/core/src/core/org/jnode/vm/classmgr/ClassDecoder.java 2007-06-12 20:00:46 UTC (rev 3245)
@@ -511,8 +511,7 @@
}
}
- final VmMethod nativeMethod = nativeType.getMethod(method.getName(),
- argTypes);
+ final VmMethod nativeMethod = nativeType.getNativeMethodReplacement(method.getName(), argTypes);
if (nativeMethod == null) {
if (verbose) {
BootLog.error("Native method replacement (" + method
Modified: trunk/core/src/core/org/jnode/vm/classmgr/Signature.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/Signature.java 2007-06-10 19:44:27 UTC (rev 3244)
+++ trunk/core/src/core/org/jnode/vm/classmgr/Signature.java 2007-06-12 20:00:46 UTC (rev 3245)
@@ -339,4 +339,66 @@
}
return b.toString();
}
+
+ /**
+ * Convert the given VmType to a signature.
+ *
+ * @param cls a VmType instance
+ * @return String the signature
+ */
+ public static String toSignature(VmType cls) {
+ if (cls == null) {
+ throw new NullPointerException("cls==null");
+ }
+
+ if (cls.isArray()) {
+ return "[" + toSignature(((VmArrayClass)cls).getComponentType());
+ } else if (cls.isPrimitive()) {
+ if (cls == VmType.getPrimitiveClass('Z')) {
+ return "Z";
+ } else if (cls == VmType.getPrimitiveClass('B')) {
+ return "B";
+ } else if (cls == VmType.getPrimitiveClass('C')) {
+ return "C";
+ } else if (cls == VmType.getPrimitiveClass('S')) {
+ return "S";
+ } else if (cls == VmType.getPrimitiveClass('I')) {
+ return "I";
+ } else if (cls == VmType.getPrimitiveClass('J')) {
+ return "J";
+ } else if (cls == VmType.getPrimitiveClass('F')) {
+ return "F";
+ } else if (cls == VmType.getPrimitiveClass('D')) {
+ return "D";
+ } else if (cls == VmType.getPrimitiveClass('V')) {
+ return "V";
+ }
+ return cls.getName();
+ } else {
+ return "L" + cls.getName().replace('.', '/') + ";";
+ }
+ }
+ /**
+ * Convert the given VmType array to a signature.
+ *
+ * @param returnType
+ * @param argTypes
+ * @return String
+ */
+ public static String toSignature(VmType returnType, VmType[] argTypes) {
+ StringBuilder b = new StringBuilder();
+ b.append('(');
+ if (argTypes != null) {
+ for (int i = 0; i < argTypes.length; i++) {
+ b.append(toSignature(argTypes[i]));
+ }
+ }
+ b.append(')');
+ if (returnType == null) {
+ b.append('V');
+ } else {
+ b.append(toSignature(returnType));
+ }
+ return b.toString();
+ }
}
Modified: trunk/core/src/core/org/jnode/vm/classmgr/VmType.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/VmType.java 2007-06-10 19:44:27 UTC (rev 3244)
+++ trunk/core/src/core/org/jnode/vm/classmgr/VmType.java 2007-06-12 20:00:46 UTC (rev 3245)
@@ -1364,6 +1364,26 @@
protected abstract VmMethod getSyntheticAbstractMethod(String name,
String signature, int hashCode);
+ final VmMethod getNativeMethodReplacement(String name, VmType[] argTypes) {
+ String sig1 = Signature.toSignature(null, argTypes);
+ sig1 = sig1.substring(0, sig1.indexOf(')'));
+ /* Search only in my own method table */
+ final VmMethod[] mt = this.methodTable;
+ if (mt != null) {
+ final int count = mt.length;
+ for (int i = 0; i < count; i++) {
+ final VmMethod mts = mt[i];
+ if (mts.nameEquals(name)) {
+ String sig2 = mts.getSignature();
+ if (sig1.equals(sig2.substring(0, sig2.indexOf(')')))) {
+ return mts;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
/**
* Find the method within the given class (or super-classes) that has the
* given name and list of argument types.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|