|
From: <ls...@us...> - 2006-12-12 21:10:02
|
Revision: 2896
http://jnode.svn.sourceforge.net/jnode/?rev=2896&view=rev
Author: lsantha
Date: 2006-12-12 13:09:56 -0800 (Tue, 12 Dec 2006)
Log Message:
-----------
Migrating to Java 5 level classpath.
Added Paths:
-----------
trunk/core/src/classpath/java/java/io/
trunk/core/src/classpath/java/java/io/BufferedInputStream.java
trunk/core/src/classpath/java/java/io/BufferedOutputStream.java
trunk/core/src/classpath/java/java/io/BufferedReader.java
trunk/core/src/classpath/java/java/io/BufferedWriter.java
trunk/core/src/classpath/java/java/io/ByteArrayInputStream.java
trunk/core/src/classpath/java/java/io/ByteArrayOutputStream.java
trunk/core/src/classpath/java/java/io/CharArrayReader.java
trunk/core/src/classpath/java/java/io/CharArrayWriter.java
trunk/core/src/classpath/java/java/io/CharConversionException.java
trunk/core/src/classpath/java/java/io/Closeable.java
trunk/core/src/classpath/java/java/io/DataInput.java
trunk/core/src/classpath/java/java/io/DataInputStream.java
trunk/core/src/classpath/java/java/io/DataOutput.java
trunk/core/src/classpath/java/java/io/DataOutputStream.java
trunk/core/src/classpath/java/java/io/DeleteFileHelper.java
trunk/core/src/classpath/java/java/io/EOFException.java
trunk/core/src/classpath/java/java/io/Externalizable.java
trunk/core/src/classpath/java/java/io/File.java
trunk/core/src/classpath/java/java/io/FileDescriptor.java
trunk/core/src/classpath/java/java/io/FileFilter.java
trunk/core/src/classpath/java/java/io/FileInputStream.java
trunk/core/src/classpath/java/java/io/FileNotFoundException.java
trunk/core/src/classpath/java/java/io/FileOutputStream.java
trunk/core/src/classpath/java/java/io/FilePermission.java
trunk/core/src/classpath/java/java/io/FileReader.java
trunk/core/src/classpath/java/java/io/FileWriter.java
trunk/core/src/classpath/java/java/io/FilenameFilter.java
trunk/core/src/classpath/java/java/io/FilterInputStream.java
trunk/core/src/classpath/java/java/io/FilterOutputStream.java
trunk/core/src/classpath/java/java/io/FilterReader.java
trunk/core/src/classpath/java/java/io/FilterWriter.java
trunk/core/src/classpath/java/java/io/Flushable.java
trunk/core/src/classpath/java/java/io/IOException.java
trunk/core/src/classpath/java/java/io/InputStream.java
trunk/core/src/classpath/java/java/io/InputStreamReader.java
trunk/core/src/classpath/java/java/io/InterruptedIOException.java
trunk/core/src/classpath/java/java/io/InvalidClassException.java
trunk/core/src/classpath/java/java/io/InvalidObjectException.java
trunk/core/src/classpath/java/java/io/LineNumberInputStream.java
trunk/core/src/classpath/java/java/io/LineNumberReader.java
trunk/core/src/classpath/java/java/io/NotActiveException.java
trunk/core/src/classpath/java/java/io/NotSerializableException.java
trunk/core/src/classpath/java/java/io/ObjectInput.java
trunk/core/src/classpath/java/java/io/ObjectInputStream.java
trunk/core/src/classpath/java/java/io/ObjectInputValidation.java
trunk/core/src/classpath/java/java/io/ObjectOutput.java
trunk/core/src/classpath/java/java/io/ObjectOutputStream.java
trunk/core/src/classpath/java/java/io/ObjectStreamClass.java
trunk/core/src/classpath/java/java/io/ObjectStreamConstants.java
trunk/core/src/classpath/java/java/io/ObjectStreamException.java
trunk/core/src/classpath/java/java/io/ObjectStreamField.java
trunk/core/src/classpath/java/java/io/OptionalDataException.java
trunk/core/src/classpath/java/java/io/OutputStream.java
trunk/core/src/classpath/java/java/io/OutputStreamWriter.java
trunk/core/src/classpath/java/java/io/PipedInputStream.java
trunk/core/src/classpath/java/java/io/PipedOutputStream.java
trunk/core/src/classpath/java/java/io/PipedReader.java
trunk/core/src/classpath/java/java/io/PipedWriter.java
trunk/core/src/classpath/java/java/io/PrintStream.java
trunk/core/src/classpath/java/java/io/PrintWriter.java
trunk/core/src/classpath/java/java/io/PushbackInputStream.java
trunk/core/src/classpath/java/java/io/PushbackReader.java
trunk/core/src/classpath/java/java/io/RandomAccessFile.java
trunk/core/src/classpath/java/java/io/Reader.java
trunk/core/src/classpath/java/java/io/SequenceInputStream.java
trunk/core/src/classpath/java/java/io/Serializable.java
trunk/core/src/classpath/java/java/io/SerializablePermission.java
trunk/core/src/classpath/java/java/io/StreamCorruptedException.java
trunk/core/src/classpath/java/java/io/StreamTokenizer.java
trunk/core/src/classpath/java/java/io/StringBufferInputStream.java
trunk/core/src/classpath/java/java/io/StringReader.java
trunk/core/src/classpath/java/java/io/StringWriter.java
trunk/core/src/classpath/java/java/io/SyncFailedException.java
trunk/core/src/classpath/java/java/io/UTFDataFormatException.java
trunk/core/src/classpath/java/java/io/UnsupportedEncodingException.java
trunk/core/src/classpath/java/java/io/WriteAbortedException.java
trunk/core/src/classpath/java/java/io/Writer.java
trunk/core/src/classpath/java/java/io/class-dependencies.conf
trunk/core/src/classpath/java/java/io/package.html
Added: trunk/core/src/classpath/java/java/io/BufferedInputStream.java
===================================================================
--- trunk/core/src/classpath/java/java/io/BufferedInputStream.java (rev 0)
+++ trunk/core/src/classpath/java/java/io/BufferedInputStream.java 2006-12-12 21:09:56 UTC (rev 2896)
@@ -0,0 +1,379 @@
+/* BufferedInputStream.java -- An input stream that implements buffering
+ Copyright (C) 1998, 1999, 2001, 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.io;
+
+/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
+ * "The Java Language Specification", ISBN 0-201-63451-1
+ * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
+ * Status: Believed complete and correct.
+ */
+
+/**
+ * This subclass of <code>FilterInputStream</code> buffers input from an
+ * underlying implementation to provide a possibly more efficient read
+ * mechanism. It maintains the buffer and buffer state in instance
+ * variables that are available to subclasses. The default buffer size
+ * of 2048 bytes can be overridden by the creator of the stream.
+ * <p>
+ * This class also implements mark/reset functionality. It is capable
+ * of remembering any number of input bytes, to the limits of
+ * system memory or the size of <code>Integer.MAX_VALUE</code>
+ * <p>
+ * Please note that this class does not properly handle character
+ * encodings. Consider using the <code>BufferedReader</code> class which
+ * does.
+ *
+ * @author Aaron M. Renn (ar...@ur...)
+ * @author Warren Levy (wa...@cy...)
+ * @author Jeroen Frijters (je...@fr...)
+ */
+public class BufferedInputStream extends FilterInputStream
+{
+
+ /**
+ * This is the default buffer size
+ */
+ private static final int DEFAULT_BUFFER_SIZE = 2048;
+
+ /**
+ * The buffer used for storing data from the underlying stream.
+ */
+ protected byte[] buf;
+
+ /**
+ * The number of valid bytes currently in the buffer. It is also the index
+ * of the buffer position one byte past the end of the valid data.
+ */
+ protected int count;
+
+ /**
+ * The index of the next character that will by read from the buffer.
+ * When <code>pos == count</code>, the buffer is empty.
+ */
+ protected int pos;
+
+ /**
+ * The value of <code>pos</code> when the <code>mark()</code> method was
+ * called.
+ * This is set to -1 if there is no mark set.
+ */
+ protected int markpos = -1;
+
+ /**
+ * This is the maximum number of bytes than can be read after a
+ * call to <code>mark()</code> before the mark can be discarded.
+ * After this may bytes are read, the <code>reset()</code> method
+ * may not be called successfully.
+ */
+ protected int marklimit;
+
+ /**
+ * This is the initial buffer size. When the buffer is grown because
+ * of marking requirements, it will be grown by bufferSize increments.
+ * The underlying stream will be read in chunks of bufferSize.
+ */
+ private final int bufferSize;
+
+ /**
+ * This method initializes a new <code>BufferedInputStream</code> that will
+ * read from the specified subordinate stream with a default buffer size
+ * of 2048 bytes
+ *
+ * @param in The subordinate stream to read from
+ */
+ public BufferedInputStream(InputStream in)
+ {
+ this(in, DEFAULT_BUFFER_SIZE);
+ }
+
+ /**
+ * This method initializes a new <code>BufferedInputStream</code> that will
+ * read from the specified subordinate stream with a buffer size that
+ * is specified by the caller.
+ *
+ * @param in The subordinate stream to read from
+ * @param size The buffer size to use
+ *
+ * @exception IllegalArgumentException when size is smaller then 1
+ */
+ public BufferedInputStream(InputStream in, int size)
+ {
+ super(in);
+ if (size <= 0)
+ throw new IllegalArgumentException();
+ buf = new byte[size];
+ // initialize pos & count to bufferSize, to prevent refill from
+ // allocating a new buffer (if the caller starts out by calling mark()).
+ pos = count = bufferSize = size;
+ }
+
+ /**
+ * This method returns the number of bytes that can be read from this
+ * stream before a read can block. A return of 0 indicates that blocking
+ * might (or might not) occur on the very next read attempt.
+ * <p>
+ * The number of available bytes will be the number of read ahead bytes
+ * stored in the internal buffer plus the number of available bytes in
+ * the underlying stream.
+ *
+ * @return The number of bytes that can be read before blocking could occur
+ *
+ * @exception IOException If an error occurs
+ */
+ public synchronized int available() throws IOException
+ {
+ return count - pos + super.available();
+ }
+
+ /**
+ * This method closes the underlying input stream and frees any
+ * resources associated with it. Sets <code>buf</code> to <code>null</code>.
+ *
+ * @exception IOException If an error occurs.
+ */
+ public void close() throws IOException
+ {
+ // Free up the array memory.
+ buf = null;
+ pos = count = 0;
+ markpos = -1;
+ super.close();
+ }
+
+ /**
+ * This method marks a position in the input to which the stream can be
+ * "reset" by calling the <code>reset()</code> method. The parameter
+ * <code>readlimit</code> is the number of bytes that can be read from the
+ * stream after setting the mark before the mark becomes invalid. For
+ * example, if <code>mark()</code> is called with a read limit of 10, then
+ * when 11 bytes of data are read from the stream before the
+ * <code>reset()</code> method is called, then the mark is invalid and the
+ * stream object instance is not required to remember the mark.
+ * <p>
+ * Note that the number of bytes that can be remembered by this method
+ * can be greater than the size of the internal read buffer. It is also
+ * not dependent on the subordinate stream supporting mark/reset
+ * functionality.
+ *
+ * @param readlimit The number of bytes that can be read before the mark
+ * becomes invalid
+ */
+ public synchronized void mark(int readlimit)
+ {
+ marklimit = readlimit;
+ markpos = pos;
+ }
+
+ /**
+ * This method returns <code>true</code> to indicate that this class
+ * supports mark/reset functionality.
+ *
+ * @return <code>true</code> to indicate that mark/reset functionality is
+ * supported
+ *
+ */
+ public boolean markSupported()
+ {
+ return true;
+ }
+
+ /**
+ * This method reads an unsigned byte from the input stream and returns it
+ * as an int in the range of 0-255. This method also will return -1 if
+ * the end of the stream has been reached.
+ * <p>
+ * This method will block until the byte can be read.
+ *
+ * @return The byte read or -1 if end of stream
+ *
+ * @exception IOException If an error occurs
+ */
+ public synchronized int read() throws IOException
+ {
+ if (pos >= count && !refill())
+ return -1; // EOF
+
+ return buf[pos++] & 0xFF;
+ }
+
+ /**
+ * This method reads bytes from a stream and stores them into a caller
+ * supplied buffer. It starts storing the data at index <code>off</code>
+ * into the buffer and attempts to read <code>len</code> bytes. This method
+ * can return before reading the number of bytes requested, but it will try
+ * to read the requested number of bytes by repeatedly calling the underlying
+ * stream as long as available() for this stream continues to return a
+ * non-zero value (or until the requested number of bytes have been read).
+ * The actual number of bytes read is returned as an int. A -1 is returned
+ * to indicate the end of the stream.
+ * <p>
+ * This method will block until some data can be read.
+ *
+ * @param b The array into which the bytes read should be stored
+ * @param off The offset into the array to start storing bytes
+ * @param len The requested number of bytes to read
+ *
+ * @return The actual number of bytes read, or -1 if end of stream.
+ *
+ * @exception IOException If an error occurs.
+ * @exception IndexOutOfBoundsException when <code>off</code> or
+ * <code>len</code> are negative, or when <code>off + len</code>
+ * is larger then the size of <code>b</code>,
+ */
+ public synchronized int read(byte[] b, int off, int len) throws IOException
+ {
+ if (off < 0 || len < 0 || b.length - off < len)
+ throw new IndexOutOfBoundsException();
+
+ if (len == 0)
+ return 0;
+
+ if (pos >= count && !refill())
+ return -1; // No bytes were read before EOF.
+
+ int totalBytesRead = Math.min(count - pos, len);
+ System.arraycopy(buf, pos, b, off, totalBytesRead);
+ pos += totalBytesRead;
+ off += totalBytesRead;
+ len -= totalBytesRead;
+
+ while (len > 0 && super.available() > 0 && refill())
+ {
+ int remain = Math.min(count - pos, len);
+ System.arraycopy(buf, pos, b, off, remain);
+ pos += remain;
+ off += remain;
+ len -= remain;
+ totalBytesRead += remain;
+ }
+
+ return totalBytesRead;
+ }
+
+ /**
+ * This method resets a stream to the point where the <code>mark()</code>
+ * method was called. Any bytes that were read after the mark point was
+ * set will be re-read during subsequent reads.
+ * <p>
+ * This method will throw an IOException if the number of bytes read from
+ * the stream since the call to <code>mark()</code> exceeds the mark limit
+ * passed when establishing the mark.
+ *
+ * @exception IOException If <code>mark()</code> was never called or more
+ * then <code>marklimit</code> bytes were read since the last
+ * call to <code>mark()</code>
+ */
+ public synchronized void reset() throws IOException
+ {
+ if (markpos == -1)
+ throw new IOException(buf == null ? "Stream closed." : "Invalid mark.");
+
+ pos = markpos;
+ }
+
+ /**
+ * This method skips the specified number of bytes in the stream. It
+ * returns the actual number of bytes skipped, which may be less than the
+ * requested amount.
+ *
+ * @param n The requested number of bytes to skip
+ *
+ * @return The actual number of bytes skipped.
+ *
+ * @exception IOException If an error occurs
+ */
+ public synchronized long skip(long n) throws IOException
+ {
+ if (buf == null)
+ throw new IOException("Stream closed.");
+
+ final long origN = n;
+
+ while (n > 0L)
+ {
+ if (pos >= count && !refill())
+ break;
+
+ int numread = (int) Math.min((long) (count - pos), n);
+ pos += numread;
+ n -= numread;
+ }
+
+ return origN - n;
+ }
+
+ /**
+ * Called to refill the buffer (when count is equal to pos).
+ *
+ * @return <code>true</code> when at least one additional byte was read
+ * into <code>buf</code>, <code>false</code> otherwise (at EOF).
+ */
+ private boolean refill() throws IOException
+ {
+ if (buf == null)
+ throw new IOException("Stream closed.");
+
+ if (markpos == -1 || count - markpos >= marklimit)
+ {
+ markpos = -1;
+ pos = count = 0;
+ }
+ else
+ {
+ byte[] newbuf = buf;
+ if (markpos < bufferSize)
+ {
+ newbuf = new byte[count - markpos + bufferSize];
+ }
+ System.arraycopy(buf, markpos, newbuf, 0, count - markpos);
+ buf = newbuf;
+ count -= markpos;
+ pos -= markpos;
+ markpos = 0;
+ }
+
+ int numread = super.read(buf, count, bufferSize);
+
+ if (numread <= 0) // EOF
+ return false;
+
+ count += numread;
+ return true;
+ }
+}
Added: trunk/core/src/classpath/java/java/io/BufferedOutputStream.java
===================================================================
--- trunk/core/src/classpath/java/java/io/BufferedOutputStream.java (rev 0)
+++ trunk/core/src/classpath/java/java/io/BufferedOutputStream.java 2006-12-12 21:09:56 UTC (rev 2896)
@@ -0,0 +1,192 @@
+/* BufferedOutputStream.java -- Buffer output into large blocks before writing
+ Copyright (C) 1998, 2000, 2003 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.io;
+
+/**
+ * This class accumulates bytes written in a buffer instead of immediately
+ * writing the data to the underlying output sink. The bytes are instead
+ * as one large block when the buffer is filled, or when the stream is
+ * closed or explicitly flushed. This mode operation can provide a more
+ * efficient mechanism for writing versus doing numerous small unbuffered
+ * writes.
+ *
+ * @author Aaron M. Renn (ar...@ur...)
+ */
+public class BufferedOutputStream extends FilterOutputStream
+{
+ /**
+ * This is the default buffer size
+ */
+ private static final int DEFAULT_BUFFER_SIZE = 512;
+
+ /**
+ * This is the internal byte array used for buffering output before
+ * writing it.
+ */
+ protected byte[] buf;
+
+ /**
+ * This is the number of bytes that are currently in the buffer and
+ * are waiting to be written to the underlying stream. It always points to
+ * the index into the buffer where the next byte of data will be stored
+ */
+ protected int count;
+
+ /**
+ * This method initializes a new <code>BufferedOutputStream</code> instance
+ * that will write to the specified subordinate <code>OutputStream</code>
+ * and which will use a default buffer size of 512 bytes.
+ *
+ * @param out The underlying <code>OutputStream</code> to write data to
+ */
+ public BufferedOutputStream(OutputStream out)
+ {
+ this(out, DEFAULT_BUFFER_SIZE);
+ }
+
+ /**
+ * This method initializes a new <code>BufferedOutputStream</code> instance
+ * that will write to the specified subordinate <code>OutputStream</code>
+ * and which will use the specified buffer size
+ *
+ * @param out The underlying <code>OutputStream</code> to write data to
+ * @param size The size of the internal buffer
+ */
+ public BufferedOutputStream(OutputStream out, int size)
+ {
+ super(out);
+
+ buf = new byte[size];
+ }
+
+ /**
+ * This method causes any currently buffered bytes to be immediately
+ * written to the underlying output stream.
+ *
+ * @exception IOException If an error occurs
+ */
+ public synchronized void flush() throws IOException
+ {
+ if (count == 0)
+ return;
+
+ out.write(buf, 0, count);
+ count = 0;
+ out.flush();
+ }
+
+ /**
+ * This method flushes any remaining buffered bytes then closes the
+ * underlying output stream. Any further attempts to write to this stream
+ * may throw an exception
+ *
+ public synchronized void close() throws IOException
+ {
+ flush();
+ out.close();
+ }
+ */
+
+ /**
+ * This method runs when the object is garbage collected. It is
+ * responsible for ensuring that all buffered bytes are written and
+ * for closing the underlying stream.
+ *
+ * @exception IOException If an error occurs (ignored by the Java runtime)
+ *
+ protected void finalize() throws IOException
+ {
+ close();
+ }
+ */
+
+ /**
+ * This method writes a single byte of data. This will be written to the
+ * buffer instead of the underlying data source. However, if the buffer
+ * is filled as a result of this write request, it will be flushed to the
+ * underlying output stream.
+ *
+ * @param b The byte of data to be written, passed as an int
+ *
+ * @exception IOException If an error occurs
+ */
+ public synchronized void write(int b) throws IOException
+ {
+ if (count == buf.length)
+ flush();
+
+ buf[count] = (byte)(b & 0xFF);
+ ++count;
+ }
+
+ /**
+ * This method writes <code>len</code> bytes from the byte array
+ * <code>buf</code> starting at position <code>offset</code> in the buffer.
+ * These bytes will be written to the internal buffer. However, if this
+ * write operation fills the buffer, the buffer will be flushed to the
+ * underlying output stream.
+ *
+ * @param buf The array of bytes to write.
+ * @param offset The index into the byte array to start writing from.
+ * @param len The number of bytes to write.
+ *
+ * @exception IOException If an error occurs
+ */
+ public synchronized void write(byte[] buf, int offset, int len)
+ throws IOException
+ {
+ // Buffer can hold everything. Note that the case where LEN < 0
+ // is automatically handled by the downstream write.
+ if (len < (this.buf.length - count))
+ {
+ System.arraycopy(buf, offset, this.buf, count, len);
+ count += len;
+ }
+ else
+ {
+ // The write was too big. So flush the buffer and write the new
+ // bytes directly to the underlying stream, per the JDK 1.2
+ // docs.
+ flush();
+ out.write (buf, offset, len);
+ }
+ }
+
+} // class BufferedOutputStream
+
Added: trunk/core/src/classpath/java/java/io/BufferedReader.java
===================================================================
--- trunk/core/src/classpath/java/java/io/BufferedReader.java (rev 0)
+++ trunk/core/src/classpath/java/java/io/BufferedReader.java 2006-12-12 21:09:56 UTC (rev 2896)
@@ -0,0 +1,581 @@
+/* BufferedReader.java
+ 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.io;
+
+/* Written using "Java Class Libraries", 2nd edition, plus online
+ * API docs for JDK 1.2 beta from http://www.javasoft.com.
+ * Status: Believed complete and correct.
+ */
+
+/**
+ * This subclass of <code>FilterReader</code> buffers input from an
+ * underlying implementation to provide a possibly more efficient read
+ * mechanism. It maintains the buffer and buffer state in instance
+ * variables that are available to subclasses. The default buffer size
+ * of 8192 chars can be overridden by the creator of the stream.
+ * <p>
+ * This class also implements mark/reset functionality. It is capable
+ * of remembering any number of input chars, to the limits of
+ * system memory or the size of <code>Integer.MAX_VALUE</code>
+ *
+ * @author Per Bothner (bo...@cy...)
+ * @author Aaron M. Renn (ar...@ur...)
+ */
+public class BufferedReader extends Reader
+{
+ Reader in;
+ char[] buffer;
+ /* Index of current read position. Must be >= 0 and <= limit. */
+ /* There is a special case where pos may be equal to limit+1; this
+ * is used as an indicator that a readLine was done with a '\r' was
+ * the very last char in the buffer. Since we don't want to read-ahead
+ * and potentially block, we set pos this way to indicate the situation
+ * and deal with it later. Doing it this way rather than having a
+ * separate boolean field to indicate the condition has the advantage
+ * that it is self-clearing on things like mark/reset.
+ */
+ int pos;
+ /* Limit of valid data in buffer. Must be >= pos and <= buffer.length. */
+ /* This can be < pos in the one special case described above. */
+ int limit;
+
+ /* The value -1 means there is no mark, or the mark has been invalidated.
+ Otherwise, markPos is the index in the buffer of the marked position.
+ Must be >= 0 and <= pos.
+ Note we do not explicitly store the read-limit.
+ The implicit read-limit is (buffer.length - markPos), which is
+ guaranteed to be >= the read-limit requested in the call to mark. */
+ int markPos = -1;
+
+ // The JCL book specifies the default buffer size as 8K characters.
+ // This is package-private because it is used by LineNumberReader.
+ static final int DEFAULT_BUFFER_SIZE = 8192;
+
+ /**
+ * The line buffer for <code>readLine</code>.
+ */
+ private StringBuffer sbuf = null;
+
+ /**
+ * Create a new <code>BufferedReader</code> that will read from the
+ * specified subordinate stream with a default buffer size of 8192 chars.
+ *
+ * @param in The subordinate stream to read from
+ */
+ public BufferedRe...
[truncated message content] |
|
From: <ls...@us...> - 2007-01-07 08:32:01
|
Revision: 3011
http://jnode.svn.sourceforge.net/jnode/?rev=3011&view=rev
Author: lsantha
Date: 2007-01-07 00:31:59 -0800 (Sun, 07 Jan 2007)
Log Message:
-----------
Classpath patches.
Modified Paths:
--------------
trunk/core/src/classpath/java/java/applet/AppletContext.java
trunk/core/src/classpath/java/java/beans/BeanDescriptor.java
trunk/core/src/classpath/java/java/beans/Beans.java
trunk/core/src/classpath/java/java/beans/DefaultPersistenceDelegate.java
trunk/core/src/classpath/java/java/beans/DesignMode.java
trunk/core/src/classpath/java/java/beans/Encoder.java
trunk/core/src/classpath/java/java/beans/EventHandler.java
trunk/core/src/classpath/java/java/beans/EventSetDescriptor.java
trunk/core/src/classpath/java/java/beans/FeatureDescriptor.java
trunk/core/src/classpath/java/java/beans/IndexedPropertyDescriptor.java
trunk/core/src/classpath/java/java/beans/Introspector.java
trunk/core/src/classpath/java/java/beans/PersistenceDelegate.java
trunk/core/src/classpath/java/java/beans/PropertyDescriptor.java
trunk/core/src/classpath/java/java/beans/PropertyEditorManager.java
trunk/core/src/classpath/java/java/beans/SimpleBeanInfo.java
trunk/core/src/classpath/java/java/beans/Statement.java
trunk/core/src/classpath/java/java/beans/XMLEncoder.java
trunk/core/src/classpath/java/java/beans/beancontext/BeanContextServicesSupport.java
trunk/core/src/classpath/java/java/beans/beancontext/BeanContextSupport.java
trunk/core/src/classpath/java/java/lang/Math.java
trunk/core/src/classpath/java/java/lang/String.java
trunk/core/src/classpath/java/java/lang/instrument/ClassDefinition.java
trunk/core/src/classpath/java/java/lang/instrument/ClassFileTransformer.java
trunk/core/src/classpath/java/java/lang/ref/Reference.java
trunk/core/src/classpath/java/java/lang/ref/ReferenceQueue.java
trunk/core/src/classpath/java/java/sql/Array.java
trunk/core/src/classpath/java/java/sql/CallableStatement.java
trunk/core/src/classpath/java/java/sql/Connection.java
trunk/core/src/classpath/java/java/sql/DriverManager.java
trunk/core/src/classpath/java/java/sql/Ref.java
trunk/core/src/classpath/java/java/sql/ResultSet.java
trunk/core/src/classpath/java/java/sql/Struct.java
trunk/core/src/classpath/java/java/sql/Timestamp.java
trunk/core/src/classpath/java/java/text/AttributedCharacterIterator.java
trunk/core/src/classpath/java/java/text/AttributedString.java
trunk/core/src/classpath/java/java/text/AttributedStringIterator.java
trunk/core/src/classpath/java/java/text/Bidi.java
trunk/core/src/classpath/java/java/text/BreakIterator.java
trunk/core/src/classpath/java/java/text/CollationKey.java
trunk/core/src/classpath/java/java/text/Collator.java
trunk/core/src/classpath/java/java/text/DateFormatSymbols.java
trunk/core/src/classpath/java/java/text/DecimalFormat.java
trunk/core/src/classpath/java/java/text/DecimalFormatSymbols.java
trunk/core/src/classpath/java/java/text/MessageFormat.java
trunk/core/src/classpath/java/java/text/NumberFormat.java
trunk/core/src/classpath/java/java/util/AbstractCollection.java
trunk/core/src/classpath/java/java/util/AbstractMap.java
trunk/core/src/classpath/java/java/util/Arrays.java
trunk/core/src/classpath/java/java/util/Calendar.java
trunk/core/src/classpath/java/java/util/Collections.java
trunk/core/src/classpath/java/java/util/Currency.java
trunk/core/src/classpath/java/java/util/Date.java
trunk/core/src/classpath/java/java/util/Formatter.java
trunk/core/src/classpath/java/java/util/IdentityHashMap.java
trunk/core/src/classpath/java/java/util/LinkedList.java
trunk/core/src/classpath/java/java/util/ListResourceBundle.java
trunk/core/src/classpath/java/java/util/Locale.java
trunk/core/src/classpath/java/java/util/PriorityQueue.java
trunk/core/src/classpath/java/java/util/PropertyResourceBundle.java
trunk/core/src/classpath/java/java/util/ResourceBundle.java
trunk/core/src/classpath/java/java/util/StringTokenizer.java
trunk/core/src/classpath/java/java/util/TreeMap.java
trunk/core/src/classpath/java/java/util/TreeSet.java
trunk/core/src/classpath/java/java/util/UUID.java
trunk/core/src/classpath/java/java/util/Vector.java
trunk/core/src/classpath/java/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java
trunk/core/src/classpath/java/java/util/concurrent/locks/AbstractQueuedSynchronizer.java
trunk/core/src/classpath/java/java/util/logging/LogManager.java
Added Paths:
-----------
trunk/core/src/classpath/java/java/util/ServiceConfigurationError.java
trunk/core/src/classpath/java/java/util/ServiceLoader.java
Modified: trunk/core/src/classpath/java/java/applet/AppletContext.java
===================================================================
--- trunk/core/src/classpath/java/java/applet/AppletContext.java 2007-01-07 08:30:02 UTC (rev 3010)
+++ trunk/core/src/classpath/java/java/applet/AppletContext.java 2007-01-07 08:31:59 UTC (rev 3011)
@@ -52,7 +52,7 @@
*
* @author Aaron M. Renn (ar...@ur...)
* @since 1.0
- * @status updated to 1.4
+ * @status updated to 1.5
*/
public interface AppletContext
{
@@ -90,7 +90,7 @@
*
* @return a list of all the applets
*/
- Enumeration getApplets();
+ Enumeration<Applet> getApplets();
/**
* Displays the web page pointed to by the specified URL in the window
@@ -150,5 +150,5 @@
* @return an iterator over the association keys
* @since 1.4
*/
- Iterator getStreamKeys();
+ Iterator<String> getStreamKeys();
} // interface AppletContext
Modified: trunk/core/src/classpath/java/java/beans/BeanDescriptor.java
===================================================================
--- trunk/core/src/classpath/java/java/beans/BeanDescriptor.java 2007-01-07 08:30:02 UTC (rev 3010)
+++ trunk/core/src/classpath/java/java/beans/BeanDescriptor.java 2007-01-07 08:31:59 UTC (rev 3011)
@@ -48,14 +48,14 @@
**/
public class BeanDescriptor extends FeatureDescriptor {
- Class beanClass;
- Class customizerClass;
+ Class<?> beanClass;
+ Class<?> customizerClass;
/** Create a new BeanDescriptor with the given beanClass and
** no customizer class.
** @param beanClass the class of the Bean.
**/
- public BeanDescriptor(Class beanClass) {
+ public BeanDescriptor(Class<?> beanClass) {
this(beanClass,null);
}
@@ -64,7 +64,7 @@
** @param beanClass the class of the Bean.
** @param customizerClass the class of the Bean's Customizer.
**/
- public BeanDescriptor(Class beanClass, Class customizerClass) {
+ public BeanDescriptor(Class<?> beanClass, Class<?> customizerClass) {
this.beanClass = beanClass;
this.customizerClass = customizerClass;
@@ -78,12 +78,12 @@
}
/** Get the Bean's class. **/
- public Class getBeanClass() {
+ public Class<?> getBeanClass() {
return beanClass;
}
/** Get the Bean's customizer's class. **/
- public Class getCustomizerClass() {
+ public Class<?> getCustomizerClass() {
return customizerClass;
}
}
Modified: trunk/core/src/classpath/java/java/beans/Beans.java
===================================================================
--- trunk/core/src/classpath/java/java/beans/Beans.java 2007-01-07 08:30:02 UTC (rev 3010)
+++ trunk/core/src/classpath/java/java/beans/Beans.java 2007-01-07 08:31:59 UTC (rev 3011)
@@ -295,7 +295,7 @@
* @return the Bean as a new view, or if the operation
* could not be performed, the Bean itself.
*/
- public static Object getInstanceOf(Object bean, Class newClass)
+ public static Object getInstanceOf(Object bean, Class<?> newClass)
{
return bean;
}
@@ -314,7 +314,7 @@
* @return whether the Bean can be cast to the class type
* in question.
*/
- public static boolean isInstanceOf(Object bean, Class newBeanClass)
+ public static boolean isInstanceOf(Object bean, Class<?> newBeanClass)
{
return newBeanClass.isInstance(bean);
}
Modified: trunk/core/src/classpath/java/java/beans/DefaultPersistenceDelegate.java
===================================================================
--- trunk/core/src/classpath/java/java/beans/DefaultPersistenceDelegate.java 2007-01-07 08:30:02 UTC (rev 3010)
+++ trunk/core/src/classpath/java/java/beans/DefaultPersistenceDelegate.java 2007-01-07 08:31:59 UTC (rev 3011)
@@ -154,8 +154,8 @@
return new Expression(oldInstance, oldInstance.getClass(), "new", args);
}
- protected void initialize(Class type, Object oldInstance, Object newInstance,
- Encoder out)
+ protected void initialize(Class<?> type, Object oldInstance,
+ Object newInstance, Encoder out)
{
// Calling the supertype's implementation of initialize makes it
// possible that descendants of classes like AbstractHashMap
Modified: trunk/core/src/classpath/java/java/beans/DesignMode.java
===================================================================
--- trunk/core/src/classpath/java/java/beans/DesignMode.java 2007-01-07 08:30:02 UTC (rev 3010)
+++ trunk/core/src/classpath/java/java/beans/DesignMode.java 2007-01-07 08:31:59 UTC (rev 3011)
@@ -1,5 +1,5 @@
/* java.beans.DesignMode
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,8 @@
package java.beans;
/**
- * <code>BeanContextChild</code> implementors implement this to get information about whether they are in a design time or runtime environment.
+ * <code>BeanContextChild</code> implementors implement this to get information
+ * about whether they are in a design time or runtime environment.
* The reason this is restricted to <code>BeanContextChild</code>ren is that
* only things in the <code>BeanContext</code> hierarchy are given this
* information in the first place.
@@ -48,11 +49,11 @@
* @since JDK1.2
* @see java.beans.beancontext.BeanContextChild
*/
+public interface DesignMode
+{
-public interface DesignMode {
/**
* Use this name when firing <code>PropertyChangeEvent</code>s from your Bean.
- * @fixme Check whether PROPERTYNAME is set to same value as Sun.
*/
String PROPERTYNAME = "designTime";
@@ -78,7 +79,7 @@
* the BeanContext can <em>change</em> the status of the Bean from
* design time to runtime. But it appears that it may be so.
*
- * @see java.util.PropertyChangeEvent
+ * @see java.beans.PropertyChangeEvent
* @see java.beans.beancontext.BeanContext
* @see #PROPERTYNAME
*/
@@ -90,4 +91,5 @@
* runtime.
*/
boolean isDesignTime();
+
}
Modified: trunk/core/src/classpath/java/java/beans/Encoder.java
===================================================================
--- trunk/core/src/classpath/java/java/beans/Encoder.java 2007-01-07 08:30:02 UTC (rev 3010)
+++ trunk/core/src/classpath/java/java/beans/Encoder.java 2007-01-07 08:31:59 UTC (rev 3011)
@@ -181,7 +181,7 @@
return exceptionListener;
}
- public PersistenceDelegate getPersistenceDelegate(Class type)
+ public PersistenceDelegate getPersistenceDelegate(Class<?> type)
{
// This is not specified but the JDK behaves like this.
if (type == null)
@@ -215,7 +215,8 @@
* access is thread safe.
* </p>
*/
- public void setPersistenceDelegate(Class type, PersistenceDelegate delegate)
+ public void setPersistenceDelegate(Class<?> type,
+ PersistenceDelegate delegate)
{
// If the argument is null this will cause a NullPointerException
// which is expected behavior.
Modified: trunk/core/src/classpath/java/java/beans/EventHandler.java
===================================================================
--- trunk/core/src/classpath/java/java/beans/EventHandler.java 2007-01-07 08:30:02 UTC (rev 3010)
+++ trunk/core/src/classpath/java/java/beans/EventHandler.java 2007-01-07 08:31:59 UTC (rev 3011)
@@ -463,7 +463,8 @@
* @param action Target property or method to invoke.
* @return A constructed proxy object.
*/
- public static Object create(Class listenerInterface, Object target, String action)
+ public static <T> T create(Class<T> listenerInterface, Object target,
+ String action)
{
return create(listenerInterface, target, action, null, null);
}
@@ -552,7 +553,7 @@
* @param eventPropertyName Name of property to extract from event.
* @return A constructed proxy object.
*/
- public static Object create(Class listenerInterface, Object target,
+ public static <T> T create(Class<T> listenerInterface, Object target,
String action, String eventPropertyName)
{
return create(listenerInterface, target, action, eventPropertyName, null);
@@ -587,7 +588,7 @@
* @param listenerMethodName Listener method to implement.
* @return A constructed proxy object.
*/
- public static Object create(Class listenerInterface, Object target,
+ public static <T> T create(Class<T> listenerInterface, Object target,
String action, String eventPropertyName,
String listenerMethodName)
{
@@ -597,10 +598,9 @@
// Create proxy object passing in the event handler
Object proxy = Proxy.newProxyInstance(listenerInterface.getClassLoader(),
- new Class[] {listenerInterface},
+ new Class<?>[] {listenerInterface},
eh);
- return proxy;
+ return (T) proxy;
}
-
}
Modified: trunk/core/src/classpath/java/java/beans/EventSetDescriptor.java
===================================================================
--- trunk/core/src/classpath/java/java/beans/EventSetDescriptor.java 2007-01-07 08:30:02 UTC (rev 3010)
+++ trunk/core/src/classpath/java/java/beans/EventSetDescriptor.java 2007-01-07 08:31:59 UTC (rev 3011)
@@ -164,8 +164,8 @@
* if listenerType is not an EventListener, or if methods are not
* found or are invalid.
*/
- public EventSetDescriptor(Class eventSourceClass, String eventSetName,
- Class listenerType, String listenerMethodName)
+ public EventSetDescriptor(Class<?> eventSourceClass, String eventSetName,
+ Class<?> listenerType, String listenerMethodName)
throws IntrospectionException
{
setName(eventSetName);
@@ -225,8 +225,8 @@
* if listenerType is not an EventListener or if methods are not
* found or are invalid.
*/
- public EventSetDescriptor(Class eventSourceClass, String eventSetName,
- Class listenerType, String[] listenerMethodNames,
+ public EventSetDescriptor(Class<?> eventSourceClass, String eventSetName,
+ Class<?> listenerType, String[] listenerMethodNames,
String addListenerMethodName,
String removeListenerMethodName)
throws IntrospectionException
@@ -287,8 +287,8 @@
* found or are invalid.
* @since 1.4
*/
- public EventSetDescriptor(Class eventSourceClass, String eventSetName,
- Class listenerType, String[] listenerMethodNames,
+ public EventSetDescriptor(Class<?> eventSourceClass, String eventSetName,
+ Class<?> listenerType, String[] listenerMethodNames,
String addListenerMethodName,
String removeListenerMethodName,
String getListenerMethodName)
@@ -357,7 +357,7 @@
* methods are invalid.
* @since 1.4
*/
- public EventSetDescriptor(String eventSetName, Class listenerType,
+ public EventSetDescriptor(String eventSetName, Class<?> listenerType,
Method[] listenerMethods, Method addListenerMethod,
Method removeListenerMethod,
Method getListenerMethod)
@@ -402,7 +402,7 @@
* if the listenerType is not an EventListener, or any of the
* methods are invalid.
*/
- public EventSetDescriptor(String eventSetName, Class listenerType,
+ public EventSetDescriptor(String eventSetName, Class<?> listenerType,
Method[] listenerMethods, Method addListenerMethod,
Method removeListenerMethod)
throws IntrospectionException
@@ -449,7 +449,7 @@
* if the listenerType is not an EventListener, or any of the
* methods are invalid.
*/
- public EventSetDescriptor(String eventSetName, Class listenerType,
+ public EventSetDescriptor(String eventSetName, Class<?> listenerType,
MethodDescriptor[] listenerMethodDescriptors,
Method addListenerMethod,
Method removeListenerMethod)
@@ -484,7 +484,7 @@
/** Returns the class that contains the event firing methods.
*/
- public Class getListenerType()
+ public Class<?> getListenerType()
{
return listenerType;
}
Modified: trunk/core/src/classpath/java/java/beans/FeatureDescriptor.java
===================================================================
--- trunk/core/src/classpath/java/java/beans/FeatureDescriptor.java 2007-01-07 08:30:02 UTC (rev 3010)
+++ trunk/core/src/classpath/java/java/beans/FeatureDescriptor.java 2007-01-07 08:31:59 UTC (rev 3011)
@@ -68,14 +68,14 @@
boolean hidden;
boolean preferred;
- Hashtable valueHash;
+ Hashtable<String,Object> valueHash;
/**
* Instantiate this FeatureDescriptor with appropriate default values.
*/
public FeatureDescriptor()
{
- valueHash = new Hashtable();
+ valueHash = new Hashtable<String,Object>();
}
/**
@@ -225,7 +225,7 @@
* @return an Enumerator over all the programmatic key names associated
* with this feature.
*/
- public Enumeration attributeNames()
+ public Enumeration<String> attributeNames()
{
return valueHash.keys();
}
Modified: trunk/core/src/classpath/java/java/beans/IndexedPropertyDescriptor.java
===================================================================
--- trunk/core/src/classpath/java/java/beans/IndexedPropertyDescriptor.java 2007-01-07 08:30:02 UTC (rev 3010)
+++ trunk/core/src/classpath/java/java/beans/IndexedPropertyDescriptor.java 2007-01-07 08:31:59 UTC (rev 3011)
@@ -76,7 +76,7 @@
*/
public class IndexedPropertyDescriptor extends PropertyDescriptor
{
- private Class indexedPropertyType;
+ private Class<?> indexedPropertyType;
private Method setIndex;
private Method getIndex;
@@ -112,7 +112,7 @@
* @exception IntrospectionException if the methods are not found or
* invalid.
*/
- public IndexedPropertyDescriptor(String name, Class beanClass)
+ public IndexedPropertyDescriptor(String name, Class<?> beanClass)
throws IntrospectionException
{
super(name);
@@ -161,7 +161,7 @@
*
* @exception IntrospectionException if the methods are not found or invalid.
*/
- public IndexedPropertyDescriptor(String name, Class beanClass,
+ public IndexedPropertyDescriptor(String name, Class<?> beanClass,
String getMethodName, String setMethodName,
String getIndexName, String setIndexName)
throws IntrospectionException
@@ -272,7 +272,7 @@
: Array.newInstance(this.indexedPropertyType,0).getClass());
}
- public Class getIndexedPropertyType()
+ public Class<?> getIndexedPropertyType()
{
return indexedPropertyType;
}
Modified: trunk/core/src/classpath/java/java/beans/Introspector.java
===================================================================
--- trunk/core/src/classpath/java/java/beans/Introspector.java 2007-01-07 08:30:02 UTC (rev 3010)
+++ trunk/core/src/classpath/java/java/beans/Introspector.java 2007-01-07 08:31:59 UTC (rev 3011)
@@ -182,7 +182,8 @@
public static final int IGNORE_ALL_BEANINFO = 3;
static String[] beanInfoSearchPath = {"gnu.java.beans.info"};
- static Hashtable beanInfoCache = new Hashtable();
+ static Hashtable<Class<?>,BeanInfo> beanInfoCache =
+ new Hashtable<Class<?>,BeanInfo>();
private Introspector() {}
@@ -195,13 +196,13 @@
* @param beanClass the class to get BeanInfo about.
* @return the BeanInfo object representing the class.
*/
- public static BeanInfo getBeanInfo(Class beanClass)
+ public static BeanInfo getBeanInfo(Class<?> beanClass)
throws IntrospectionException
{
BeanInfo cachedInfo;
synchronized(beanClass)
{
- cachedInfo = (BeanInfo)beanInfoCache.get(beanClass);
+ cachedInfo = beanInfoCache.get(beanClass);
if(cachedInfo != null)
{
return cachedInfo;
@@ -245,7 +246,7 @@
* @throws IntrospectionException If something goes wrong while retrieving
* the bean data.
*/
- public static BeanInfo getBeanInfo(Class beanClass, int flag)
+ public static BeanInfo getBeanInfo(Class<?> beanClass, int flag)
throws IntrospectionException
{
IntrospectionIncubator ii;
@@ -312,7 +313,7 @@
* @throws NullPointerException if clz is null.
* @since 1.2
*/
- public static void flushFromCaches(Class clz)
+ public static void flushFromCaches(Class<?> clz)
{
synchronized (clz)
{
@@ -394,7 +395,7 @@
* @param stopClass the class to stop at.
* @return the BeanInfo object representing the class.
*/
- public static BeanInfo getBeanInfo(Class beanClass, Class stopClass)
+ public static BeanInfo getBeanInfo(Class<?> beanClass, Class<?> stopClass)
throws IntrospectionException
{
ExplicitInfo explicit = new ExplicitInfo(beanClass, stopClass);
Modified: trunk/core/src/classpath/java/java/beans/PersistenceDelegate.java
===================================================================
--- trunk/core/src/classpath/java/java/beans/PersistenceDelegate.java 2007-01-07 08:30:02 UTC (rev 3010)
+++ trunk/core/src/classpath/java/java/beans/PersistenceDelegate.java 2007-01-07 08:31:59 UTC (rev 3011)
@@ -52,8 +52,8 @@
public abstract class PersistenceDelegate
{
- protected void initialize(Class type, Object oldInstance, Object newInstance,
- Encoder out)
+ protected void initialize(Class<?> type, Object oldInstance,
+ Object newInstance, Encoder out)
{
if (type != Object.class)
{
Modified: trunk/core/src/classpath/java/java/beans/PropertyDescriptor.java
===================================================================
--- trunk/core/src/classpath/java/java/beans/PropertyDescriptor.java 2007-01-07 08:30:02 UTC (rev 3010)
+++ trunk/core/src/classpath/java/java/beans/PropertyDescriptor.java 2007-01-07 08:31:59 UTC (rev 3011)
@@ -65,11 +65,11 @@
**/
public class PropertyDescriptor extends FeatureDescriptor
{
- Class propertyType;
+ Class<?> propertyType;
Method getMethod;
Method setMethod;
- Class propertyEditorClass;
+ Class<?> propertyEditorClass;
boolean bound;
boolean constrained;
@@ -103,7 +103,7 @@
** @exception IntrospectionException if the methods are not found
** or invalid.
**/
- public PropertyDescriptor(String name, Class beanClass)
+ public PropertyDescriptor(String name, Class<?> beanClass)
throws IntrospectionException
{
setName(name);
@@ -159,7 +159,7 @@
**/
public PropertyDescriptor(
String name,
- Class beanClass,
+ Class<?> beanClass,
String getMethodName,
String setMethodName)
throws IntrospectionException
@@ -213,7 +213,7 @@
** This is the type the get method returns and the set method
** takes in.
**/
- public Class getPropertyType()
+ public Class<?> getPropertyType()
{
return propertyType;
}
@@ -330,7 +330,7 @@
}
/** Get the PropertyEditor class. Defaults to null. **/
- public Class getPropertyEditorClass()
+ public Class<?> getPropertyEditorClass()
{
return propertyEditorClass;
}
@@ -341,7 +341,7 @@
** @param propertyEditorClass the PropertyEditor class for this
** class to use.
**/
- public void setPropertyEditorClass(Class propertyEditorClass)
+ public void setPropertyEditorClass(Class<?> propertyEditorClass)
{
this.propertyEditorClass = propertyEditorClass;
}
@@ -516,10 +516,10 @@
* @return The common property type of the two method.
* @throws IntrospectionException If any of the above requirements are not met.
*/
- private Class checkMethods(Method readMethod, Method writeMethod)
+ private Class<?> checkMethods(Method readMethod, Method writeMethod)
throws IntrospectionException
{
- Class newPropertyType = propertyType;
+ Class<?> newPropertyType = propertyType;
// a valid read method has zero arguments and a non-void return type.
if (readMethod != null)
Modified: trunk/core/src/classpath/java/java/beans/PropertyEditorManager.java
===================================================================
--- trunk/core/src/classpath/java/java/beans/PropertyEditorManager.java 2007-01-07 08:30:02 UTC (rev 3010)
+++ trunk/core/src/classpath/java/java/beans/PropertyEditorManager.java 2007-01-07 08:31:59 UTC (rev 3011)
@@ -83,7 +83,8 @@
public class PropertyEditorManager
{
- static java.util.Hashtable editors = new java.util.Hashtable();
+ static java.util.Hashtable<Class<?>,Class<?>> editors =
+ new java.util.Hashtable<Class<?>,Class<?>>();
static String[] editorSearchPath = { "gnu.java.beans.editors",
"sun.beans.editors" };
@@ -118,7 +119,7 @@
* will edit.
* @param editorClass the PropertyEditor class.
*/
- public static void registerEditor(Class editedClass, Class editorClass)
+ public static void registerEditor(Class<?> editedClass, Class<?> editorClass)
{
editors.put(editedClass, editorClass);
}
@@ -132,7 +133,7 @@
* @return a PropertyEditor instance that can edit the
* specified class.
*/
- public static PropertyEditor findEditor(Class editedClass)
+ public static PropertyEditor findEditor(Class<?> editedClass)
{
try
{
Modified: trunk/core/src/classpath/java/java/beans/SimpleBeanInfo.java
===================================================================
--- trunk/core/src/classpath/java/java/beans/SimpleBeanInfo.java 2007-01-07 08:30:02 UTC (rev 3010)
+++ trunk/core/src/classpath/java/java/beans/SimpleBeanInfo.java 2007-01-07 08:31:59 UTC (rev 3011)
@@ -1,5 +1,5 @@
/* java.beans.SimpleBeanInfo
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,6 +40,7 @@
import java.awt.Image;
import java.awt.Toolkit;
+import java.net.URL;
/**
** SimpleBeanInfo is a class you may extend to more easily
@@ -130,10 +131,16 @@
** and its BeanInfo are both loaded by the same
** ClassLoader, generally a reasonable assumption.
** @param location the URL relative
- ** @return the Image in question.
+ ** @return the Image in question (possibly <code>null</code>).
**/
- public Image loadImage(String location) {
- return Toolkit.getDefaultToolkit().getImage(getClass().getResource(location));
+ public Image loadImage(String location)
+ {
+ if (location == null)
+ return null;
+ URL url = getClass().getResource(location);
+ if (url == null)
+ return null;
+ return Toolkit.getDefaultToolkit().getImage(url);
}
}
Modified: trunk/core/src/classpath/java/java/beans/Statement.java
===================================================================
--- trunk/core/src/classpath/java/java/beans/Statement.java 2007-01-07 08:30:02 UTC (rev 3010)
+++ trunk/core/src/classpath/java/java/beans/Statement.java 2007-01-07 08:31:59 UTC (rev 3011)
@@ -1,5 +1,5 @@
/* Statement.java
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -346,16 +346,20 @@
/** Return the statement object. */
public Object getTarget() { return target; }
- /** Return a string representation. */
+ /**
+ * Returns a string representation of this <code>Statement</code>.
+ *
+ * @return A string representation of this <code>Statement</code>.
+ */
public String toString()
{
StringBuffer result = new StringBuffer();
- String targetName = target.getClass().getName();
- if ( targetName.startsWith("java"))
- {
- targetName = targetName.substring(targetName.lastIndexOf('.') + 1);
- }
+ String targetName;
+ if (target != null)
+ targetName = target.getClass().getSimpleName();
+ else
+ targetName = "null";
result.append(targetName);
result.append(".");
@@ -369,10 +373,10 @@
result.append(
( arguments[i] == null ) ? "null" :
( arguments[i] instanceof String ) ? "\"" + arguments[i] + "\"" :
- arguments[i].getClass().getName());
+ arguments[i].getClass().getSimpleName());
sep = ", ";
}
- result.append(")");
+ result.append(");");
return result.toString();
}
Modified: trunk/core/src/classpath/java/java/beans/XMLEncoder.java
===================================================================
--- trunk/core/src/classpath/java/java/beans/XMLEncoder.java 2007-01-07 08:30:02 UTC (rev 3010)
+++ trunk/core/src/classpath/java/java/beans/XMLEncoder.java 2007-01-07 08:31:59 UTC (rev 3011)
@@ -248,7 +248,7 @@
scanEngine.writeObject(o);
- if (get(o) == null);
+ if (get(o) == null)
super.writeObject(o);
accessCounter--;
Modified: trunk/core/src/classpath/java/java/beans/beancontext/BeanContextServicesSupport.java
===================================================================
--- trunk/core/src/classpath/java/java/beans/beancontext/BeanContextServicesSupport.java 2007-01-07 08:30:02 UTC (rev 3010)
+++ trunk/core/src/classpath/java/java/beans/beancontext/BeanContextServicesSupport.java 2007-01-...
[truncated message content] |
|
From: <ls...@us...> - 2007-01-07 12:54:17
|
Revision: 3023
http://jnode.svn.sourceforge.net/jnode/?rev=3023&view=rev
Author: lsantha
Date: 2007-01-07 04:54:15 -0800 (Sun, 07 Jan 2007)
Log Message:
-----------
Classpath patches.
Modified Paths:
--------------
trunk/core/src/classpath/java/java/io/StreamTokenizer.java
trunk/core/src/classpath/java/java/net/URI.java
trunk/core/src/classpath/java/java/rmi/activation/ActivationID.java
trunk/core/src/classpath/java/java/rmi/server/LoaderHandler.java
trunk/core/src/classpath/java/java/rmi/server/RMIClassLoader.java
trunk/core/src/classpath/java/java/rmi/server/RMIClassLoaderSpi.java
trunk/core/src/classpath/java/java/rmi/server/UnicastRemoteObject.java
trunk/core/src/classpath/java/java/security/AccessController.java
trunk/core/src/classpath/java/java/security/MessageDigest.java
trunk/core/src/classpath/java/java/security/MessageDigestSpi.java
trunk/core/src/classpath/java/java/security/Signature.java
trunk/core/src/classpath/java/java/security/SignatureSpi.java
trunk/core/src/classpath/java/java/security/UnresolvedPermission.java
trunk/core/src/classpath/java/java/security/acl/Acl.java
trunk/core/src/classpath/java/java/security/acl/AclEntry.java
trunk/core/src/classpath/java/java/security/acl/Group.java
trunk/core/src/classpath/java/java/security/cert/CertPath.java
trunk/core/src/classpath/java/java/security/cert/CertStore.java
trunk/core/src/classpath/java/java/security/cert/CertStoreSpi.java
trunk/core/src/classpath/java/java/security/cert/CertificateFactory.java
trunk/core/src/classpath/java/java/security/cert/CertificateFactorySpi.java
trunk/core/src/classpath/java/java/security/cert/CollectionCertStoreParameters.java
trunk/core/src/classpath/java/java/security/cert/PKIXBuilderParameters.java
trunk/core/src/classpath/java/java/security/cert/PKIXCertPathChecker.java
trunk/core/src/classpath/java/java/security/cert/PKIXParameters.java
trunk/core/src/classpath/java/java/security/cert/PolicyNode.java
trunk/core/src/classpath/java/java/security/cert/PolicyQualifierInfo.java
trunk/core/src/classpath/java/java/security/cert/X509CRL.java
trunk/core/src/classpath/java/java/security/cert/X509CRLSelector.java
trunk/core/src/classpath/java/java/security/cert/X509CertSelector.java
trunk/core/src/classpath/java/java/security/cert/X509Certificate.java
trunk/core/src/classpath/java/java/security/cert/X509Extension.java
trunk/core/src/classpath/java/java/util/zip/Deflater.java
Added Paths:
-----------
trunk/core/src/classpath/java/java/awt/datatransfer/MimeType.java
trunk/core/src/classpath/java/java/beans/ConstructorProperties.java
trunk/core/src/classpath/java/java/math/RoundingMode.java
trunk/core/src/classpath/java/java/net/Proxy.java
trunk/core/src/classpath/java/java/net/ProxySelector.java
trunk/core/src/classpath/java/java/net/ResolverCache.java
Added: trunk/core/src/classpath/java/java/awt/datatransfer/MimeType.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/datatransfer/MimeType.java (rev 0)
+++ trunk/core/src/classpath/java/java/awt/datatransfer/MimeType.java 2007-01-07 12:54:15 UTC (rev 3023)
@@ -0,0 +1,281 @@
+/* MimeType.java -- A helper class for mime handling in DataFlavor
+ Copyright (C) 2006 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.awt.datatransfer;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+/**
+ * A helper class for mime handling in DataFlavor.
+ *
+ * A Mauve test for DataFlavor.writeExternal() shows that a non-public
+ * class java.awt.datatransfer.MimeType gets serialized. This class
+ * is mainly here for serialization compatibility. Of course,
+ * now that we have it here, we can just as well implement some
+ * mime handling facility here.
+ */
+class MimeType
+ implements Externalizable
+{
+
+ /**
+ * The primary type.
+ */
+ private String primaryType;
+
+ /**
+ * The subtype.
+ */
+ private String subType;
+
+ /**
+ * Additional parameters to be appended to the mime string.
+ */
+ private HashMap parameters;
+
+ /**
+ * This is only here for deserialization.
+ */
+ public MimeType()
+ {
+ parameters = new HashMap();
+ }
+
+ /**
+ * Creates a new MimeType object.
+ *
+ * @param mime the mime type
+ */
+ MimeType(String mime)
+ throws MimeTypeParseException
+ {
+ this();
+ parse(mime);
+ }
+
+ /**
+ * Adds a mime parameter.
+ *
+ * @param param the parameter key
+ * @param value the parameter value
+ */
+ void addParameter(String param, String value)
+ {
+ parameters.put(param, value);
+ }
+
+ /**
+ * Removes the parameter with the specified key.
+ *
+ * @param param the parameter to remove
+ */
+ void removeParameter(String param)
+ {
+ parameters.remove(param);
+ }
+
+ /**
+ * Returns the parameter for the <code>key</code>.
+ *
+ * @param key the parameter key
+ *
+ * @return the parameter for the <code>key</code>
+ */
+ String getParameter(String key)
+ {
+ return (String) parameters.get(key);
+ }
+
+ /**
+ * Returns the primary type.
+ *
+ * @return the primary type
+ */
+ String getPrimaryType()
+ {
+ return primaryType;
+ }
+
+ String getSubType()
+ {
+ return subType;
+ }
+
+ /**
+ * Returns the base type of this mime type. This is the primary
+ * type plus the subtype, separated by '/'.
+ *
+ * @return the base type of this mime type
+ */
+ String getBaseType()
+ {
+ return primaryType + '/' + subType;
+ }
+
+ /**
+ * Returns <code>true</code> if this mime type and another mime type
+ * match. This will be true when their primary types are equal, and their
+ * subtypes are equal (or when either subtype is * ).
+ *
+ * @param other the other mime type
+ *
+ * @return <code>true</code> if the mime types match, <code>false</code>
+ * otherwise
+ */
+ boolean matches(MimeType other)
+ {
+ boolean match = false;
+ if (other != null)
+ {
+ match = primaryType.equals(other.primaryType)
+ && (subType.equals("*") || other.subType.equals("*")
+ || subType.equals(other.subType));
+ }
+ return match;
+ }
+
+ /**
+ * Serializes the mime type.
+ *
+ * @param in the input stream to read from
+ *
+ * @throws ClassNotFoundException not thrown here
+ * @throws IOException when something goes wrong on the input stream,
+ * or when the mime type can't be parsed
+ */
+ public void readExternal(ObjectInput in)
+ throws ClassNotFoundException, IOException
+ {
+ String mime = in.readUTF();
+ parameters.clear();
+ try
+ {
+ parse(mime);
+ }
+ catch (MimeTypeParseException ex)
+ {
+ IOException ioEx = new IOException();
+ ioEx.initCause(ex);
+ throw ioEx;
+ }
+ }
+
+ /**
+ * Serializes this mime type.
+ *
+ * @param out the output stream
+ *
+ * @throws IOException when something goes wrong on the output stream
+ */
+ public void writeExternal(ObjectOutput out)
+ throws IOException
+ {
+ out.writeUTF(toString());
+ }
+
+ /**
+ * Creates a string representation of this mime type.
+ *
+ * @return a string representation of this mime type
+ */
+ public String toString()
+ {
+ StringBuilder s = new StringBuilder();
+ s.append(primaryType);
+ s.append('/');
+ s.append(subType);
+ if (parameters.size() > 0)
+ {
+ Set entries = parameters.entrySet();
+ for (Iterator i = entries.iterator(); i.hasNext();)
+ {
+ s.append("; ");
+ Map.Entry entry = (Map.Entry) i.next();
+ s.append(entry.getKey());
+ s.append('=');
+ s.append(entry.getValue());
+ }
+ }
+ return s.toString();
+ }
+
+ /**
+ * Parses the specified mime type string and initializes the fields
+ * of this object.
+ *
+ * @param mime the mime type string
+ */
+ private void parse(String mime)
+ throws MimeTypeParseException
+ {
+ // FIXME: Maybe implement more sophisticated mime string parsing according
+ // to RFC 2045 and 2046.
+ StringTokenizer tokenizer = new StringTokenizer(mime);
+ try
+ {
+ primaryType = tokenizer.nextToken("/");
+ subType = tokenizer.nextToken("/;");
+ }
+ catch (NoSuchElementException ex)
+ {
+ throw new MimeTypeParseException("Expected / separator");
+ }
+
+ // Add any parameters.
+ while (tokenizer.hasMoreTokens())
+ {
+ String keyValuePair = tokenizer.nextToken(";");
+ int i = keyValuePair.indexOf('=');
+ if (i == -1)
+ throw new MimeTypeParseException("Expected = as parameter separator");
+ String key = keyValuePair.substring(0, i).trim();
+ String value = keyValuePair.substring(i + 1).trim();
+ parameters.put(key, value);
+ }
+ }
+
+}
Added: trunk/core/src/classpath/java/java/beans/ConstructorProperties.java
===================================================================
--- trunk/core/src/classpath/java/java/beans/ConstructorProperties.java (rev 0)
+++ trunk/core/src/classpath/java/java/beans/ConstructorProperties.java 2007-01-07 12:54:15 UTC (rev 3023)
@@ -0,0 +1,72 @@
+/* ConstructorProperties.java - Associate constructor params with props
+ 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 java.beans;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+
+/**
+ * An annotation used to associate the parameters of a
+ * constructor with the accessor methods that later provide
+ * access to these values. For example, the parameters of
+ * the constructor <code>Person(String name, int age)</code>
+ * may be linked to the bean's two accessors, <code>getName()</code>
+ * and <code>getAge()</code> using
+ * <code>@ConstructorProperties({"name","age"})</code>.
+ *
+ * @author Andrew John Hughes (gnu...@me...)
+ * @since 1.6
+ */
+@Documented @Retention(RUNTIME) @Target(CONSTRUCTOR)
+public @interface ConstructorProperties
+{
+
+ /**
+ * Contains the name of the accessor methods associated
+ * with each constructor parameter.
+ *
+ * @return the accessor method names corresponding to the
+ * constructor parameters.
+ */
+ String[] value();
+
+}
Modified: trunk/core/src/classpath/java/java/io/StreamTokenizer.java
===================================================================
--- trunk/core/src/classpath/java/java/io/StreamTokenizer.java 2007-01-07 12:53:02 UTC (rev 3022)
+++ trunk/core/src/classpath/java/java/io/StreamTokenizer.java 2007-01-07 12:54:15 UTC (rev 3023)
@@ -330,6 +330,7 @@
{
while ((ch = in.read()) != '\n' && ch != '\r' && ch != TT_EOF)
;
+
if (ch != TT_EOF)
in.unread(ch);
return nextToken(); // Recursive, but not too deep in normal cases
@@ -431,6 +432,7 @@
{
while ((ch = in.read()) != '\n' && ch != '\r' && ch != TT_EOF)
;
+
if (ch != TT_EOF)
in.unread(ch);
return nextToken(); // Recursive, but not too deep in normal cases.
Added: trunk/core/src/classpath/java/java/math/RoundingMode.java
===================================================================
--- trunk/core/src/classpath/java/java/math/RoundingMode.java (rev 0)
+++ trunk/core/src/classpath/java/java/math/RoundingMode.java 2007-01-07 12:54:15 UTC (rev 3023)
@@ -0,0 +1,89 @@
+/* RoundingMode.java -- An Enum to replace BigDecimal rounding constants.
+ Copyright (C) 1999, 2000, 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.math;
+
+/**
+ * An enum to specify rounding behaviour for numerical operations that may
+ * discard precision.
+ * @author Anthony Balkissoon abalkiss at redhat dot com
+ *
+ */
+public enum RoundingMode
+{
+ UP, DOWN, CEILING, FLOOR, HALF_UP, HALF_DOWN, HALF_EVEN, UNNECESSARY;
+
+ /**
+ * For compatability with Sun's JDK
+ */
+ private static final long serialVersionUID = 432302042773881265L;
+
+ /**
+ * Returns the RoundingMode object corresponding to the legacy rounding modes
+ * in BigDecimal.
+ * @param rm the legacy rounding mode
+ * @return the corresponding RoundingMode
+ */
+ public static RoundingMode valueOf(int rm)
+ {
+ switch (rm)
+ {
+ case BigDecimal.ROUND_CEILING:
+ return CEILING;
+ case BigDecimal.ROUND_FLOOR:
+ return FLOOR;
+ case BigDecimal.ROUND_DOWN:
+ return DOWN;
+ case BigDecimal.ROUND_UP:
+ return UP;
+ case BigDecimal.ROUND_HALF_UP:
+ return HALF_UP;
+ case BigDecimal.ROUND_HALF_DOWN:
+ return HALF_DOWN;
+ case BigDecimal.ROUND_HALF_EVEN:
+ return HALF_EVEN;
+ case BigDecimal.ROUND_UNNECESSARY:
+ return UNNECESSARY;
+ default:
+ throw new
+ IllegalArgumentException("invalid argument: " + rm +
+ ". Argument should be one of the " +
+ "rounding modes defined in BigDecimal.");
+ }
+ }
+}
Added: trunk/core/src/classpath/java/java/net/Proxy.java
===================================================================
--- trunk/core/src/classpath/java/java/net/Proxy.java (rev 0)
+++ trunk/core/src/classpath/java/java/net/Proxy.java 2007-01-07 12:54:15 UTC (rev 3023)
@@ -0,0 +1,137 @@
+/* Proxy.java -- Represends a proxy for a network connection
+ Copyright (C) 2006 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.net;
+
+
+/**
+ * Defines a proxy setting. This setting contains a type (https, socks,
+ * direct) and a socket address.
+ *
+ * @since 1.5
+ */
+public class Proxy
+{
+ /**
+ * Represents the proxy type.
+ */
+ public enum Type
+ {
+ DIRECT, HTTP, SOCKS;
+
+ /**
+ * For compatability with Sun's JDK
+ */
+ private static final long serialVersionUID = -2231209257930100533L;
+ }
+
+ public static final Proxy NO_PROXY = new Proxy(Type.DIRECT, null);
+
+ private Type type;
+ private SocketAddress address;
+
+ /**
+ * Creates a new <code>Proxy</code> object.
+ *
+ * @param type The type for this proxy
+ * @param address The address of this proxy
+ */
+ public Proxy(Type type, SocketAddress address)
+ {
+ this.type = type;
+ this.address = address;
+ }
+
+ /**
+ * Returns the socket address for this proxy object.
+ *
+ * @return the socket address
+ */
+ public SocketAddress address()
+ {
+ return address;
+ }
+
+ /**
+ * Returns the of this proxy instance.
+ *
+ * @return the type
+ *
+ * @see Type
+ */
+ public Type type()
+ {
+ return type;
+ }
+
+ /**
+ * Compares the given object with this object.
+ *
+ * @return <code>true</code> if both objects or equals,
+ * <code>false</code> otherwise.
+ */
+ public final boolean equals(Object obj)
+ {
+ if (! (obj instanceof Proxy))
+ return false;
+
+ Proxy tmp = (Proxy) obj;
+
+ return (type.equals(tmp.type)
+ && address.equals(tmp.address));
+ }
+
+ /**
+ * Returns the hashcode for this <code>Proxy</code> object.
+ *
+ * @return the hashcode
+ */
+ public final int hashCode()
+ {
+ return type.hashCode() ^ address.hashCode();
+ }
+
+ /**
+ * Returns a string representation of this <code>Proxy</code> object.
+ *
+ * @return the string
+ */
+ public String toString()
+ {
+ return type.toString() + ":" + address.toString();
+ }
+}
Added: trunk/core/src/classpath/java/java/net/ProxySelector.java
===================================================================
--- trunk/core/src/classpath/java/java/net/ProxySelector.java (rev 0)
+++ trunk/core/src/classpath/java/java/net/ProxySelector.java 2007-01-07 12:54:15 UTC (rev 3023)
@@ -0,0 +1,117 @@
+/* ProxySelector.java -- A proxy selector class
+ Copyright (C) 2006 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.net;
+
+import gnu.java.net.DefaultProxySelector;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * Class for handling proxies for different connections.
+ *
+ * @since 1.5
+ */
+public abstract class ProxySelector
+{
+ /**
+ * Default proxy selector.
+ */
+ private static ProxySelector defaultSelector = new DefaultProxySelector();
+
+ /**
+ * Creates a new <code>ProxySelector</code> object.
+ */
+ public ProxySelector()
+ {
+ // Do nothing here.
+ }
+
+ /**
+ * Returns the default proxy selector.
+ *
+ * @return the default proxy selector
+ *
+ * @throws SecurityException If a security manager is installed and it
+ * denies NetPermission("getProxySelector")
+ */
+ public static ProxySelector getDefault()
+ {
+ SecurityManager sm = System.getSecurityManager();
+
+ if (sm != null)
+ sm.checkPermission(new NetPermission("getProxySelector"));
+
+ return defaultSelector;
+ }
+
+ /**
+ * Sets the default proxy selector.
+ *
+ * @param selector the defualt proxy selector
+ *
+ * @throws SecurityException If a security manager is installed and it
+ * denies NetPermission("setProxySelector")
+ */
+ public static void setDefault(ProxySelector selector)
+ {
+ SecurityManager sm = System.getSecurityManager();
+
+ if (sm != null)
+ sm.checkPermission(new NetPermission("setProxySelector"));
+
+ defaultSelector = selector;
+ }
+
+ /**
+ * Signals to the selector that a proxy was no available.
+ *
+ * @throws IllegalArgumentException If one argument is null
+ */
+ public abstract void connectFailed(URI uri, SocketAddress address,
+ IOException exception);
+
+ /**
+ * Returns the list of proxy settings for a given URI.
+ *
+ * @return list of proxy settings
+ *
+ * @throws IllegalArgumentException If uri is null
+ */
+ public abstract List<Proxy> select(URI uri);
+}
Added: trunk/core/src/classpath/java/java/net/ResolverCache.java
===================================================================
--- trunk/core/src/classpath/java/java/net/ResolverCache.java (rev 0)
+++ trunk/core/src/classpath/java/java/net/ResolverCache.java 2007-01-07 12:54:15 UTC (rev 3023)
@@ -0,0 +1,269 @@
+/* ResolverCache.java -- A cache of resolver lookups for InetAddress.
+ Copyright (C) 2006 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.net;
+
+import java.security.Security;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+/**
+ * This class provides a cache of name service resolutions. By
+ * default successful resolutions are cached forever to guard
+ * against DNS spoofing attacks and failed resolutions are cached
+ * for 10 seconds to improve performance. The length of time that
+ * results remain in the cache is determined by the following
+ * security properties:
+ * <dl>
+ * <dt><code>networkaddress.cache.ttl</code></dt>
+ * <dd>
+ * This property specifies the length of time in seconds that
+ * successful resolutions remain in the cache. The default is
+ * -1, indicating to cache forever.
+ * </dd>
+ * <dt><code>networkaddress.cache.negative.ttl</code></dt>
+ * <dd>
+ * This property specifies the length of time in seconds that
+ * unsuccessful resolutions remain in the cache. The default
+ * is 10, indicating to cache for 10 seconds.
+ * </dd>
+ * In both cases, a value of -1 indicates to cache forever and a
+ * value of 0 indicates not to cache.
+ *
+ * @author Gary Benson (gb...@re...)
+ */
+class ResolverCache
+{
+ /**
+ * The time in seconds for which successful lookups are cached.
+ */
+ private static fi...
[truncated message content] |
|
From: <ls...@us...> - 2007-01-07 18:41:28
|
Revision: 3043
http://jnode.svn.sourceforge.net/jnode/?rev=3043&view=rev
Author: lsantha
Date: 2007-01-07 10:41:27 -0800 (Sun, 07 Jan 2007)
Log Message:
-----------
Classpath patches.
Modified Paths:
--------------
trunk/core/src/classpath/java/java/awt/AWTEvent.java
trunk/core/src/classpath/java/java/awt/AWTEventMulticaster.java
trunk/core/src/classpath/java/java/awt/AWTKeyStroke.java
trunk/core/src/classpath/java/java/awt/BasicStroke.java
trunk/core/src/classpath/java/java/awt/CardLayout.java
trunk/core/src/classpath/java/java/awt/FileDialog.java
trunk/core/src/classpath/java/java/awt/FlowLayout.java
trunk/core/src/classpath/java/java/awt/GridBagLayout.java
trunk/core/src/classpath/java/java/awt/GridLayout.java
trunk/core/src/classpath/java/java/awt/datatransfer/DataFlavor.java
trunk/core/src/classpath/java/java/awt/datatransfer/FlavorMap.java
trunk/core/src/classpath/java/java/awt/datatransfer/FlavorTable.java
trunk/core/src/classpath/java/java/awt/datatransfer/SystemFlavorMap.java
trunk/core/src/classpath/java/java/awt/event/ComponentEvent.java
trunk/core/src/classpath/java/java/awt/font/LineBreakMeasurer.java
trunk/core/src/classpath/java/java/awt/font/TextHitInfo.java
trunk/core/src/classpath/java/java/awt/font/TextLayout.java
trunk/core/src/classpath/java/java/awt/font/TextMeasurer.java
trunk/core/src/classpath/java/java/awt/geom/Arc2D.java
trunk/core/src/classpath/java/java/awt/geom/GeneralPath.java
trunk/core/src/classpath/java/java/awt/geom/RectangularShape.java
trunk/core/src/classpath/java/java/awt/geom/RoundRectangle2D.java
trunk/core/src/classpath/java/java/awt/print/PrinterJob.java
trunk/core/src/classpath/java/java/lang/Package.java
trunk/core/src/classpath/java/java/lang/Void.java
trunk/core/src/classpath/java/java/math/BigDecimal.java
trunk/core/src/classpath/java/java/math/BigInteger.java
trunk/core/src/classpath/java/java/math/MathContext.java
trunk/core/src/classpath/java/java/net/MimeTypeMapper.java
trunk/core/src/classpath/java/java/nio/channels/Channel.java
trunk/core/src/classpath/java/java/nio/channels/Selector.java
trunk/core/src/classpath/java/java/nio/channels/spi/AbstractSelectableChannel.java
trunk/core/src/classpath/java/java/nio/channels/spi/AbstractSelector.java
trunk/core/src/classpath/java/java/nio/charset/Charset.java
trunk/core/src/classpath/java/java/nio/charset/spi/CharsetProvider.java
trunk/core/src/classpath/java/java/security/AlgorithmParametersSpi.java
trunk/core/src/classpath/java/java/security/BasicPermission.java
trunk/core/src/classpath/java/java/security/IdentityScope.java
trunk/core/src/classpath/java/java/security/KeyFactorySpi.java
trunk/core/src/classpath/java/java/security/KeyStoreSpi.java
trunk/core/src/classpath/java/java/security/PermissionCollection.java
trunk/core/src/classpath/java/java/security/Permissions.java
trunk/core/src/classpath/java/java/security/Security.java
trunk/core/src/classpath/java/java/util/jar/Attributes.java
trunk/core/src/classpath/java/java/util/jar/JarEntry.java
trunk/core/src/classpath/java/java/util/jar/JarFile.java
trunk/core/src/classpath/java/java/util/jar/Manifest.java
trunk/core/src/classpath/java/java/util/regex/Matcher.java
trunk/core/src/classpath/java/java/util/regex/Pattern.java
trunk/core/src/classpath/java/java/util/zip/DeflaterEngine.java
trunk/core/src/classpath/java/java/util/zip/Inflater.java
trunk/core/src/classpath/java/java/util/zip/ZipFile.java
trunk/core/src/classpath/java/java/util/zip/ZipInputStream.java
Modified: trunk/core/src/classpath/java/java/awt/AWTEvent.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/AWTEvent.java 2007-01-07 18:39:36 UTC (rev 3042)
+++ trunk/core/src/classpath/java/java/awt/AWTEvent.java 2007-01-07 18:41:27 UTC (rev 3043)
@@ -262,9 +262,17 @@
*/
public String toString ()
{
+ String src;
+ if (source instanceof Component)
+ src = ((Component) source).getName();
+ else if (source instanceof MenuComponent)
+ src = ((MenuComponent) source).getName();
+ else if (source != null)
+ src = source.toString();
+ else
+ src = "null";
String string = getClass ().getName () + "[" + paramString () + "] on "
- + source;
-
+ + src;
return string;
}
Modified: trunk/core/src/classpath/java/java/awt/AWTEventMulticaster.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/AWTEventMulticaster.java 2007-01-07 18:39:36 UTC (rev 3042)
+++ trunk/core/src/classpath/java/java/awt/AWTEventMulticaster.java 2007-01-07 18:41:27 UTC (rev 3043)
@@ -1175,16 +1175,17 @@
* @throws IllegalArgumentException if type is Void.TYPE
* @since 1.4
*/
- public static EventListener[] getListeners(EventListener l, Class type)
+ public static <T extends EventListener> T[] getListeners(EventListener l,
+ Class<T> type)
{
- ArrayList list = new ArrayList();
+ ArrayList<EventListener> list = new ArrayList<EventListener>();
if (l instanceof AWTEventMulticaster)
((AWTEventMulticaster) l).getListeners(list, type);
else if (type.isInstance(l))
list.add(l);
EventListener[] r = (EventListener[]) Array.newInstance(type, list.size());
list.toArray(r);
- return r;
+ return (T[]) r;
}
/**
Modified: trunk/core/src/classpath/java/java/awt/AWTKeyStroke.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/AWTKeyStroke.java 2007-01-07 18:39:36 UTC (rev 3042)
+++ trunk/core/src/classpath/java/java/awt/AWTKeyStroke.java 2007-01-07 18:41:27 UTC (rev 3043)
@@ -1,5 +1,5 @@
/* AWTKeyStroke.java -- an immutable key stroke
- Copyright (C) 2002, 2004, 2005 Free Software Foundation
+ Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation
This file is part of GNU Classpath.
@@ -65,6 +65,7 @@
* no-arg constructor (of any accessibility).
*
* @author Eric Blake (eb...@em...)
+ * @author Andrew John Hughes (gnu...@me...)
* @see #getAWTKeyStroke(char)
* @since 1.4
* @status updated to 1.4
@@ -85,14 +86,16 @@
* under the assumption that garbage collection of a new keystroke is
* easy when we find the old one that it matches in the cache.
*/
- private static final LinkedHashMap cache = new LinkedHashMap(11, 0.75f, true)
+ private static final LinkedHashMap<AWTKeyStroke,AWTKeyStroke> cache =
+ new LinkedHashMap<AWTKeyStroke,AWTKeyStroke>(11, 0.75f, true)
{
/** The largest the keystroke cache can grow. */
private static final int MAX_CACHE_SIZE = 2048;
/** Prune stale entries. */
- protected boolean removeEldestEntry(Map.Entry eldest)
- { // XXX - FIXME Use Map.Entry, not just Entry as gcj 3.1 workaround.
+ protected boolean removeEldestEntry(Entry<AWTKeyStroke,AWTKeyStroke>
+ eldest)
+ {
return size() > MAX_CACHE_SIZE;
}
};
@@ -114,7 +117,7 @@
*
* @see #getAWTKeyStroke(String)
*/
- static final HashMap vktable = new HashMap();
+ static final HashMap<String,Object> vktable = new HashMap<String,Object>();
static
{
// Using reflection saves the hassle of keeping this in sync with KeyEvent,
@@ -229,7 +232,7 @@
* @throws IllegalArgumentException subclass doesn't have no-arg constructor
* @throws ClassCastException subclass doesn't extend AWTKeyStroke
*/
- protected static void registerSubclass(final Class subclass)
+ protected static void registerSubclass(final Class<?> subclass)
{
if (subclass == null)
throw new IllegalArgumentException();
@@ -252,7 +255,8 @@
throws NoSuchMethodException, InstantiationException,
IllegalAccessException, InvocationTargetException
{
- Constructor c = subclass.getDeclaredConstructor(null);
+ Constructor<?> c =
+ subclass.getDeclaredConstructor((Class<?>[])null);
c.setAccessible(true);
// Create a new instance, to make sure that we can, and
// to cause any ClassCastException.
@@ -595,7 +599,7 @@
*/
protected Object readResolve() throws ObjectStreamException
{
- AWTKeyStroke s = (AWTKeyStroke) cache.get(this);
+ AWTKeyStroke s = cache.get(this);
if (s != null)
return s;
cache.put(this, this);
Modified: trunk/core/src/classpath/java/java/awt/BasicStroke.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/BasicStroke.java 2007-01-07 18:39:36 UTC (rev 3042)
+++ trunk/core/src/classpath/java/java/awt/BasicStroke.java 2007-01-07 18:41:27 UTC (rev 3043)
@@ -761,9 +761,13 @@
p1 = new double[]{a.last.P2.getX(), a.last.P2.getY()};
dx = p1[0] - p0[0];
dy = p1[1] - p0[1];
+ if (dx != 0 && dy != 0)
+ {
l = Math.sqrt(dx * dx + dy * dy);
dx = (2.0/3.0)*width*dx/l;
dy = (2.0/3.0)*width*dy/l;
+ }
+
c1 = new Point2D.Double(p1[0] + dx, p1[1] + dy);
c2 = new Point2D.Double(b.P1.getX() + dx, b.P1.getY() + dy);
a.add(new CubicSegment(a.last.P2, c1, c2, b.P1));
Modified: trunk/core/src/classpath/java/java/awt/CardLayout.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/CardLayout.java 2007-01-07 18:39:36 UTC (rev 3042)
+++ trunk/core/src/classpath/java/java/awt/CardLayout.java 2007-01-07 18:41:27 UTC (rev 3043)
@@ -225,6 +225,8 @@
*/
public Dimension maximumLayoutSize (Container target)
{
+ if (target == null || target.ncomponents == 0)
+ return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
// The JCL says that this returns Integer.MAX_VALUE for both
// dimensions. But that just seems wrong to me.
return getSize (target, MAX);
@@ -350,6 +352,7 @@
}
}
((Component) target).setVisible (true);
+ parent.validate();
}
}
@@ -360,7 +363,7 @@
*/
public String toString ()
{
- return getClass ().getName () + "[" + hgap + "," + vgap + "]";
+ return getClass ().getName () + "[hgap=" + hgap + ",vgap=" + vgap + "]";
}
/**
@@ -400,11 +403,11 @@
{
if (comps[i].isVisible ())
{
- if (what == NEXT)
+ if (choice == i)
{
- choice = i + 1;
- if (choice == num)
- choice = 0;
+ // Do nothing if we're already looking at the right
+ // component.
+ return;
}
else if (what == PREV)
{
@@ -412,16 +415,19 @@
if (choice < 0)
choice = num - 1;
}
- else if (choice == i)
+ else if (what == NEXT)
{
- // Do nothing if we're already looking at the right
- // component.
- return;
+ choice = i + 1;
+ if (choice == num)
+ choice = 0;
}
comps[i].setVisible (false);
if (choice >= 0)
break;
+ } else
+ {
+ comps[i].setVisible(true);
}
}
Modified: trunk/core/src/classpath/java/java/awt/FileDialog.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/FileDialog.java 2007-01-07 18:39:36 UTC (rev 3042)
+++ trunk/core/src/classpath/java/java/awt/FileDialog.java 2007-01-07 18:41:27 UTC (rev 3043)
@@ -95,6 +95,11 @@
*/
private int mode;
+/**
+ * The number used to generate the name returned by getName.
+ */
+private static transient long next_file_dialog_number;
+
/*************************************************************************/
/*
@@ -300,7 +305,11 @@
public synchronized void
setFile(String file)
{
+ if ("".equals(file))
+ this.file = null;
+ else
this.file = file;
+
if (peer != null)
{
FileDialogPeer f = (FileDialogPeer) peer;
@@ -366,5 +375,22 @@
",mode=" + mode + "," + super.paramString());
}
+/**
+ * Generate a unique name for this <code>FileDialog</code>.
+ *
+ * @return A unique name for this <code>FileDialog</code>.
+ */
+String
+generateName()
+{
+ return "filedlg" + getUniqueLong();
+}
+
+private static synchronized long
+getUniqueLong()
+{
+ return next_file_dialog_number++;
+}
+
} // class FileDialog
Modified: trunk/core/src/classpath/java/java/awt/FlowLayout.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/FlowLayout.java 2007-01-07 18:39:36 UTC (rev 3042)
+++ trunk/core/src/classpath/java/java/awt/FlowLayout.java 2007-01-07 18:41:27 UTC (rev 3043)
@@ -337,6 +337,9 @@
Insets ins = parent.getInsets ();
+ if (num == 0)
+ w += 2 * hgap + ins.left + ins.right;
+ else
w += (num + 1) * hgap + ins.left + ins.right;
h += 2 * vgap + ins.top + ins.bottom;
Modified: trunk/core/src/classpath/java/java/awt/GridBagLayout.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/GridBagLayout.java 2007-01-07 18:39:36 UTC (rev 3042)
+++ trunk/core/src/classpath/java/java/awt/GridBagLayout.java 2007-01-07 18:41:27 UTC (rev 3043)
@@ -1,5 +1,5 @@
/* GridBagLayout - Layout manager for components according to GridBagConstraints
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,6 @@
package java.awt;
-import gnu.classpath.NotImplementedException;
-
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
@@ -48,6 +46,7 @@
/**
* @author Michael Koch (kon...@gm...)
* @author Jeroen Frijters (je...@fr...)
+ * @author Andrew John Hughes (gnu...@me...)
*/
public class GridBagLayout
implements Serializable, LayoutManager2
@@ -64,8 +63,8 @@
// REMAINDER constraints.
// Constraints kept in comptable are never modified, and constraints
// kept in internalcomptable can be modified internally only.
- protected Hashtable comptable;
- private Hashtable internalcomptable;
+ protected Hashtable<Component,GridBagConstraints> comptable;
+ private Hashtable<Component,GridBagConstraints> internalcomptable;
protected GridBagLayoutInfo layoutInfo;
protected GridBagConstraints defaultConstraints;
@@ -76,8 +75,8 @@
public GridBagLayout ()
{
- this.comptable = new Hashtable();
- this.internalcomptable = new Hashtable();
+ this.comptable = new Hashtable<Component,GridBagConstraints>();
+ this.internalcomptable = new Hashtable<Component,GridBagConstraints>();
this.defaultConstraints= new GridBagConstraints();
}
@@ -322,14 +321,35 @@
}
/**
- * Obsolete.
+ * Return a string representation of this GridBagLayout.
+ *
+ * @return a string representation
*/
- protected void AdjustForGravity (GridBagConstraints gbc, Rectangle rect)
- throws NotImplementedException
+ public String toString()
{
- // FIXME
- throw new Error ("Not implemented");
+ return getClass().getName();
}
+
+ /**
+ * Move and resize a rectangle according to a set of grid bag
+ * constraints. The x, y, width and height fields of the
+ * rectangle argument are adjusted to the new values.
+ *
+ * @param constraints position and size constraints
+ * @param r rectangle to be moved and resized
+ */
+ protected void AdjustForGravity (GridBagConstraints constraints,
+ Rectangle r)
+ {
+ Insets insets = constraints.insets;
+ if (insets != null)
+ {
+ r.x += insets.left;
+ r.y += insets.top;
+ r.width -= insets.left + insets.right;
+ r.height -= insets.top + insets.bottom;
+ }
+ }
/**
* Obsolete.
@@ -353,10 +373,9 @@
// layoutInfo. So we wait until after this for loop to set
// layoutInfo.
Component lastComp = null;
- int cellx = 0;
- int celly = 0;
- int cellw = 0;
- int cellh = 0;
+
+ Rectangle cell = new Rectangle();
+
for (int i = 0; i < components.length; i++)
{
Component component = components[i];
@@ -370,29 +389,23 @@
if (lastComp != null
&& constraints.gridheight == GridBagConstraints.REMAINDER)
- celly += cellh;
+ cell.y += cell.height;
else
- celly = sumIntArray(info.rowHeights, constraints.gridy);
+ cell.y = sumIntArray(info.rowHeights, constraints.gridy);
if (lastComp != null
&& constraints.gridwidth == GridBagConstraints.REMAINDER)
- cellx += cellw;
+ cell.x += cell.width;
else
- cellx = sumIntArray(info.colWidths, constraints.gridx);
+ cell.x = sumIntArray(info.colWidths, constraints.gridx);
- cellw = sumIntArray(info.colWidths, constraints.gridx
- + constraints.gridwidth) - cellx;
- cellh = sumIntArray(info.rowHeights, constraints.gridy
- + constraints.gridheight) - celly;
+ cell.width = sumIntArray(info.colWidths, constraints.gridx
+ + constraints.gridwidth) - cell.x;
+ cell.height = sumIntArray(info.rowHeights, constraints.gridy
+ + constraints.gridheight) - cell.y;
- Insets insets = constraints.insets;
- if (insets != null)
- {
- cellx += insets.left;
- celly += insets.top;
- cellw -= insets.left + insets.right;
- cellh -= insets.top + insets.bottom;
- }
+ // Adjust for insets.
+ AdjustForGravity( constraints, cell );
// Note: Documentation says that padding is added on both sides, but
// visual inspection shows that the Sun implementation only adds it
@@ -403,14 +416,14 @@
switch (constraints.fill)
{
case GridBagConstraints.HORIZONTAL:
- dim.width = cellw;
+ dim.width = cell.width;
break;
case GridBagConstraints.VERTICAL:
- dim.height = cellh;
+ dim.height = cell.height;
break;
case GridBagConstraints.BOTH:
- dim.width = cellw;
- dim.height = cellh;
+ dim.width = cell.width;
+ dim.height = cell.height;
break;
}
@@ -420,40 +433,40 @@
switch (constraints.anchor)
{
case GridBagConstraints.NORTH:
- x = cellx + (cellw - dim.width) / 2;
- y = celly;
+ x = cell.x + (cell.width - dim.width) / 2;
+ y = cell.y;
break;
case GridBagConstraints.SOUTH:
- x = cellx + (cellw - dim.width) / 2;
- y = celly + cellh - dim.height;
+ x = cell.x + (cell.width - dim.width) / 2;
+ y = cell.y + cell.height - dim.height;
break;
case GridBagConstraints.WEST:
- x = cellx;
- y = celly + (cellh - dim.height) / 2;
+ x = cell.x;
+ y = cell.y + (cell.height - dim.height) / 2;
break;
case GridBagConstraints.EAST:
- x = cellx + cellw - dim.width;
- y = celly + (cellh - dim.height) / 2;
+ x = cell.x + cell.width - dim.width;
+ y = cell.y + (cell.height - dim.height) / 2;
break;
case GridBagConstraints.NORTHEAST:
- x = cellx + cellw - dim.width;
- y = celly;
+ x = cell.x + cell.width - dim.width;
+ y = cell.y;
break;
case GridBagConstraints.NORTHWEST:
- x = cellx;
- y = celly;
+ x = cell.x;
+ y = cell.y;
break;
case GridBagConstraints.SOUTHEAST:
- x = cellx + cellw - dim.width;
- y = celly + cellh - dim.height;
+ x = cell.x + cell.width - dim.width;
+ y = cell.y + cell.height - dim.height;
break;
case GridBagConstraints.SOUTHWEST:
- x = cellx;
- y = celly + cellh - dim.height;
+ x = cell.x;
+ y = cell.y + cell.height - dim.height;
break;
default:
- x = cellx + (cellw - dim.width) / 2;
- y = celly + (cellh - dim.height) / 2;
+ x = cell.x + (cell.width - dim.width) / 2;
+ y = cell.y + (cell.height - dim.height) / 2;
break;
}
component.setBounds(info.pos_x + x, info.pos_y + y, dim.width,
@@ -487,16 +500,18 @@
// Guaranteed to contain the last component added to the given row
// or column, whose gridwidth/height is not REMAINDER.
- HashMap lastInRow = new HashMap();
- HashMap lastInCol = new HashMap();
+ HashMap<Integer,Component> lastInRow = new HashMap<Integer,Component>();
+ HashMap<Integer,Component> lastInCol = new HashMap<Integer,Component>();
Component[] components = parent.getComponents();
// Components sorted by gridwidths/heights,
// smallest to largest, with REMAINDER and RELATIVE at the end.
// These are useful when determining sizes and weights.
- ArrayList sortedByWidth = new ArrayList(components.length);
- ArrayList sortedByHeight = new ArrayList(components.length);
+ ArrayList<Component> sortedByWidth =
+ new ArrayList<Component>(components.length);
+ ArrayList<Component> sortedByHeight =
+ new ArrayList<Component>(components.length);
// STEP 1: first we figure out how many rows/columns
for (int i = 0; i < components.length; i++)
@@ -761,7 +776,7 @@
// STEP 3: Determine sizes and weights for columns.
for (int i = 0; i < sortedByWidth.size(); i++)
{
- Component component = (Component) sortedByWidth.get(i);
+ Component component = sortedByWidth.get(i);
// If component is not visible we dont have to care about it.
if (!component.isVisible())
@@ -875,7 +890,8 @@
* width. Otherwise, sort by height.
* FIXME: Use a better sorting algorithm.
*/
- private void sortBySpan (Component component, int span, ArrayList list, boolean sortByWidth)
+ private void sortBySpan (Component component, int span,
+ ArrayList<Component> list, boolean sortByWidth)
{
if (span == GridBagConstraints.REMAINDER
|| span == GridBagConstraints.RELATIVE)
@@ -1082,10 +1098,18 @@
}
/**
+ * Move and resize a rectangle according to a set of grid bag
+ * constraints. The x, y, width and height fields of the
+ * rectangle argument are adjusted to the new values.
+ *
+ * @param constraints position and size constraints
+ * @param r rectangle to be moved and resized
+ *
* @since 1.4
*/
- protected void adjustForGravity (GridBagConstraints gbc, Rectangle rect)
+ protected void adjustForGravity (GridBagConstraints constraints,
+ Rectangle r)
{
- AdjustForGravity (gbc, rect);
+ AdjustForGravity (constraints, r);
}
}
Modified: trunk/core/src/classpath/java/java/awt/GridLayout.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/GridLayout.java 2007-01-07 18:39:36 UTC (rev 3042)
+++ trunk/core/src/classpath/java/java/awt/GridLayout.java 2007-01-07 18:41:27 UTC (rev 3043)
@@ -289,7 +289,7 @@
public String toString ()
{
return (getClass ().getName () + "["
- + ",hgap=" + hgap + ",vgap=" + vgap
+ + "hgap=" + hgap + ",vgap=" + vgap
+ ",rows=" + rows + ",cols=" + cols
+ "]");
}
Modified: trunk/core/src/classpath/java/java/awt/datatransfer/DataFlavor.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/datatransfer/DataFlavor.java 2007-01-07 18:39:36 UTC (rev 3042)
+++ trunk/core/src/classpath/java/java/awt/datatransfer/DataFlavor.java 2007-01-07 18:41:27 UTC (rev 3043)
@@ -38,14 +38,13 @@
package java.awt.datatransfer;
-import gnu.classpath.NotImplementedException;
-
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.io.OptionalDataException;
import java.io.Reader;
import java.io.Serializable;
import java.io.StringReader;
@@ -76,8 +75,7 @@
* deals with bytes not chars. Use <code>getRederForText()</code>.
*/
public static final DataFlavor plainTextFlavor =
- new DataFlavor(java.io.InputStream.class,
- "text/plain; charset=unicode",
+ new DataFlavor("text/plain; charset=unicode; class=java.io.InputStream",
"plain unicode text");
/**
@@ -94,8 +92,7 @@
* element of the list being a <code>java.io.File</code>.
*/
public static final DataFlavor javaFileListFlavor =
- new DataFlavor(java.util.List.class,
- "application/x-java-file-list; class=java.util.List",
+ new DataFlavor("application/x-java-file-list; class=java.util.List",
"Java File List");
/**
@@ -132,10 +129,10 @@
*/
// The MIME type for this flavor
- private final String mimeType;
+ private MimeType mimeType;
// The representation class for this flavor
- private final Class representationClass;
+ private Class<?> representationClass;
// The human readable name of this flavor
private String humanPresentableName;
@@ -156,7 +153,7 @@
*
* @exception ClassNotFoundException If the class cannot be loaded.
*/
- protected static final Class tryToLoadClass(String className,
+ protected static final Class<?> tryToLoadClass(String className,
ClassLoader classLoader)
throws ClassNotFoundException
{
@@ -198,63 +195,7 @@
throw new ClassNotFoundException(className);
}
- private static Class getRepresentationClassFromMimeThrows(String mimeString,
- ClassLoader classLoader)
- throws ClassNotFoundException
- {
- String classname = getParameter("class", mimeString);
- if (classname != null)
- return tryToLoadClass(classname, classLoader);
- else
- return java.io.InputStream.class;
- }
-
- // Same as above, but wraps any ClassNotFoundExceptions
- private static Class getRepresentationClassFromMime(String mimeString,
- ClassLoader classLoader)
- {
- try
- {
- return getRepresentationClassFromMimeThrows(mimeString, classLoader);
- }
- catch(ClassNotFoundException cnfe)
- {
- IllegalArgumentException iae;
- iae = new IllegalArgumentException("mimeString: "
- + mimeString
- + " classLoader: "
- + classLoader);
- iae.initCause(cnfe);
- throw iae;
- }
- }
-
/**
- * Returns the value of the named MIME type parameter, or <code>null</code>
- * if the parameter does not exist. Given the parameter name and the mime
- * string.
- *
- * @param paramName The name of the parameter.
- * @param mimeString The mime string from where the name should be found.
- *
- * @return The value of the parameter or null.
- */
- private static String getParameter(String paramName, String mimeString)
- {
- int idx = mimeString.indexOf(paramName + "=");
- if (idx == -1)
- return(null);
-
- String value = mimeString.substring(idx + paramName.length() + 1);
-
- idx = value.indexOf(";");
- if (idx == -1)
- return(value);
- else
- return(value.substring(0, idx));
- }
-
- /**
* XXX - Currently returns <code>plainTextFlavor</code>.
*/
public static final DataFlavor getTextPlainUnicodeFlavor()
@@ -321,35 +262,10 @@
*/
public DataFlavor()
{
- mimeType = null;
- representationClass = null;
- humanPresentableName = null;
+ // Used for deserialization only, nothing to do here.
}
/**
- * Private constructor.
- */
- private DataFlavor(Class representationClass,
- String mimeType,
- String humanPresentableName)
- {
- this.representationClass = representationClass;
- this.mimeType = mimeType;
-
- // Do some simple validity checks
- String type = getPrimaryType() + "/" + getSubType();
- if (type.indexOf(' ') != -1
- || type.indexOf('=') != -1
- || type.indexOf(';') != -1)
- throw new IllegalArgumentException(mimeType);
-
- if (humanPresentableName != null)
- this.humanPresentableName = humanPresentableName;
- else
- this.humanPresentableName = mimeType;
- }
-
- /**
* Initializes a new instance of <code>DataFlavor</code>. The class
* and human readable name are specified, the MIME type will be
* "application/x-java-serialized-object". If the human readable name
@@ -359,13 +275,23 @@
* @param representationClass The representation class for this object.
* @param humanPresentableName The display name of the object.
*/
- public DataFlavor(Class representationClass, String humanPresentableName)
+ public DataFlavor(Class<?> representationClass, String humanPresentableName)
{
- this(representationClass,
- "application/x-java-serialized-object"
- + "; class="
- + representationClass.getName(),
- humanPresentableName);
+ if (representationClass == null)
+ throw new NullPointerException("representationClass must not be null");
+ try
+ {
+ mimeType = new MimeType(javaSerializedObjectMimeType);
+ ...
[truncated message content] |
|
From: <ls...@us...> - 2007-01-09 20:25:14
|
Revision: 3061
http://jnode.svn.sourceforge.net/jnode/?rev=3061&view=rev
Author: lsantha
Date: 2007-01-09 12:25:00 -0800 (Tue, 09 Jan 2007)
Log Message:
-----------
Classpath patches.
Modified Paths:
--------------
trunk/core/src/classpath/java/java/awt/AlphaComposite.java
trunk/core/src/classpath/java/java/awt/Dialog.java
trunk/core/src/classpath/java/java/awt/Graphics2D.java
trunk/core/src/classpath/java/java/awt/Rectangle.java
trunk/core/src/classpath/java/java/awt/RenderingHints.java
trunk/core/src/classpath/java/java/awt/dnd/DragGestureEvent.java
trunk/core/src/classpath/java/java/awt/dnd/DragGestureRecognizer.java
trunk/core/src/classpath/java/java/awt/dnd/DragSource.java
trunk/core/src/classpath/java/java/awt/dnd/DragSourceContext.java
trunk/core/src/classpath/java/java/awt/dnd/DropTarget.java
trunk/core/src/classpath/java/java/awt/dnd/DropTargetContext.java
trunk/core/src/classpath/java/java/awt/dnd/DropTargetDragEvent.java
trunk/core/src/classpath/java/java/awt/dnd/DropTargetDropEvent.java
trunk/core/src/classpath/java/java/awt/dnd/DropTargetEvent.java
trunk/core/src/classpath/java/java/awt/im/InputContext.java
trunk/core/src/classpath/java/java/awt/im/InputMethodHighlight.java
trunk/core/src/classpath/java/java/awt/im/spi/InputMethodContext.java
trunk/core/src/classpath/java/java/awt/image/renderable/ParameterBlock.java
trunk/core/src/classpath/java/java/awt/image/renderable/RenderableImage.java
trunk/core/src/classpath/java/java/awt/image/renderable/RenderableImageOp.java
trunk/core/src/classpath/java/java/awt/print/PrinterJob.java
trunk/core/src/classpath/java/java/io/FileDescriptor.java
trunk/core/src/classpath/java/java/io/FileInputStream.java
trunk/core/src/classpath/java/java/io/FileOutputStream.java
trunk/core/src/classpath/java/java/io/ObjectStreamField.java
trunk/core/src/classpath/java/java/io/OutputStreamWriter.java
trunk/core/src/classpath/java/java/io/PipedInputStream.java
trunk/core/src/classpath/java/java/io/PipedReader.java
trunk/core/src/classpath/java/java/io/PrintStream.java
trunk/core/src/classpath/java/java/io/RandomAccessFile.java
trunk/core/src/classpath/java/java/nio/ByteBuffer.java
trunk/core/src/classpath/java/java/nio/DoubleBuffer.java
trunk/core/src/classpath/java/java/nio/FloatBuffer.java
trunk/core/src/classpath/java/java/nio/IntBuffer.java
trunk/core/src/classpath/java/java/nio/LongBuffer.java
trunk/core/src/classpath/java/java/nio/ShortBuffer.java
trunk/core/src/classpath/java/java/util/logging/LoggingMXBean.java
trunk/core/src/classpath/java/java/util/prefs/AbstractPreferences.java
trunk/core/src/classpath/java/java/util/prefs/Preferences.java
Modified: trunk/core/src/classpath/java/java/awt/AlphaComposite.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/AlphaComposite.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/AlphaComposite.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -1,5 +1,5 @@
/* AlphaComposite.java -- provides a context for performing alpha compositing
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -61,8 +61,8 @@
private static final int MAX_CACHE_SIZE = 2048;
/** Prune stale entries. */
- protected boolean removeEldestEntry(Map.Entry eldest)
- { // XXX - FIXME Use Map.Entry, not just Entry as gcj 3.1 workaround.
+ protected boolean removeEldestEntry(Entry eldest)
+ {
return size() > MAX_CACHE_SIZE;
}
};
Modified: trunk/core/src/classpath/java/java/awt/Dialog.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/Dialog.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/Dialog.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -97,6 +97,11 @@
private EventQueue eq2 = null;
/**
+ * The number used to generate the name returned by getName.
+ */
+ private static transient long next_dialog_number;
+
+ /**
* Initializes a new instance of <code>Dialog</code> with the specified
* parent, that is resizable and not modal, and which has no title.
*
@@ -190,6 +195,7 @@
visible = false;
setLayout(new BorderLayout());
+ setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
/**
@@ -273,6 +279,7 @@
visible = false;
setLayout(new BorderLayout());
+ setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
/**
@@ -531,4 +538,18 @@
return accessibleContext;
}
+ /**
+ * Generate a unique name for this <code>Dialog</code>.
+ *
+ * @return A unique name for this <code>Dialog</code>.
+ */
+ String generateName()
+ {
+ return "dialog" + getUniqueLong();
+ }
+
+ private static synchronized long getUniqueLong()
+ {
+ return next_dialog_number++;
+ }
}
Modified: trunk/core/src/classpath/java/java/awt/Graphics2D.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/Graphics2D.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/Graphics2D.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -227,14 +227,14 @@
*
* @see #addRenderingHints(Map)
*/
- public abstract void setRenderingHints(Map hints);
+ public abstract void setRenderingHints(Map<?,?> hints);
/**
* Adds/updates the rendering hint.
*
* @param hints the hints to add or update.
*/
- public abstract void addRenderingHints(Map hints);
+ public abstract void addRenderingHints(Map<?,?> hints);
/**
* Returns the current rendering hints.
Modified: trunk/core/src/classpath/java/java/awt/Rectangle.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/Rectangle.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/Rectangle.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -119,14 +119,10 @@
* coordinates of the specified rectangle.
*
* @param r the rectangle to copy from
- * @throws NullPointerException if r is null
* @since 1.1
*/
public Rectangle(Rectangle r)
{
- if (r == null)
- throw new NullPointerException();
-
x = r.x;
y = r.y;
width = r.width;
@@ -171,13 +167,9 @@
*
* @param p the upper left corner of the rectangle
* @param d the width and height of the rectangle
- * @throws NullPointerException if p or d is null
*/
public Rectangle(Point p, Dimension d)
{
- if (p == null || d == null)
- throw new NullPointerException();
-
x = p.x;
y = p.y;
width = d.width;
@@ -189,13 +181,9 @@
* corner at the specified point and a width and height of zero.
*
* @param p the upper left corner of the rectangle
- * @throws NullPointerException if p is null
*/
public Rectangle(Point p)
{
- if (p == null)
- throw new NullPointerException();
-
x = p.x;
y = p.y;
}
@@ -206,13 +194,9 @@
* by the specified dimension.
*
* @param d the width and height of the rectangle
- * @throws NullPointerException if d is null
*/
public Rectangle(Dimension d)
{
- if (d == null)
- throw new NullPointerException();
-
width = d.width;
height = d.height;
}
Modified: trunk/core/src/classpath/java/java/awt/RenderingHints.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/RenderingHints.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/RenderingHints.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -54,7 +54,8 @@
* @author Rolf W. Rasmussen (ro...@ii...)
* @author Eric Blake (eb...@em...)
*/
-public class RenderingHints implements Map, Cloneable
+public class RenderingHints
+ implements Map<Object,Object>, Cloneable
{
/**
* The base class used to represent keys.
@@ -550,7 +551,7 @@
* @param init a map containing a collection of hints (<code>null</code>
* permitted).
*/
- public RenderingHints(Map init)
+ public RenderingHints(Map<Key,?> init)
{
if (init != null)
putAll(init);
@@ -704,7 +705,7 @@
* @throws IllegalArgumentException if the map contains a value that is
* not compatible with its key.
*/
- public void putAll(Map m)
+ public void putAll(Map<?,?> m)
{
// preprocess map to generate appropriate exceptions
Iterator iterator = m.keySet().iterator();
@@ -723,7 +724,7 @@
*
* @return A set of keys.
*/
- public Set keySet()
+ public Set<Object> keySet()
{
return hintMap.keySet();
}
@@ -735,7 +736,7 @@
*
* @return A collection of values.
*/
- public Collection values()
+ public Collection<Object> values()
{
return hintMap.values();
}
@@ -745,7 +746,7 @@
*
* @return A set of entries.
*/
- public Set entrySet()
+ public Set<Map.Entry<Object,Object>> entrySet()
{
return Collections.unmodifiableSet(hintMap.entrySet());
}
Modified: trunk/core/src/classpath/java/java/awt/dnd/DragGestureEvent.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/dnd/DragGestureEvent.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/dnd/DragGestureEvent.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -59,7 +59,7 @@
private Component component;
private final Point origin;
private final int action;
- private List events;
+ private List<InputEvent> events;
private DragGestureRecognizer dgr;
/**
@@ -71,7 +71,7 @@
* @throws IllegalArgumentException - if input parameters are null
*/
public DragGestureEvent(DragGestureRecognizer dgr, int action, Point origin,
- List events)
+ List<? extends InputEvent> events)
{
super(dgr);
if (origin == null || events == null || dgr == null)
@@ -79,7 +79,7 @@
this.origin = origin;
this.action = action;
- this.events = events;
+ this.events = (List<InputEvent>) events;
this.dgr = dgr;
this.component = dgr.getComponent();
this.dragSource = dgr.getDragSource();
@@ -130,7 +130,7 @@
*
* @return an iterator representation of the List of events.
*/
- public Iterator iterator()
+ public Iterator<InputEvent> iterator()
{
return events.iterator();
}
Modified: trunk/core/src/classpath/java/java/awt/dnd/DragGestureRecognizer.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/dnd/DragGestureRecognizer.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/dnd/DragGestureRecognizer.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -1,5 +1,5 @@
/* DragGestureRecognizer.java --
- Copyright (C) 2002,2006 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,6 @@
package java.awt.dnd;
-import gnu.classpath.NotImplementedException;
-
import java.awt.Component;
import java.awt.Point;
import java.awt.event.InputEvent;
@@ -52,6 +50,8 @@
/**
* STUBBED
+ * @author Michael Koch (kon...@gm...)
+ * @author Andrew John Hughes (gnu...@me...)
* @since 1.2
*/
public abstract class DragGestureRecognizer implements Serializable
@@ -65,7 +65,7 @@
protected Component component;
protected transient DragGestureListener dragGestureListener;
protected int sourceActions;
- protected ArrayList events = new ArrayList();
+ protected ArrayList<InputEvent> events = new ArrayList<InputEvent>();
protected DragGestureRecognizer(DragSource ds, Component c, int sa,
DragGestureListener dgl)
@@ -127,11 +127,12 @@
return events.size() > 0 ? (InputEvent) events.get(0) : null;
}
+ /**
+ * Resets the recognizer. If a gesture is currently recognize, discard it.
+ */
public void resetRecognizer()
- throws NotImplementedException
{
- events = new ArrayList();
- // FIXME: Not implemented fully.
+ events.clear();
}
/**
Modified: trunk/core/src/classpath/java/java/awt/dnd/DragSource.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/dnd/DragSource.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/dnd/DragSource.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -226,12 +226,13 @@
return flavorMap;
}
- public DragGestureRecognizer createDragGestureRecognizer(Class recognizer,
+ public <T extends DragGestureRecognizer> T
+ createDragGestureRecognizer(Class<T> recognizer,
Component c,
int actions,
DragGestureListener dgl)
{
- return Toolkit.getDefaultToolkit().createDragGestureRecognizer(recognizer,
+ return (T) Toolkit.getDefaultToolkit().createDragGestureRecognizer(recognizer,
this, c,
actions, dgl);
}
@@ -296,7 +297,7 @@
/**
* @since 1.4
*/
- public EventListener[] getListeners (Class listenerType)
+ public <T extends EventListener> T[] getListeners (Class<T> listenerType)
{
if (listenerType == DragSourceListener.class)
return DnDEventMulticaster.getListeners (dragSourceListener,
@@ -307,7 +308,7 @@
listenerType);
// Return an empty EventListener array.
- return new EventListener [0];
+ return (T[]) new EventListener [0];
}
/**
Modified: trunk/core/src/classpath/java/java/awt/dnd/DragSourceContext.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/dnd/DragSourceContext.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/dnd/DragSourceContext.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -38,8 +38,6 @@
package java.awt.dnd;
-import gnu.classpath.NotImplementedException;
-
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Image;
@@ -268,7 +266,8 @@
for (int i = 0; i < dsl.length; i++)
dsl[i].dragExit(e);
- updateCurrentCursor(0, 0, DEFAULT);
+ updateCurrentCursor(DnDConstants.ACTION_NONE, DnDConstants.ACTION_NONE,
+ DEFAULT);
}
/**
@@ -340,26 +339,45 @@
* @param status - the status of the cursor (constant).
*/
protected void updateCurrentCursor(int dropOp, int targetAct, int status)
- throws NotImplementedException
{
- // FIXME: Not implemented fully
- if (!useCustomCursor)
+ if (! useCustomCursor)
{
- Cursor cursor = null;
+ Cursor newCursor = null;
switch (status)
{
+ default:
+ targetAct = DnDConstants.ACTION_NONE;
case ENTER:
- break;
case CHANGED:
- break;
case OVER:
- break;
- default:
- break;
+ int action = dropOp & targetAct;
+ if (action == DnDConstants.ACTION_NONE)
+ {
+ if ((dropOp & DnDConstants.ACTION_LINK) != 0)
+ newCursor = DragSource.DefaultLinkNoDrop;
+ else if ((dropOp & DnDConstants.ACTION_MOVE) != 0)
+ newCursor = DragSource.DefaultMoveNoDrop;
+ else
+ newCursor = DragSource.DefaultCopyNoDrop;
+ }
+ else
+ {
+ if ((dropOp & DnDConstants.ACTION_LINK) != 0)
+ newCursor = DragSource.DefaultLinkDrop;
+ else if ((dropOp & DnDConstants.ACTION_MOVE) != 0)
+ newCursor = DragSource.DefaultMoveDrop;
+ else
+ newCursor = DragSource.DefaultCopyDrop;
+ }
}
- this.cursor = cursor;
- peer.setCursor(cursor);
+ if (cursor == null || ! cursor.equals(newCursor))
+ {
+ cursor = newCursor;
+ DragSourceContextPeer p = peer;
+ if (p != null)
+ p.setCursor(cursor);
+ }
}
}
} // class DragSourceContext
Modified: trunk/core/src/classpath/java/java/awt/dnd/DropTarget.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/dnd/DropTarget.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/dnd/DropTarget.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -38,12 +38,12 @@
package java.awt.dnd;
-import gnu.classpath.NotImplementedException;
-
import java.awt.Component;
import java.awt.GraphicsEnvironment;
import java.awt.HeadlessException;
+import java.awt.Insets;
import java.awt.Point;
+import java.awt.Rectangle;
import java.awt.datatransfer.FlavorMap;
import java.awt.datatransfer.SystemFlavorMap;
import java.awt.dnd.peer.DropTargetPeer;
@@ -55,6 +55,8 @@
import java.util.EventListener;
import java.util.TooManyListenersException;
+import javax.swing.Timer;
+
/**
* @author Michael Koch
* @since 1.2
@@ -70,30 +72,87 @@
protected static class DropTargetAutoScroller
implements ActionListener
{
+ /**
+ * The threshold that keeps the autoscroller running.
+ */
+ private static final int HYSTERESIS = 10;
+
+ /**
+ * The initial timer delay.
+ */
+ private static final int DELAY = 100;
+
private Component component;
private Point point;
+ /**
+ * The timer that triggers autoscrolling.
+ */
+ private Timer timer;
+
+ /**
+ * The outer region of the scroller. This is the component's size.
+ */
+ private Rectangle outer;
+
+ /**
+ * The inner region of the scroller. This is the component size without
+ * the autoscroll insets.
+ */
+ private Rectangle inner;
+
protected DropTargetAutoScroller (Component c, Point p)
{
component = c;
point = p;
+ timer = new Timer(DELAY, this);
+ timer.setCoalesce(true);
+ timer.start();
}
protected void updateLocation (Point newLocn)
{
+ Point previous = point;
point = newLocn;
+ if (Math.abs(point.x - previous.x) > HYSTERESIS
+ || Math.abs(point.y - previous.y) > HYSTERESIS)
+ {
+ if (timer.isRunning())
+ timer.stop();
+ }
+ else
+ {
+ if (! timer.isRunning())
+ timer.start();
+ }
}
protected void stop ()
- throws NotImplementedException
{
- // FIXME: implement this
+ timer.start();
}
public void actionPerformed (ActionEvent e)
- throws NotImplementedException
{
- // FIXME: implement this
+ Autoscroll autoScroll = (Autoscroll) component;
+
+ // First synchronize the inner and outer rectangles.
+ Insets i = autoScroll.getAutoscrollInsets();
+ int width = component.getWidth();
+ int height = component.getHeight();
+ if (width != outer.width || height != outer.height)
+ outer.setBounds(0, 0, width, height);
+ if (inner.x != i.left || inner.y != i.top)
+ inner.setLocation(i.left, i.top);
+ int inWidth = width - i.left - i.right;
+ int inHeight = height - i.top - i.bottom;
+ if (inWidth != inner.width || inHeight != inner.height)
+ inner.setSize(inWidth, inHeight);
+
+ // Scroll if the outer rectangle contains the location, but the
+ // inner doesn't.
+ if (outer.contains(point) && ! inner.contains(point))
+ autoScroll.autoscroll(point);
}
}
@@ -182,6 +241,8 @@
*/
public void setComponent (Component c)
{
+ if (component != null)
+ clearAutoscroll();
component = c;
}
@@ -212,6 +273,8 @@
public void setActive (boolean active)
{
this.active = active;
+ if (! active)
+ clearAutoscroll();
}
public boolean isActive()
@@ -250,30 +313,47 @@
public void dragEnter(DropTargetDragEvent dtde)
{
+ if (active)
+ {
if (dropTargetListener != null)
dropTargetListener.dragEnter(dtde);
+ initializeAutoscrolling(dtde.getLocation());
+ }
}
public void dragOver(DropTargetDragEvent dtde)
{
+ if (active)
+ {
if (dropTargetListener != null)
dropTargetListener.dragOver(dtde);
+ updateAutoscroll(dtde.getLocation());
+ }
}
public void dropActionChanged(DropTargetDragEvent dtde)
{
+ if (active)
+ {
if (dropTargetListener != null)
dropTargetListener.dropActionChanged(dtde);
+ updateAutoscroll(dtde.getLocation());
+ }
}
public void dragExit(DropTargetEvent dte)
{
+ if (active)
+ {
if (dropTargetListener != null)
dropTargetListener.dragExit(dte);
+ clearAutoscroll();
+ }
}
public void drop(DropTargetDropEvent dtde)
{
+ clearAutoscroll();
if (dropTargetListener != null)
dropTargetListener.drop(dtde);
}
@@ -332,15 +412,13 @@
protected DropTarget.DropTargetAutoScroller createDropTargetAutoScroller
(Component c, Point p)
{
- if (autoscroller == null)
- autoscroller = new DropTarget.DropTargetAutoScroller (c, p);
-
- return autoscroller;
+ return new DropTarget.DropTargetAutoScroller (c, p);
}
protected void initializeAutoscrolling(Point p)
{
- createDropTargetAutoScroller (component, p);
+ if (component instanceof Autoscroll) // Checks for null too.
+ autoscroller = createDropTargetAutoScroller (component, p);
}
protected void updateAutoscroll(Point dragCursorLocn)
@@ -351,6 +429,10 @@
protected void clearAutoscroll()
{
+ if (autoscroller != null)
+ {
+ autoscroller.stop();
autoscroller = null;
}
+ }
} // class DropTarget
Modified: trunk/core/src/classpath/java/java/awt/dnd/DropTargetContext.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/dnd/DropTargetContext.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/dnd/DropTargetContext.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -1,5 +1,5 @@
/* DropTargetContext.java --
- Copyright (C) 2002, 2003, 2004, 2006, Free Software Foundation
+ Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation
This file is part of GNU Classpath.
@@ -49,6 +49,7 @@
/**
* @author Michael Koch (kon...@gm...)
+ * @author Andrew John Hughes (gnu...@me...)
* @since 1.2
*/
public class DropTargetContext implements Serializable
@@ -128,51 +129,51 @@
*
* @exception InvalidDnDOperationException If a drop is not outstanding.
*/
- public void dropComplete(boolean success)
+ public void dropComplete (boolean success)
{
if (dtcp != null)
dtcp.dropComplete(success);
}
- protected void acceptDrag(int dragOperation)
+ protected void acceptDrag (int dragOperation)
{
if (dtcp != null)
dtcp.acceptDrag(dragOperation);
}
- protected void rejectDrag()
+ protected void rejectDrag ()
{
if (dtcp != null)
dtcp.rejectDrag();
}
- protected void acceptDrop(int dropOperation)
+ protected void acceptDrop (int dropOperation)
{
if (dtcp != null)
dtcp.acceptDrop(dropOperation);
}
- protected void rejectDrop()
+ protected void rejectDrop ()
{
if (dtcp != null)
dtcp.rejectDrop();
}
- protected DataFlavor[] getCurrentDataFlavors()
+ protected DataFlavor[] getCurrentDataFlavors ()
{
if (dtcp != null)
dtcp.getTransferDataFlavors();
return null;
}
- protected List getCurrentDataFlavorsAsList()
+ protected List<DataFlavor> getCurrentDataFlavorsAsList ()
{
- return Arrays.asList(getCurrentDataFlavors());
+ return Arrays.asList(getCurrentDataFlavors ());
}
- protected boolean isDataFlavorSupported(DataFlavor flavor)
+ protected boolean isDataFlavorSupported (DataFlavor flavor)
{
- return getCurrentDataFlavorsAsList().contains(flavor);
+ return getCurrentDataFlavorsAsList().contains (flavor);
}
/**
Modified: trunk/core/src/classpath/java/java/awt/dnd/DropTargetDragEvent.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/dnd/DropTargetDragEvent.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/dnd/DropTargetDragEvent.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -108,7 +108,7 @@
return context.getCurrentDataFlavors ();
}
- public List getCurrentDataFlavorsAsList ()
+ public List<DataFlavor> getCurrentDataFlavorsAsList ()
{
return context.getCurrentDataFlavorsAsList ();
}
Modified: trunk/core/src/classpath/java/java/awt/dnd/DropTargetDropEvent.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/dnd/DropTargetDropEvent.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/dnd/DropTargetDropEvent.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -1,5 +1,5 @@
/* DropTargetDropEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -123,7 +123,7 @@
return context.getCurrentDataFlavors();
}
- public List getCurrentDataFlavorsAsList()
+ public List<DataFlavor> getCurrentDataFlavorsAsList()
{
return context.getCurrentDataFlavorsAsList();
}
Modified: trunk/core/src/classpath/java/java/awt/dnd/DropTargetEvent.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/dnd/DropTargetEvent.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/dnd/DropTargetEvent.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -41,6 +41,10 @@
public class DropTargetEvent extends EventObject
{
+
+ /**
+ * Serialization identifier for Sun 1.5 compatability
+ */
private static final long serialVersionUID = 2821229066521922993L;
protected DropTargetContext context;
Modified: trunk/core/src/classpath/java/java/awt/im/InputContext.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/im/InputContext.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/im/InputContext.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -76,6 +76,7 @@
* java.awt.im.spi.InputMethodDescriptor.
*
* @author Eric Blake (eb...@em...)
+ * @author Andrew John Hughes (gnu...@me...)
* @see Component#getInputContext()
* @see Component#enableInputMethods(boolean)
* @since 1.2
@@ -86,7 +87,9 @@
/**
* The list of installed input method descriptors.
*/
- private static final ArrayList descriptors = new ArrayList();
+ private static final ArrayList<InputMethodDescriptor> descriptors
+ = new ArrayList<InputMethodDescriptor>();
+
static
{
Enumeration e;
@@ -123,7 +126,7 @@
{
if (line.charAt(0) != '#')
{
- Class c = Class.forName(line);
+ Class<?> c = Class.forName(line);
descriptors.add((InputMethodDescriptor) c.newInstance());
}
line = in.readLine().trim();
@@ -143,7 +146,8 @@
private InputMethod im;
/** Map of locales to the most recently selected input method. */
- private final HashMap recent = new HashMap();
+ private final HashMap<Locale,InputMethod> recent
+ = new HashMap<Locale,InputMethod>();
/** The list of acceptable character subsets. */
private Character.Subset[] subsets;
Modified: trunk/core/src/classpath/java/java/awt/im/InputMethodHighlight.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/im/InputMethodHighlight.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/im/InputMethodHighlight.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -41,6 +41,7 @@
import java.text.Annotation;
import java.text.AttributedCharacterIterator;
import java.util.Map;
+import java.awt.font.TextAttribute;
/**
* This describes the highlight attributes of text composed in an input method.
@@ -95,7 +96,7 @@
private final int variation;
/** The unmodifiable map of rendering styles. */
- private final Map style;
+ private final Map<TextAttribute, ?> style;
/**
* Create an input method highlight style, with variation 0 and null style
@@ -134,7 +135,7 @@
* @since 1.3
*/
public InputMethodHighlight(boolean selected, int state, int variation,
- Map style)
+ Map<TextAttribute, ?> style)
{
if (state != RAW_TEXT && state != CONVERTED_TEXT)
throw new IllegalArgumentException();
@@ -181,7 +182,7 @@
* @return the style map
* @since 1.3
*/
- public Map getStyle()
+ public Map<TextAttribute, ?> getStyle()
{
return style;
}
Modified: trunk/core/src/classpath/java/java/awt/im/spi/InputMethodContext.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/im/spi/InputMethodContext.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/im/spi/InputMethodContext.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -1,5 +1,5 @@
/* InputMethodContext.java -- communication between an input method and client
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,6 +53,7 @@
* {@link InputMethod#setInputMethodContex...
[truncated message content] |
|
From: <ls...@us...> - 2007-06-17 12:16:03
|
Revision: 3277
http://jnode.svn.sourceforge.net/jnode/?rev=3277&view=rev
Author: lsantha
Date: 2007-06-17 05:15:58 -0700 (Sun, 17 Jun 2007)
Log Message:
-----------
Openjdk integration.
Removed Paths:
-------------
trunk/core/src/classpath/java/java/math/
trunk/core/src/classpath/java/java/util/FormatFlagsConversionMismatchException.java
trunk/core/src/classpath/java/java/util/Formattable.java
trunk/core/src/classpath/java/java/util/FormattableFlags.java
trunk/core/src/classpath/java/java/util/Formatter.java
trunk/core/src/classpath/java/java/util/FormatterClosedException.java
Deleted: trunk/core/src/classpath/java/java/util/FormatFlagsConversionMismatchException.java
===================================================================
--- trunk/core/src/classpath/java/java/util/FormatFlagsConversionMismatchException.java 2007-06-17 10:56:12 UTC (rev 3276)
+++ trunk/core/src/classpath/java/java/util/FormatFlagsConversionMismatchException.java 2007-06-17 12:15:58 UTC (rev 3277)
@@ -1,111 +0,0 @@
-/* FormatFlagsConversionMismatchException.java
- Copyright (C) 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;
-
-/**
- * Thrown when the flags supplied to the {@link Formatter#format()}
- * method of a {@link Formatter} contains a flag that does not match
- * the conversion character specified for it.
- *
- * @author Tom Tromey (tr...@re...)
- * @author Andrew John Hughes (gnu...@me...)
- * @since 1.5
- */
-public class FormatFlagsConversionMismatchException
- extends IllegalFormatException
-{
- private static final long serialVersionUID = 19120414L;
-
- /**
- * The mismatching flag.
- *
- * @serial the mismatching flag.
- */
- // Note: name fixed by serialization.
- private String f;
-
- /**
- * The conversion character which doesn't match the
- * appropriate flag.
- *
- * @serial the conversion character which doesn't match its flag.
- */
- // Note: name fixed by serialization.
- private char c;
-
- /**
- * Constructs a new <code>FormatFlagsConversionMismatchException</code>
- * which specifies that the flag, <code>f</code>, does
- * not match its appropriate conversion character, <code>c</code>.
- *
- * @param f the mismatching flag.
- * @param c the conversion character which doesn't match its flag.
- * @throws NullPointerException if <code>f</code> is null.
- */
- public FormatFlagsConversionMismatchException(String f, char c)
- {
- super("Invalid flag " + f + " for conversion " + c);
- if (f == null)
- throw new
- NullPointerException("Null flag value passed to constructor.");
- this.f = f;
- this.c = c;
- }
-
- /**
- * Returns the conversion character which doesn't
- * match the flag.
- *
- * @return the conversion character.
- */
- public char getConversion()
- {
- return c;
- }
-
- /**
- * Returns the mismatching flag.
- *
- * @return the mismatching flag.
- */
- public String getFlags()
- {
- return f;
- }
-}
Deleted: trunk/core/src/classpath/java/java/util/Formattable.java
===================================================================
--- trunk/core/src/classpath/java/java/util/Formattable.java 2007-06-17 10:56:12 UTC (rev 3276)
+++ trunk/core/src/classpath/java/java/util/Formattable.java 2007-06-17 12:15:58 UTC (rev 3277)
@@ -1,92 +0,0 @@
-/* Formattable.java -- Objects which can be passed to a Formatter
- Copyright (C) 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;
-
-/**
- * <p>
- * The <code>Formattable</code> interface is used to provide customised
- * formatting to arbitrary objects via the {@link Formatter}. The
- * {@link #formatTo} method is called for <code>Formattable</code>
- * objects used with the 's' conversion operator, allowing the object
- * to provide its own formatting of its internal data.
- * </p>
- * <p>
- * Thread safety is left up to the implementing class. Thus,
- * {@link Formattable} objects are not guaranteed to be thread-safe,
- * and users should make their own provisions for multiple thread access.
- * </p>
- *
- * @author Tom Tromey (tr...@re...)
- * @author Andrew John Hughes (gnu...@me...)
- * @since 1.5
- */
-public interface Formattable
-{
-
- /**
- * Formats the object using the supplied formatter to the specification
- * provided by the given flags, width and precision.
- *
- * @param formatter the formatter to use for formatting the object.
- * The formatter gives access to the output stream
- * and locale via {@link Formatter#out()} and
- * {@link Formatter#locale()} respectively.
- * @param flags a bit mask constructed from the flags in the
- * {@link FormattableFlags} class. When no flags
- * are set, the implementing class should use its
- * defaults.
- * @param width the minimum number of characters to include.
- * A value of -1 indicates no minimum. The remaining
- * space is padded with ' ' either on the left
- * (the default) or right (if left justification is
- * specified by the flags).
- * @param precision the maximum number of characters to include.
- * A value of -1 indicates no maximum. This value
- * is applied prior to the minimum (the width). Thus,
- * a value may meet the minimum width initially, but
- * not when the width value is applied, due to
- * characters being removed by the precision value.
- * @throws IllegalFormatException if there is a problem with
- * the syntax of the format
- * specification or a mismatch
- * between it and the arguments.
- */
- public void formatTo(Formatter formatter, int flags, int width,
- int precision);
-}
Deleted: trunk/core/src/classpath/java/java/util/FormattableFlags.java
===================================================================
--- trunk/core/src/classpath/java/java/util/FormattableFlags.java 2007-06-17 10:56:12 UTC (rev 3276)
+++ trunk/core/src/classpath/java/java/util/FormattableFlags.java 2007-06-17 12:15:58 UTC (rev 3277)
@@ -1,123 +0,0 @@
-/* FormattableFlags.java --
- Copyright (C) 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;
-
-/**
- * This class contains a set of flags used
- * by the {@link Formattable#formatTo()} method.
- * They are used to modify the output of the
- * {@link Formattable}. The interpretation and
- * validation of the flags is left to the
- * particular {@link Formattable}.
- *
- * @author Tom Tromey (tr...@re...)
- * @author Andrew John Hughes (gnu...@me...)
- * @since 1.5
- */
-public class FormattableFlags
-{
-
- /**
- * Requires the output to be left-justified. Any spaces
- * required to meet the specified width will be added to
- * the right of the output. The default output is
- * right-justified, where spaces are added to the left.
- * The output is as for the format specifier
- * '-' ('\u002d').
- */
- public static final int LEFT_JUSTIFY = 1;
-
- /**
- * Requires the output to be in uppercase. The output
- * should be the same as the result from calling
- * {@link String#toUpperCase(java.util.Locale)} with
- * the formatting locale. The output is as for the
- * format specifier '^' ('\u005e').
- */
- public static final int UPPERCASE = 2;
-
- /**
- * Requires the use of an alternate form, as specified
- * in the documentation of {@link Formattable}.
- * The output is as for the format specifier
- * '#' ('\u0023').
- */
- public static final int ALTERNATE = 4;
-
- // Used internally by Formatter.
- // Changes here must be reflected in the FLAGS string there.
-
- /**
- * Requires the output to always include a '+' sign.
- * The output is as for the format specifier '+'.
- */
- static final int PLUS = 8;
-
- /**
- * Requires the output to include a leading space on
- * positive value. The output is as for the format
- * specifier ' '.
- */
- static final int SPACE = 16;
-
- /**
- * Requires the output to be zero-padded. The output
- * is as for the format specifier '0'.
- */
- static final int ZERO = 32;
-
- /**
- * Requires the output to include locale-specific
- * grouping operators. The output is as for the
- * format specifier ','.
- */
- static final int COMMA = 64;
-
- /**
- * Requires the output to include negative numbers
- * enclosed in parentheses. The output is as for
- * the format specifier '('.
- */
- static final int PAREN = 128;
-
- // Not instantiable.
- private FormattableFlags()
- {
- }
-}
Deleted: trunk/core/src/classpath/java/java/util/Formatter.java
===================================================================
--- trunk/core/src/classpath/java/java/util/Formatter.java 2007-06-17 10:56:12 UTC (rev 3276)
+++ trunk/core/src/classpath/java/java/util/Formatter.java 2007-06-17 12:15:58 UTC (rev 3277)
@@ -1,1496 +0,0 @@
-/* Formatter.java -- printf-style formatting
- Copyright (C) 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.Closeable;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.Flushable;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintStream;
-import java.io.UnsupportedEncodingException;
-import java.math.BigInteger;
-import java.text.DateFormatSymbols;
-import java.text.DecimalFormatSymbols;
-
-import gnu.classpath.SystemProperties;
-
-/**
- * <p>
- * A Java formatter for <code>printf</code>-style format strings,
- * as seen in the C programming language. This differs from the
- * C interpretation of such strings by performing much stricter
- * checking of format specifications and their corresponding
- * arguments. While unknown conversions will be ignored in C,
- * and invalid conversions will only produce compiler warnings,
- * the Java version utilises a full range of run-time exceptions to
- * handle these cases. The Java version is also more customisable
- * by virtue of the provision of the {@link Formattable} interface,
- * which allows an arbitrary class to be formatted by the formatter.
- * </p>
- * <p>
- * The formatter is accessible by more convienient static methods.
- * For example, streams now have appropriate format methods
- * (the equivalent of <code>fprintf</code>) as do <code>String</code>
- * objects (the equivalent of <code>sprintf</code>).
- * </p>
- * <p>
- * <strong>Note</strong>: the formatter is not thread-safe. For
- * multi-threaded access, external synchronization should be provided.
- * </p>
- *
- * @author Tom Tromey (tr...@re...)
- * @author Andrew John Hughes (gnu...@me...)
- * @since 1.5
- */
-public final class Formatter
- implements Closeable, Flushable
-{
-
- /**
- * The output of the formatter.
- */
- private Appendable out;
-
- /**
- * The locale used by the formatter.
- */
- private Locale locale;
-
- /**
- * Whether or not the formatter is closed.
- */
- private boolean closed;
-
- /**
- * The last I/O exception thrown by the output stream.
- */
- private IOException ioException;
-
- // Some state used when actually formatting.
- /**
- * The format string.
- */
- private String format;
-
- /**
- * The current index into the string.
- */
- private int index;
-
- /**
- * The length of the format string.
- */
- private int length;
-
- /**
- * The formatting locale.
- */
- private Locale fmtLocale;
-
- // Note that we include '-' twice. The flags are ordered to
- // correspond to the values in FormattableFlags, and there is no
- // flag (in the sense of this field used when parsing) for
- // UPPERCASE; the second '-' serves as a placeholder.
- /**
- * A string used to index into the formattable flags.
- */
- private static final String FLAGS = "--#+ 0,(";
-
- /**
- * The system line separator.
- */
- private static final String lineSeparator
- = SystemProperties.getProperty("line.separator");
-
- /**
- * The type of numeric output format for a {@link BigDecimal}.
- */
- public enum BigDecimalLayoutForm
- {
- DECIMAL_FLOAT,
- SCIENTIFIC
- }
-
- /**
- * Constructs a new <code>Formatter</code> using the default
- * locale and a {@link StringBuilder} as the output stream.
- */
- public Formatter()
- {
- this(null, Locale.getDefault());
- }
-
- /**
- * Constructs a new <code>Formatter</code> using the specified
- * locale and a {@link StringBuilder} as the output stream.
- * If the locale is <code>null</code>, then no localization
- * is applied.
- *
- * @param loc the locale to use.
- */
- public Formatter(Locale loc)
- {
- this(null, loc);
- }
-
- /**
- * Constructs a new <code>Formatter</code> using the default
- * locale and the specified output stream.
- *
- * @param app the output stream to use.
- */
- public Formatter(Appendable app)
- {
- this(app, Locale.getDefault());
- }
-
- /**
- * Constructs a new <code>Formatter</code> using the specified
- * locale and the specified output stream. If the locale is
- * <code>null</code>, then no localization is applied.
- *
- * @param app the output stream to use.
- * @param loc the locale to use.
- */
- public Formatter(Appendable app, Locale loc)
- {
- this.out = app == null ? new StringBuilder() : app;
- this.locale = loc;
- }
-
- /**
- * Constructs a new <code>Formatter</code> using the default
- * locale and character set, with the specified file as the
- * output stream.
- *
- * @param file the file to use for output.
- * @throws FileNotFoundException if the file does not exist
- * and can not be created.
- * @throws SecurityException if a security manager is present
- * and doesn't allow writing to the file.
- */
- public Formatter(File file)
- throws FileNotFoundException
- {
- this(new OutputStreamWriter(new FileOutputStream(file)));
- }
-
- /**
- * Constructs a new <code>Formatter</code> using the default
- * locale, with the specified file as the output stream
- * and the supplied character set.
- *
- * @param file the file to use for output.
- * @param charset the character set to use for output.
- * @throws FileNotFoundException if the file does not exist
- * and can not be created.
- * @throws SecurityException if a security manager is present
- * and doesn't allow writing to the file.
- * @throws UnsupportedEncodingException if the supplied character
- * set is not supported.
- */
- public Formatter(File file, String charset)
- throws FileNotFoundException, UnsupportedEncodingException
- {
- this(file, charset, Locale.getDefault());
- }
-
- /**
- * Constructs a new <code>Formatter</code> using the specified
- * file as the output stream with the supplied character set
- * and locale. If the locale is <code>null</code>, then no
- * localization is applied.
- *
- * @param file the file to use for output.
- * @param charset the character set to use for output.
- * @param loc the locale to use.
- * @throws FileNotFoundException if the file does not exist
- * and can not be created.
- * @throws SecurityException if a security manager is present
- * and doesn't allow writing to the file.
- * @throws UnsupportedEncodingException if the supplied character
- * set is not supported.
- */
- public Formatter(File file, String charset, Locale loc)
- throws FileNotFoundException, UnsupportedEncodingException
- {
- this(new OutputStreamWriter(new FileOutputStream(file), charset),
- loc);
- }
-
- /**
- * Constructs a new <code>Formatter</code> using the default
- * locale and character set, with the specified output stream.
- *
- * @param out the output stream to use.
- */
- public Formatter(OutputStream out)
- {
- this(new OutputStreamWriter(out));
- }
-
- /**
- * Constructs a new <code>Formatter</code> using the default
- * locale, with the specified file output stream and the
- * supplied character set.
- *
- * @param out the output stream.
- * @param charset the character set to use for output.
- * @throws UnsupportedEncodingException if the supplied character
- * set is not supported.
- */
- public Formatter(OutputStream out, String charset)
- throws UnsupportedEncodingException
- {
- this(out, charset, Locale.getDefault());
- }
-
- /**
- * Constructs a new <code>Formatter</code> using the specified
- * output stream with the supplied character set and locale.
- * If the locale is <code>null</code>, then no localization is
- * applied.
- *
- * @param file the output stream.
- * @param charset the character set to use for output.
- * @param loc the locale to use.
- * @throws UnsupportedEncodingException if the supplied character
- * set is not supported.
- */
- public Formatter(OutputStream out, String charset, Locale loc)
- throws UnsupportedEncodingException
- {
- this(new OutputStreamWriter(out, charset), loc);
- }
-
- /**
- * Constructs a new <code>Formatter</code> using the default
- * locale with the specified output stream. The character
- * set used is that of the output stream.
- *
- * @param out the output stream to use.
- */
- public Formatter(PrintStream out)
- {
- this((Appendable) out);
- }
-
- /**
- * Constructs a new <code>Formatter</code> using the default
- * locale and character set, with the specified file as the
- * output stream.
- *
- * @param file the file to use for output.
- * @throws FileNotFoundException if the file does not exist
- * and can not be created.
- * @throws SecurityException if a security manager is present
- * and doesn't allow writing to the file.
- */
- public Formatter(String file) throws FileNotFoundException
- {
- this(new OutputStreamWriter(new FileOutputStream(file)));
- }
-
- /**
- * Constructs a new <code>Formatter</code> using the default
- * locale, with the specified file as the output stream
- * and the supplied character set.
- *
- * @param file the file to use for output.
- * @param charset the character set to use for output.
- * @throws FileNotFoundException if the file does not exist
- * and can not be created.
- * @throws SecurityException if a security manager is present
- * and doesn't allow writing to the file.
- * @throws UnsupportedEncodingException if the supplied character
- * set is not supported.
- */
- public Formatter(String file, String charset)
- throws FileNotFoundException, UnsupportedEncodingException
- {
- this(file, charset, Locale.getDefault());
- }
-
- /**
- * Constructs a new <code>Formatter</code> using the specified
- * file as the output stream with the supplied character set
- * and locale. If the locale is <code>null</code>, then no
- * localization is applied.
- *
- * @param file the file to use for output.
- * @param charset the character set to use for output.
- * @param loc the locale to use.
- * @throws FileNotFoundException if the file does not exist
- * and can not be created.
- * @throws SecurityException if a security manager is present
- * and doesn't allow writing to the file.
- * @throws UnsupportedEncodingException if the supplied character
- * set is not supported.
- */
- public Formatter(String file, String charset, Locale loc)
- throws FileNotFoundException, UnsupportedEncodingException
- {
- this(new OutputStreamWriter(new FileOutputStream(file), charset),
- loc);
- }
-
- /**
- * Closes the formatter, so as to release used resources.
- * If the underlying output stream supports the {@link Closeable}
- * interface, then this is also closed. Attempts to use
- * a formatter instance, via any method other than
- * {@link #ioException()}, after closure results in a
- * {@link FormatterClosedException}.
- */
- public void close()
- {
- if (closed)
- return;
- try
- {
- if (out instanceof Closeable)
- ((Closeable) out).close();
- }
- catch (IOException _)
- {
- // FIXME: do we ignore these or do we set ioException?
- // The docs seem to indicate that we should ignore.
- }
- closed = true;
- }
-
- /**
- * Flushes the formatter, writing any cached data to the output
- * stream. If the underlying output stream supports the
- * {@link Flushable} interface, it is also flushed.
- *
- * @throws FormatterClosedException if the formatter is closed.
- */
- public void flush()
- {
- if (closed)
- throw new FormatterClosedException();
- try
- {
- if (out instanceof Flushable)
- ((Flushable) out).flush();
- }
- catch (IOException _)
- {
- // FIXME: do we ignore these or do we set ioException?
- // The docs seem to indicate that we should ignore.
- }
- }
-
- /**
- * Return the name corresponding to a flag.
- *
- * @param flags the flag to return the name of.
- * @return the name of the flag.
- */
- private String getName(int flags)
- {
- // FIXME: do we want all the flags in here?
- // Or should we redo how this is reported?
- int bit = Integer.numberOfTrailingZeros(flags);
- return FLAGS.substring(bit, bit + 1);
- }
-
- /**
- * Verify the flags passed to a conversion.
- *
- * @param flags the flags to verify.
- * @param allowed the allowed flags mask.
- * @param conversion the conversion character.
- */
- private void checkFlags(int flags, int allowed, char conversion)
- {
- flags &= ~allowed;
- if (flags != 0)
- throw new FormatFlagsConversionMismatchException(getName(flags),
- conversion);
- }
-
- /**
- * Throw an exception if a precision was specified.
- *
- * @param precision the precision value (-1 indicates not specified).
- */
- private void noPrecision(int precision)
- {
- if (precision != -1)
- throw new IllegalFormatPrecisionException(precision);
- }
-
- /**
- * Apply the numeric localization algorithm to a StringBuilder.
- *
- * @param builder the builder to apply to.
- * @param flags the formatting flags to use.
- * @param width the width of the numeric value.
- * @param isNegative true if the value is negative.
- */
- private void applyLocalization(StringBuilder builder, int flags, int width,
- boolean isNegative)
- {
- DecimalFormatSymbols dfsyms;
- if (fmtLocale == null)
- dfsyms = new DecimalFormatSymbols();
- else
- dfsyms = new DecimalFormatSymbols(fmtLocale);
-
- // First replace each digit.
- char zeroDigit = dfsyms.getZeroDigit();
- int decimalOffset = -1;
- for (int i = builder.length() - 1; i >= 0; --i)
- {
- char c = b...
[truncated message content] |
|
From: <ls...@us...> - 2007-09-06 19:12:36
|
Revision: 3465
http://jnode.svn.sourceforge.net/jnode/?rev=3465&view=rev
Author: lsantha
Date: 2007-09-06 12:12:35 -0700 (Thu, 06 Sep 2007)
Log Message:
-----------
openjdk integration
Removed Paths:
-------------
trunk/core/src/classpath/java/java/applet/
trunk/core/src/classpath/java/java/io/EOFException.java
trunk/core/src/classpath/java/java/io/Externalizable.java
trunk/core/src/classpath/java/java/io/FilenameFilter.java
trunk/core/src/classpath/java/java/io/StreamTokenizer.java
trunk/core/src/classpath/java/java/io/UTFDataFormatException.java
trunk/core/src/classpath/java/java/lang/Number.java
trunk/core/src/classpath/java/java/lang/Process.java
trunk/core/src/classpath/java/java/lang/ThreadDeath.java
trunk/core/src/classpath/java/java/net/BindException.java
trunk/core/src/classpath/java/java/net/ConnectException.java
trunk/core/src/classpath/java/java/net/ContentHandlerFactory.java
trunk/core/src/classpath/java/java/net/DatagramSocketImplFactory.java
trunk/core/src/classpath/java/java/net/FileNameMap.java
trunk/core/src/classpath/java/java/net/MalformedURLException.java
trunk/core/src/classpath/java/java/net/NoRouteToHostException.java
trunk/core/src/classpath/java/java/net/PortUnreachableException.java
trunk/core/src/classpath/java/java/net/ProtocolException.java
trunk/core/src/classpath/java/java/net/SocketException.java
trunk/core/src/classpath/java/java/net/SocketImplFactory.java
trunk/core/src/classpath/java/java/net/SocketOptions.java
trunk/core/src/classpath/java/java/net/SocketTimeoutException.java
trunk/core/src/classpath/java/java/net/URISyntaxException.java
trunk/core/src/classpath/java/java/net/URLStreamHandlerFactory.java
trunk/core/src/classpath/java/java/net/UnknownHostException.java
trunk/core/src/classpath/java/java/net/UnknownServiceException.java
trunk/core/src/classpath/java/java/security/AccessControlException.java
trunk/core/src/classpath/java/java/security/AlgorithmParameterGeneratorSpi.java
trunk/core/src/classpath/java/java/security/AlgorithmParametersSpi.java
trunk/core/src/classpath/java/java/security/Certificate.java
trunk/core/src/classpath/java/java/security/DigestException.java
trunk/core/src/classpath/java/java/security/DomainCombiner.java
trunk/core/src/classpath/java/java/security/DummyKeyPairGenerator.java
trunk/core/src/classpath/java/java/security/GeneralSecurityException.java
trunk/core/src/classpath/java/java/security/Guard.java
trunk/core/src/classpath/java/java/security/InvalidAlgorithmParameterException.java
trunk/core/src/classpath/java/java/security/InvalidKeyException.java
trunk/core/src/classpath/java/java/security/InvalidParameterException.java
trunk/core/src/classpath/java/java/security/Key.java
trunk/core/src/classpath/java/java/security/KeyException.java
trunk/core/src/classpath/java/java/security/KeyFactorySpi.java
trunk/core/src/classpath/java/java/security/KeyManagementException.java
trunk/core/src/classpath/java/java/security/KeyPair.java
trunk/core/src/classpath/java/java/security/KeyPairGenerator.java
trunk/core/src/classpath/java/java/security/KeyPairGeneratorSpi.java
trunk/core/src/classpath/java/java/security/KeyStoreException.java
trunk/core/src/classpath/java/java/security/NoSuchAlgorithmException.java
trunk/core/src/classpath/java/java/security/NoSuchProviderException.java
trunk/core/src/classpath/java/java/security/Principal.java
trunk/core/src/classpath/java/java/security/PrivateKey.java
trunk/core/src/classpath/java/java/security/PrivilegedAction.java
trunk/core/src/classpath/java/java/security/PrivilegedActionException.java
trunk/core/src/classpath/java/java/security/PrivilegedExceptionAction.java
trunk/core/src/classpath/java/java/security/ProviderException.java
trunk/core/src/classpath/java/java/security/PublicKey.java
trunk/core/src/classpath/java/java/security/SecureRandomSpi.java
trunk/core/src/classpath/java/java/security/SignatureException.java
trunk/core/src/classpath/java/java/text/Annotation.java
trunk/core/src/classpath/java/java/text/AttributedCharacterIterator.java
trunk/core/src/classpath/java/java/text/AttributedString.java
trunk/core/src/classpath/java/java/text/AttributedStringIterator.java
trunk/core/src/classpath/java/java/text/CharacterIterator.java
trunk/core/src/classpath/java/java/text/Format.java
trunk/core/src/classpath/java/java/text/MessageFormat.java
trunk/core/src/classpath/java/java/text/ParseException.java
trunk/core/src/classpath/java/java/text/ParsePosition.java
trunk/core/src/classpath/java/java/text/StringCharacterIterator.java
Deleted: trunk/core/src/classpath/java/java/io/EOFException.java
===================================================================
--- trunk/core/src/classpath/java/java/io/EOFException.java 2007-09-06 19:09:11 UTC (rev 3464)
+++ trunk/core/src/classpath/java/java/io/EOFException.java 2007-09-06 19:12:35 UTC (rev 3465)
@@ -1,76 +0,0 @@
-/* EOFException.java -- unexpected end of file exception
- 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 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.io;
-
-/**
- * This exception is thrown when the end of the file or stream was
- * encountered unexpectedly. This is not the normal way that an EOF
- * condition is reported; such as a special value like -1 being returned.
- * However, certain types of streams expecting certain data in a certain
- * format might reach EOF before reading their expected data pattern and
- * thus throw this exception.
- *
- * @author Aaron M. Renn (ar...@ur...)
- * @author Tom Tromey (tr...@cy...)
- * @status updated to 1.4
- */
-public class EOFException extends IOException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 6433858223774886977L;
-
- /**
- * Create an exception without a descriptive error message.
- */
- public EOFException()
- {
- }
-
- /**
- * Create an exception with a descriptive error message.
- *
- * @param message the descriptive error message
- */
- public EOFException(String message)
- {
- super(message);
- }
-} // class EOFException
Deleted: trunk/core/src/classpath/java/java/io/Externalizable.java
===================================================================
--- trunk/core/src/classpath/java/java/io/Externalizable.java 2007-09-06 19:09:11 UTC (rev 3464)
+++ trunk/core/src/classpath/java/java/io/Externalizable.java 2007-09-06 19:12:35 UTC (rev 3465)
@@ -1,107 +0,0 @@
-/* Externalizable.java -- Interface for saving and restoring object data
- Copyright (C) 1998 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.io;
-
-/**
- * This interface provides a way that classes can completely control how
- * the data of their object instances are written and read to and from
- * streams. It has two methods which are used to write the data to a stream
- * and to read the data from a stream. The read method must read the data
- * in exactly the way it was written by the write method.
- * <p>
- * Note that classes which implement this interface must take into account
- * that all superclass data must also be written to the stream as well.
- * The class implementing this interface must figure out how to make that
- * happen.
- * <p>
- * This interface can be used to provide object persistence. When an
- * object is to be stored externally, the <code>writeExternal</code> method is
- * called to save state. When the object is restored, an instance is
- * created using the default no-argument constructor and the
- * <code>readExternal</code> method is used to restore the state.
- *
- * @author Aaron M. Renn (ar...@ur...)
- */
-public interface Externalizable extends Serializable
-{
- /**
- * This method restores an object's state by reading in the instance data
- * for the object from the passed in stream. Note that this stream is not
- * a subclass of <code>InputStream</code>, but rather is a class that
- * implements
- * the <code>ObjectInput</code> interface. That interface provides a
- * mechanism for
- * reading in Java data types from a stream.
- * <p>
- * Note that this method must be compatible with <code>writeExternal</code>.
- * It must read back the exact same types that were written by that
- * method in the exact order they were written.
- * <p>
- * If this method needs to read back an object instance, then the class
- * for that object must be found and loaded. If that operation fails,
- * then this method throws a <code>ClassNotFoundException</code>
- *
- * @param in An <code>ObjectInput</code> instance for reading in the object
- * state
- *
- * @exception ClassNotFoundException If the class of an object being
- * restored cannot be found
- * @exception IOException If any other error occurs
- */
- void readExternal(ObjectInput in)
- throws ClassNotFoundException, IOException;
-
- /**
- * This method is responsible for writing the instance data of an object
- * to the passed in stream. Note that this stream is not a subclass of
- * <code>OutputStream</code>, but rather is a class that implements the
- * <code>ObjectOutput</code> interface. That interface provides a
- * number of methods
- * for writing Java data values to a stream.
- * <p>
- * Not that the implementation of this method must be coordinated with
- * the implementation of <code>readExternal</code>.
- *
- * @param out An <code>ObjectOutput</code> instance for writing the
- * object state
- *
- * @exception IOException If an error occurs
- */
- void writeExternal(ObjectOutput out) throws IOException;
-}
Deleted: trunk/core/src/classpath/java/java/io/FilenameFilter.java
===================================================================
--- trunk/core/src/classpath/java/java/io/FilenameFilter.java 2007-09-06 19:09:11 UTC (rev 3464)
+++ trunk/core/src/classpath/java/java/io/FilenameFilter.java 2007-09-06 19:12:35 UTC (rev 3465)
@@ -1,76 +0,0 @@
-/* FilenameFilter.java -- Filter a list of filenames
- Copyright (C) 1998, 1999, 2001, 2003, 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.io;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status: Complete to 1.1.
- */
-
-/**
- * This interface has one method which is used for filtering filenames
- * returned in a directory listing. It is currently used by the
- * <code>File.list(FilenameFilter)</code> method and by the filename
- * dialog in AWT.
- * <p>
- * The method in this interface determines if a particular file should
- * or should not be included in the file listing.
- *
- * @author Aaron M. Renn (ar...@ur...)
- * @author Tom Tromey (tr...@cy...)
- *
- * @see File#listFiles(java.io.FilenameFilter)
- * @see java.awt.FileDialog#setFilenameFilter(java.io.FilenameFilter)
- */
-public interface FilenameFilter
-{
- /**
- * This method determines whether or not a given file should be included
- * in a directory listing.
- *
- * @param dir The <code>File</code> instance for the directory being read
- * @param name The name of the file to test
- *
- * @return <code>true</code> if the file should be included in the list,
- * <code>false</code> otherwise.
- */
- boolean accept(File dir, String name);
-
-} // interface FilenameFilter
-
Deleted: trunk/core/src/classpath/java/java/io/StreamTokenizer.java
===================================================================
--- trunk/core/src/classpath/java/java/io/StreamTokenizer.java 2007-09-06 19:09:11 UTC (rev 3464)
+++ trunk/core/src/classpath/java/java/io/StreamTokenizer.java 2007-09-06 19:12:35 UTC (rev 3465)
@@ -1,716 +0,0 @@
-/* StreamTokenizer.java -- parses streams of characters into tokens
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 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 java.io;
-
-/**
- * This class parses streams of characters into tokens. There are a
- * million-zillion flags that can be set to control the parsing, as
- * described under the various method headings.
- *
- * @author Warren Levy (wa...@cy...)
- * @date October 25, 1998.
- */
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: Believed complete and correct.
- */
-
-public class StreamTokenizer
-{
- /** A constant indicating that the end of the stream has been read. */
- public static final int TT_EOF = -1;
-
- /** A constant indicating that the end of the line has been read. */
- public static final int TT_EOL = '\n';
-
- /** A constant indicating that a number token has been read. */
- public static final int TT_NUMBER = -2;
-
- /** A constant indicating that a word token has been read. */
- public static final int TT_WORD = -3;
-
- /** A constant indicating that no tokens have been read yet. */
- private static final int TT_NONE = -4;
-
- /**
- * Contains the type of the token read resulting from a call to nextToken
- * The rules are as follows:
- * <ul>
- * <li>For a token consisting of a single ordinary character, this is the
- * value of that character.</li>
- * <li>For a quoted string, this is the value of the quote character</li>
- * <li>For a word, this is TT_WORD</li>
- * <li>For a number, this is TT_NUMBER</li>
- * <li>For the end of the line, this is TT_EOL</li>
- * <li>For the end of the stream, this is TT_EOF</li>
- * </ul>
- */
- public int ttype = TT_NONE;
-
- /** The String associated with word and string tokens. */
- public String sval;
-
- /** The numeric value associated with number tokens. */
- public double nval;
-
- /* Indicates whether end-of-line is recognized as a token. */
- private boolean eolSignificant = false;
-
- /* Indicates whether word tokens are automatically made lower case. */
- private boolean lowerCase = false;
-
- /* Indicates whether C++ style comments are recognized and skipped. */
- private boolean slashSlash = false;
-
- /* Indicates whether C style comments are recognized and skipped. */
- private boolean slashStar = false;
-
- /* Attribute tables of each byte from 0x00 to 0xFF. */
- private boolean[] whitespace = new boolean[256];
- private boolean[] alphabetic = new boolean[256];
- private boolean[] numeric = new boolean[256];
- private boolean[] quote = new boolean[256];
- private boolean[] comment = new boolean[256];
-
- /* The Reader associated with this class. */
- private PushbackReader in;
-
- /* Indicates if a token has been pushed back. */
- private boolean pushedBack = false;
-
- /* Contains the current line number of the reader. */
- private int lineNumber = 1;
-
- /**
- * This method reads bytes from an <code>InputStream</code> and tokenizes
- * them. For details on how this method operates by default, see
- * <code>StreamTokenizer(Reader)</code>.
- *
- * @param is The <code>InputStream</code> to read from
- *
- * @deprecated Since JDK 1.1.
- */
- public StreamTokenizer(InputStream is)
- {
- this(new InputStreamReader(is));
- }
-
- /**
- * This method initializes a new <code>StreamTokenizer</code> to read
- * characters from a <code>Reader</code> and parse them. The char values
- * have their hight bits masked so that the value is treated a character
- * in the range of 0x0000 to 0x00FF.
- * <p>
- * This constructor sets up the parsing table to parse the stream in the
- * following manner:
- * <ul>
- * <li>The values 'A' through 'Z', 'a' through 'z' and 0xA0 through 0xFF
- * are initialized as alphabetic</li>
- * <li>The values 0x00 through 0x20 are initialized as whitespace</li>
- * <li>The values '\'' and '"' are initialized as quote characters</li>
- * <li>'/' is a comment character</li>
- * <li>Numbers will be parsed</li>
- * <li>EOL is not treated as significant</li>
- * <li>C and C++ (//) comments are not recognized</li>
- * </ul>
- *
- * @param r The <code>Reader</code> to read chars from
- */
- public StreamTokenizer(Reader r)
- {
- in = new PushbackReader(r);
-
- whitespaceChars(0x00, 0x20);
- wordChars('A', 'Z');
- wordChars('a', 'z');
- wordChars(0xA0, 0xFF);
- commentChar('/');
- quoteChar('\'');
- quoteChar('"');
- parseNumbers();
- }
-
- /**
- * This method sets the comment attribute on the specified
- * character. Other attributes for the character are cleared.
- *
- * @param ch The character to set the comment attribute for, passed as an int
- */
- public void commentChar(int ch)
- {
- if (ch >= 0 && ch <= 255)
- {
- comment[ch] = true;
- whitespace[ch] = false;
- alphabetic[ch] = false;
- numeric[ch] = false;
- quote[ch] = false;
- }
- }
-
- /**
- * This method sets a flag that indicates whether or not the end of line
- * sequence terminates and is a token. The defaults to <code>false</code>
- *
- * @param flag <code>true</code> if EOF is significant, <code>false</code>
- * otherwise
- */
- public void eolIsSignificant(boolean flag)
- {
- eolSignificant = flag;
- }
-
- /**
- * This method returns the current line number. Note that if the
- * <code>pushBack()</code> method is called, it has no effect on the
- * line number returned by this method.
- *
- * @return The current line number
- */
- public int lineno()
- {
- return lineNumber;
- }
-
- /**
- * This method sets a flag that indicates whether or not alphabetic
- * tokens that are returned should be converted to lower case.
- *
- * @param flag <code>true</code> to convert to lower case,
- * <code>false</code> otherwise
- */
- public void lowerCaseMode(boolean flag)
- {
- lowerCase = flag;
- }
-
- private boolean isWhitespace(int ch)
- {
- return (ch >= 0 && ch <= 255 && whitespace[ch]);
- }
-
- private boolean isAlphabetic(int ch)
- {
- return ((ch > 255) || (ch >= 0 && alphabetic[ch]));
- }
-
- private boolean isNumeric(int ch)
- {
- return (ch >= 0 && ch <= 255 && numeric[ch]);
- }
-
- private boolean isQuote(int ch)
- {
- return (ch >= 0 && ch <= 255 && quote[ch]);
- }
-
- private boolean isComment(int ch)
- {
- return (ch >= 0 && ch <= 255 && comment[ch]);
- }
-
- /**
- * This method reads the next token from the stream. It sets the
- * <code>ttype</code> variable to the appropriate token type and
- * returns it. It also can set <code>sval</code> or <code>nval</code>
- * as described below. The parsing strategy is as follows:
- * <ul>
- * <li>Skip any whitespace characters.</li>
- * <li>If a numeric character is encountered, attempt to parse a numeric
- * value. Leading '-' characters indicate a numeric only if followed by
- * another non-'-' numeric. The value of the numeric token is terminated
- * by either the first non-numeric encountered, or the second occurrence of
- * '-' or '.'. The token type returned is TT_NUMBER and <code>nval</code>
- * is set to the value parsed.</li>
- * <li>If an alphabetic character is parsed, all subsequent characters
- * are read until the first non-alphabetic or non-numeric character is
- * encountered. The token type returned is TT_WORD and the value parsed
- * is stored in <code>sval</code>. If lower case mode is set, the token
- * stored in <code>sval</code> is converted to lower case. The end of line
- * sequence terminates a word only if EOL signficance has been turned on.
- * The start of a comment also terminates a word. Any character with a
- * non-alphabetic and non-numeric attribute (such as white space, a quote,
- * or a commet) are treated as non-alphabetic and terminate the word.</li>
- * <li>If a comment character is parsed, then all remaining characters on
- * the current line are skipped and another token is parsed. Any EOL or
- * EOF's encountered are not discarded, but rather terminate the comment.</li>
- * <li>If a quote character is parsed, then all characters up to the
- * second occurrence of the same quote character are parsed into a
- * <code>String</code>. This <code>String</code> is stored as
- * <code>sval</code>, but is not converted to lower case, even if lower case
- * mode is enabled. The token type returned is the value of the quote
- * character encountered. Any escape sequences
- * (\b (backspace), \t (HTAB), \n (linefeed), \f (form feed), \r
- * (carriage return), \" (double quote), \' (single quote), \\
- * (backslash), \XXX (octal esacpe)) are converted to the appropriate
- * char values. Invalid esacape sequences are left in untranslated.
- * Unicode characters like ('\ u0000') are not recognized. </li>
- * <li>If the C++ comment sequence "//" is encountered, and the parser
- * is configured to handle that sequence, then the remainder of the line
- * is skipped and another token is read exactly as if a character with
- * the comment attribute was encountered.</li>
- * <li>If the C comment sequence "/*" is encountered, and the parser
- * is configured to handle that sequence, then all characters up to and
- * including the comment terminator sequence are discarded and another
- * token is parsed.</li>
- * <li>If all cases above are not met, then the character is an ordinary
- * character that is parsed as a token by itself. The char encountered
- * is returned as the token type.</li>
- * </ul>
- *
- * @return The token type
- * @exception IOException If an I/O error occurs
- */
- public int nextToken() throws IOException
- {
- if (pushedBack)
- {
- pushedBack = false;
- if (ttype != TT_NONE)
- return ttype;
- }
-
- sval = null;
- int ch;
-
- // Skip whitespace. Deal with EOL along the way.
- while (isWhitespace(ch = in.read()))
- if (ch == '\n' || ch == '\r')
- {
- lineNumber++;
-
- // Throw away \n if in combination with \r.
- if (ch == '\r' && (ch = in.read()) != '\n')
- {
- if (ch != TT_EOF)
- in.unread(ch);
- }
- if (eolSignificant)
- return (ttype = TT_EOL);
- }
-
- if (ch == '/')
- if ((ch = in.read()) == '/' && slashSlash)
- {
- while ((ch = in.read()) != '\n' && ch != '\r' && ch != TT_EOF)
- ;
-
- if (ch != TT_EOF)
- in.unread(ch);
- return nextToken(); // Recursive, but not too deep in normal cases
- }
- else if (ch == '*' && slashStar)
- {
- while (true)
- {
- ch = in.read();
- if (ch == '*')
- {
- if ((ch = in.read()) == '/')
- break;
- else if (ch != TT_EOF)
- in.unread(ch);
- }
- else if (ch == '\n' || ch == '\r')
- {
- lineNumber++;
- if (ch == '\r' && (ch = in.read()) != '\n')
- {
- if (ch != TT_EOF)
- in.unread(ch);
- }
- }
- else if (ch == TT_EOF)
- {
- break;
- }
- }
- return nextToken(); // Recursive, but not too deep in normal cases
- }
- else
- {
- if (ch != TT_EOF)
- in.unread(ch);
- ch = '/';
- }
-
- if (ch == TT_EOF)
- ttype = TT_EOF;
- else if (isNumeric(ch))
- {
- boolean isNegative = false;
- if (ch == '-')
- {
- // Read ahead to see if this is an ordinary '-' rather than numeric.
- ch = in.read();
- if (...
[truncated message content] |