[kaffe] CVS kaffe (dalibor): Resynced with GNU Classpath: gnu.* packages

Kaffe CVS cvs-commits at kaffe.org
Tue May 18 09:25:03 PDT 2004


PatchSet 4747 
Date: 2004/05/18 16:13:23
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: gnu.* packages

2004-05-18  Dalibor Topic  <robilad at kaffe.org>

* libraries/javalib/java/awt/image/DataBufferDouble.java,
        libraries/javalib/java/awt/image/DataBufferFloat.java,
        libraries/javalib/java/awt/image/DataBufferShort.java:
New files, taken from GNU Classpath.

* libraries/javalib/Makefile.am,
        libraries/javalib/Makefile.in:
Regenerated.

        * libraries/javalib/profiles/default/coreawt.files,
        libraries/javalib/profiles/default/moreawt.files,
libraries/javalib/profiles/allatonce/all.files
Added the new files.

        * libraries/javalib/gnu/java/io/decode/KaffeDecoder.java,
        libraries/javalib/gnu/java/io/encode/KaffeEncoder.java:
(KaffeDecoder) Adapted to pass encoding name to superclass constructor.

        * libraries/javalib/gnu/java/awt/Buffers.java,
        libraries/javalib/gnu/java/io/decode/Decoder.java,
        libraries/javalib/gnu/java/io/encode/Encoder.java,
        libraries/javalib/gnu/java/nio/channels/FileChannelImpl.java,
        libraries/javalib/gnu/java/nio/charset/UTF_16Decoder.java,
        libraries/javalib/gnu/java/security/der/DERReader.java,
        libraries/javalib/gnu/java/text/AttributedFormatBuffer.java,
        libraries/javalib/gnu/java/text/CharacterBreakIterator.java,
        libraries/javalib/gnu/java/text/FormatBuffer.java,
        libraries/javalib/gnu/java/text/StringFormatBuffer.java:
Resynced with GNU Classpath.

2004-04-28  Guilhem Lavaux <guilhem at kaffe.org>

* gnu/java/text/FormatBuffer.java,
gnu/java/text/AttributedFormatBuffer.java,
gnu/java/text/StringFormatBuffer.java: New classes to implement
attributed iterators in java.text.

2004-04-23  Tom Tromey  <tromey at redhat.com>

* gnu/java/text/CharacterBreakIterator.java: Removed
unused import.

2004-04-23  Mark Wielaard  <mark at klomp.org>

* gnu/java/security/der/DERReader.java: Call static methods staticly.

2004-05-02  Mark Wielaard  <mark at klomp.org>

* gnu/java/nio/channels/FileChannelImpl.java (finalize): New method.

2004-04-30  Mark Wielaard  <mark at klomp.org>

* gnu/java/nio/channels/FileChannelImpl.java (truncate): Only truncate
when size is smaller.

2004-04-23  Michael Koch  <konqueror at gmx.de>

* gnu/java/nio/channels/FileChannelImpl.java
(SET, CUR): Unused, removed.

2004-04-13  Jeroen Frijters <jeroen at frijters.net>

* gnu/java/nio/channels/FileChannelImpl.java:
(FileChannelImpl(int,int)) Made package private instead of private.

2004-04-23  Tom Tromey  <tromey at redhat.com>

* gnu/java/nio/charset/UTF_16Decoder.java (put): Removed
unused method.

2004-05-07  Michael Koch  <konqueror at gmx.de>

* gnu/java/io/decode/Decoder.java,
gnu/java/io/encode/Encoder.java:
Fixed javadocs all over.

2004-04-23  Mark Wielaard  <mark at klomp.org>

* gnu/java/io/decode/Decoder.java (scheme_name): Make non-static
private final.
(scheme_description): Removed.
(in): Make final.
(getSchemeName): Make non-static.
(getSchemeDescription): Removed.
(Decoder): Make protected and add name parameter.
* gnu/java/io/encode/Encoder.java (scheme_description): Remove field.
(scheme_name): Make non-static private final.
(out): Make final.
(getSchemeName): Make non-static.
(getSchemeDescription): Removed.
(Encoder): Make protected and add parameter name to initialize
scheme_name.

2004-04-14  Sascha Brawer  <brawer at dandelis.ch>

* java/awt/image/DataBufferShort.java,
java/awt/image/DataBufferFloat.java,
java/awt/image/DataBufferDouble.java: New files.

* gnu/java/awt/Buffers.java (createBuffer, createBufferFromData,
getData): Added supportfor TYPE_SHORT, TYPE_FLOAT and TYPE_DOUBLE.

Members: 
	ChangeLog:1.2320->1.2321 
	libraries/javalib/Makefile.am:1.186->1.187 
	libraries/javalib/Makefile.in:1.249->1.250 
	libraries/javalib/gnu/java/awt/Buffers.java:1.2->1.3 
	libraries/javalib/gnu/java/io/decode/Decoder.java:1.2->1.3 
	libraries/javalib/gnu/java/io/decode/KaffeDecoder.java:1.3->1.4 
	libraries/javalib/gnu/java/io/encode/Encoder.java:1.2->1.3 
	libraries/javalib/gnu/java/io/encode/KaffeEncoder.java:1.2->1.3 
	libraries/javalib/gnu/java/nio/channels/FileChannelImpl.java:1.1->1.2 
	libraries/javalib/gnu/java/nio/charset/UTF_16Decoder.java:1.1->1.2 
	libraries/javalib/gnu/java/security/der/DERReader.java:1.2->1.3 
	libraries/javalib/gnu/java/text/AttributedFormatBuffer.java:1.3->1.4 
	libraries/javalib/gnu/java/text/CharacterBreakIterator.java:1.2->1.3 
	libraries/javalib/gnu/java/text/FormatBuffer.java:1.3->1.4 
	libraries/javalib/gnu/java/text/StringFormatBuffer.java:1.3->1.4 
	libraries/javalib/java/awt/image/DataBufferDouble.java:INITIAL->1.1 
	libraries/javalib/java/awt/image/DataBufferFloat.java:INITIAL->1.1 
	libraries/javalib/java/awt/image/DataBufferShort.java:INITIAL->1.1 
	libraries/javalib/profiles/allatonce/all.files:1.44->1.45 
	libraries/javalib/profiles/default/coreawt.files:1.6->1.7 
	libraries/javalib/profiles/default/moreawt.files:1.4->1.5 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2320 kaffe/ChangeLog:1.2321
--- kaffe/ChangeLog:1.2320	Tue May 18 13:38:55 2004
+++ kaffe/ChangeLog	Tue May 18 16:13:23 2004
@@ -1,5 +1,109 @@
 2004-05-18  Dalibor Topic  <robilad at kaffe.org>
 
+	* libraries/javalib/java/awt/image/DataBufferDouble.java,
+        libraries/javalib/java/awt/image/DataBufferFloat.java,
+        libraries/javalib/java/awt/image/DataBufferShort.java:
+	New files, taken from GNU Classpath.
+	
+	* libraries/javalib/Makefile.am,
+        libraries/javalib/Makefile.in:
+	Regenerated.
+
+        * libraries/javalib/profiles/default/coreawt.files,
+        libraries/javalib/profiles/default/moreawt.files,
+	libraries/javalib/profiles/allatonce/all.files
+	Added the new files.
+
+        * libraries/javalib/gnu/java/io/decode/KaffeDecoder.java,
+        libraries/javalib/gnu/java/io/encode/KaffeEncoder.java:
+	(KaffeDecoder) Adapted to pass encoding name to superclass constructor.
+	
+        * libraries/javalib/gnu/java/awt/Buffers.java,
+        libraries/javalib/gnu/java/io/decode/Decoder.java,
+        libraries/javalib/gnu/java/io/encode/Encoder.java,
+        libraries/javalib/gnu/java/nio/channels/FileChannelImpl.java,
+        libraries/javalib/gnu/java/nio/charset/UTF_16Decoder.java,
+        libraries/javalib/gnu/java/security/der/DERReader.java,
+        libraries/javalib/gnu/java/text/AttributedFormatBuffer.java,
+        libraries/javalib/gnu/java/text/CharacterBreakIterator.java,
+        libraries/javalib/gnu/java/text/FormatBuffer.java,
+        libraries/javalib/gnu/java/text/StringFormatBuffer.java:
+	Resynced with GNU Classpath.
+	
+	2004-04-28  Guilhem Lavaux <guilhem at kaffe.org>
+
+	* gnu/java/text/FormatBuffer.java,
+	gnu/java/text/AttributedFormatBuffer.java,
+	gnu/java/text/StringFormatBuffer.java: New classes to implement
+	attributed iterators in java.text.
+
+	2004-04-23  Tom Tromey  <tromey at redhat.com>
+
+	* gnu/java/text/CharacterBreakIterator.java: Removed
+	unused import.
+
+	2004-04-23  Mark Wielaard  <mark at klomp.org>
+
+	* gnu/java/security/der/DERReader.java: Call static methods staticly.
+
+	2004-05-02  Mark Wielaard  <mark at klomp.org>
+
+	* gnu/java/nio/channels/FileChannelImpl.java (finalize): New method.
+
+	2004-04-30  Mark Wielaard  <mark at klomp.org>
+
+	* gnu/java/nio/channels/FileChannelImpl.java (truncate): Only truncate
+	when size is smaller.
+
+	2004-04-23  Michael Koch  <konqueror at gmx.de>
+
+	* gnu/java/nio/channels/FileChannelImpl.java
+	(SET, CUR): Unused, removed.
+
+	2004-04-13  Jeroen Frijters <jeroen at frijters.net>
+
+	* gnu/java/nio/channels/FileChannelImpl.java:
+	(FileChannelImpl(int,int)) Made package private instead of private.
+
+	2004-04-23  Tom Tromey  <tromey at redhat.com>
+
+	* gnu/java/nio/charset/UTF_16Decoder.java (put): Removed
+	unused method.
+
+	2004-05-07  Michael Koch  <konqueror at gmx.de>
+
+	* gnu/java/io/decode/Decoder.java,
+	gnu/java/io/encode/Encoder.java:
+	Fixed javadocs all over.
+
+	2004-04-23  Mark Wielaard  <mark at klomp.org>
+
+	* gnu/java/io/decode/Decoder.java (scheme_name): Make non-static
+	private final.
+	(scheme_description): Removed.
+	(in): Make final.
+	(getSchemeName): Make non-static.
+	(getSchemeDescription): Removed.
+	(Decoder): Make protected and add name parameter.
+	* gnu/java/io/encode/Encoder.java (scheme_description): Remove field.
+	(scheme_name): Make non-static private final.
+	(out): Make final.
+	(getSchemeName): Make non-static.
+	(getSchemeDescription): Removed.
+	(Encoder): Make protected and add parameter name to initialize
+	scheme_name.
+
+	2004-04-14  Sascha Brawer  <brawer at dandelis.ch>
+
+	* java/awt/image/DataBufferShort.java,
+	java/awt/image/DataBufferFloat.java,
+	java/awt/image/DataBufferDouble.java: New files.
+	
+	* gnu/java/awt/Buffers.java (createBuffer, createBufferFromData,
+	getData): Added support	for TYPE_SHORT, TYPE_FLOAT and TYPE_DOUBLE.
+
+2004-05-18  Dalibor Topic  <robilad at kaffe.org>
+
 	* libraries/javalib/Makefile.am,
         libraries/javalib/Makefile.in:
 	Regenerated.
Index: kaffe/libraries/javalib/Makefile.am
diff -u kaffe/libraries/javalib/Makefile.am:1.186 kaffe/libraries/javalib/Makefile.am:1.187
--- kaffe/libraries/javalib/Makefile.am:1.186	Tue May 18 13:39:00 2004
+++ kaffe/libraries/javalib/Makefile.am	Tue May 18 16:13:25 2004
@@ -902,8 +902,11 @@
 	java/awt/image/ComponentSampleModel.java \
 	java/awt/image/CropImageFilter.java \
 	java/awt/image/DataBufferByte.java \
+	java/awt/image/DataBufferDouble.java \
+	java/awt/image/DataBufferFloat.java \
 	java/awt/image/DataBufferInt.java \
 	java/awt/image/DataBuffer.java \
+	java/awt/image/DataBufferShort.java \
 	java/awt/image/DataBufferUShort.java \
 	java/awt/image/DirectColorModel.java \
 	java/awt/image/FilteredImageSource.java \
Index: kaffe/libraries/javalib/Makefile.in
diff -u kaffe/libraries/javalib/Makefile.in:1.249 kaffe/libraries/javalib/Makefile.in:1.250
--- kaffe/libraries/javalib/Makefile.in:1.249	Tue May 18 13:39:00 2004
+++ kaffe/libraries/javalib/Makefile.in	Tue May 18 16:13:26 2004
@@ -1246,8 +1246,11 @@
 	java/awt/image/ComponentSampleModel.java \
 	java/awt/image/CropImageFilter.java \
 	java/awt/image/DataBufferByte.java \
+	java/awt/image/DataBufferDouble.java \
+	java/awt/image/DataBufferFloat.java \
 	java/awt/image/DataBufferInt.java \
 	java/awt/image/DataBuffer.java \
+	java/awt/image/DataBufferShort.java \
 	java/awt/image/DataBufferUShort.java \
 	java/awt/image/DirectColorModel.java \
 	java/awt/image/FilteredImageSource.java \
Index: kaffe/libraries/javalib/gnu/java/awt/Buffers.java
diff -u kaffe/libraries/javalib/gnu/java/awt/Buffers.java:1.2 kaffe/libraries/javalib/gnu/java/awt/Buffers.java:1.3
--- kaffe/libraries/javalib/gnu/java/awt/Buffers.java:1.2	Mon Mar 22 11:24:09 2004
+++ kaffe/libraries/javalib/gnu/java/awt/Buffers.java	Tue May 18 16:13:27 2004
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002  Free Software Foundation
+/* Copyright (C) 2000, 2002, 2004  Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -36,10 +36,7 @@
 
 package gnu.java.awt;
 
-import java.awt.image.DataBuffer;
-import java.awt.image.DataBufferByte;
-import java.awt.image.DataBufferInt;
-import java.awt.image.DataBufferUShort;
+import java.awt.image.*;
 
 /** 
  * Utility class for creating and accessing data buffers of arbitrary
@@ -86,10 +83,16 @@
       {
       case DataBuffer.TYPE_BYTE:
 	return new DataBufferByte(size, numBanks);
+      case DataBuffer.TYPE_SHORT:
+	return new DataBufferShort(size, numBanks);
       case DataBuffer.TYPE_USHORT:
 	return new DataBufferUShort(size, numBanks);
       case DataBuffer.TYPE_INT:
 	return new DataBufferInt(size, numBanks);
+      case DataBuffer.TYPE_FLOAT:
+	return new DataBufferFloat(size, numBanks);
+      case DataBuffer.TYPE_DOUBLE:
+	return new DataBufferDouble(size, numBanks);
       default:
 	throw new UnsupportedOperationException();
       }
@@ -109,10 +112,16 @@
       {
       case DataBuffer.TYPE_BYTE:
 	return new DataBufferByte((byte[]) data, size);
+      case DataBuffer.TYPE_SHORT:
+	return new DataBufferShort((short[]) data, size);
       case DataBuffer.TYPE_USHORT:
 	return new DataBufferUShort((short[]) data, size);
       case DataBuffer.TYPE_INT:
 	return new DataBufferInt((int[]) data, size);
+      case DataBuffer.TYPE_FLOAT:
+	return new DataBufferFloat((float[]) data, size);
+      case DataBuffer.TYPE_DOUBLE:
+	return new DataBufferDouble((double[]) data, size);
       default:
 	throw new UnsupportedOperationException();
       }
@@ -129,10 +138,22 @@
   {
     if (buffer instanceof DataBufferByte)
       return ((DataBufferByte) buffer).getData();
+
+    if (buffer instanceof DataBufferShort)
+      return ((DataBufferShort) buffer).getData();
+
     if (buffer instanceof DataBufferUShort)
       return ((DataBufferUShort) buffer).getData();
+
     if (buffer instanceof DataBufferInt)
       return ((DataBufferInt) buffer).getData();
+
+    if (buffer instanceof DataBufferFloat)
+      return ((DataBufferFloat) buffer).getData();
+
+    if (buffer instanceof DataBufferDouble)
+      return ((DataBufferDouble) buffer).getData();
+
     throw new ClassCastException("Unknown data buffer type");
   }
 
@@ -152,6 +173,11 @@
 	from = ((DataBufferByte) src).getData();
 	if (dest == null) dest = new byte[length+destOffset];
       }
+    else if (src instanceof DataBufferShort)
+      {
+	from = ((DataBufferShort) src).getData();
+	if (dest == null) dest = new short[length+destOffset];
+      }
     else if (src instanceof DataBufferUShort)
       {
 	from = ((DataBufferUShort) src).getData();
@@ -161,6 +187,16 @@
       {
 	from = ((DataBufferInt) src).getData();
 	if (dest == null) dest = new int[length+destOffset];
+      }
+    else if (src instanceof DataBufferFloat)
+      {
+	from = ((DataBufferFloat) src).getData();
+	if (dest == null) dest = new float[length+destOffset];
+      }
+    else if (src instanceof DataBufferDouble)
+      {
+	from = ((DataBufferDouble) src).getData();
+	if (dest == null) dest = new double[length+destOffset];
       }
     else
       {
Index: kaffe/libraries/javalib/gnu/java/io/decode/Decoder.java
diff -u kaffe/libraries/javalib/gnu/java/io/decode/Decoder.java:1.2 kaffe/libraries/javalib/gnu/java/io/decode/Decoder.java:1.3
--- kaffe/libraries/javalib/gnu/java/io/decode/Decoder.java:1.2	Mon Mar 22 11:24:14 2004
+++ kaffe/libraries/javalib/gnu/java/io/decode/Decoder.java	Tue May 18 16:13:28 2004
@@ -1,5 +1,5 @@
 /* Decoder.java -- Base class for byte->char decoders
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -60,16 +60,9 @@
  */
 
 /**
-  * This is the name of the current encoding. MUST be overriden by
-  * subclasses.
+  * This is the name of the current encoding. Set in the constructor.
   */
-protected static String scheme_name = "undefined";
-
-/**
-  * This is a description of the current encoding.  MUST be overridden
-  * by subclasses.
-  */
-protected static String scheme_description = "undefined";
+private final String scheme_name;
 
 /*************************************************************************/
 
@@ -80,62 +73,46 @@
 /**
   * This is the <code>InputStream</code> bytes are read from
   */
-protected InputStream in;
+protected final InputStream in;
 
 /*************************************************************************/
 
 /*
- * Class Methods
+ * Constructors
  */
 
 /**
-  * This method returns the name of the encoding scheme in use
-  *
-  * @return The name of the encoding scheme
-  */
-public static String
-getSchemeName()
-{
-  return(scheme_name);
-}
-
-/*************************************************************************/
-
-/**
-  * This method returns a description of the encoding scheme in use
+  * This method initializes a new <code>Decoder</code> to read from the
+  * specified <code>InputStream</code>.
   *
-  * @param A description of the decoding scheme.
+  * @param in The <code>InputStream</code> to read from
+  * @param name The character scheme name
   */
-public static String
-getSchemeDescription()
+protected
+Decoder(InputStream in, String name)
 {
-  return(scheme_description);
+  this.in = in;
+  this.scheme_name = name;
 }
 
 /*************************************************************************/
 
 /*
- * Constructors
+ * Instance Methods
  */
 
 /**
-  * This method initializes a new <code>Decoder</code> to read from the
-  * specified <code>InputStream</code>.
+  * This method returns the name of the encoding scheme in use
   *
-  * @param in The <code>InputStream</code> to read from
+  * @return The name of the encoding scheme
   */
-public
-Decoder(InputStream in)
+public String
+getSchemeName()
 {
-  this.in = in;
+  return(scheme_name);
 }
 
 /*************************************************************************/
-
-/*
- * Instance Methods
- */
-
 /**
   * For a given set of bytes, this method returns the number of characters
   * that byte array will translate into.  If the bytes do not all translate 
@@ -197,7 +174,7 @@
 /*************************************************************************/
 
 /**
-  * This method converts <code>len<code> bytes from a specified array to
+  * This method converts <code>len</code> bytes from a specified array to
   * characters starting at index <code>offset</code> into the array.  The
   * results are returned in a newly allocated char array.
   *
Index: kaffe/libraries/javalib/gnu/java/io/decode/KaffeDecoder.java
diff -u kaffe/libraries/javalib/gnu/java/io/decode/KaffeDecoder.java:1.3 kaffe/libraries/javalib/gnu/java/io/decode/KaffeDecoder.java:1.4
--- kaffe/libraries/javalib/gnu/java/io/decode/KaffeDecoder.java:1.3	Mon Mar 22 11:24:14 2004
+++ kaffe/libraries/javalib/gnu/java/io/decode/KaffeDecoder.java	Tue May 18 16:13:28 2004
@@ -41,7 +41,7 @@
 KaffeDecoder(InputStream in, String enc)
    throws java.io.UnsupportedEncodingException
 {
-  super(in);
+  super(in, enc);
   // try {
       converter = ByteToCharConverter.getConverter(enc);
   // }
Index: kaffe/libraries/javalib/gnu/java/io/encode/Encoder.java
diff -u kaffe/libraries/javalib/gnu/java/io/encode/Encoder.java:1.2 kaffe/libraries/javalib/gnu/java/io/encode/Encoder.java:1.3
--- kaffe/libraries/javalib/gnu/java/io/encode/Encoder.java:1.2	Mon Mar 22 11:24:14 2004
+++ kaffe/libraries/javalib/gnu/java/io/encode/Encoder.java	Tue May 18 16:13:28 2004
@@ -1,5 +1,5 @@
 /* Encoder.java -- Base class for char->byte encoders
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -63,13 +63,7 @@
   * This is the name of the current encoding. MUST be overriden by
   * subclasses.
   */
-protected static String scheme_name = "undefined";
-
-/**
-  * This is a description of the current encoding.  MUST be overridden
-  * by subclasses.
-  */
-protected static String scheme_description = "undefined";
+private final String scheme_name;
 
 /*************************************************************************/
 
@@ -80,7 +74,7 @@
 /**
   * This is the <code>OutputStream</code> bytes are written to
   */
-protected OutputStream out;
+protected final OutputStream out;
 
 /**
   * This is the value that is substituted for bad characters that can't
@@ -104,7 +98,7 @@
   *
   * @return The name of the encoding scheme
   */
-public static String
+public String
 getSchemeName()
 {
   return(scheme_name);
@@ -112,19 +106,6 @@
 
 /*************************************************************************/
 
-/**
-  * This method returns a description of the encoding scheme in use
-  *
-  * @param A description of the decoding scheme.
-  */
-public static String
-getSchemeDescription()
-{
-  return(scheme_description);
-}
-
-/*************************************************************************/
-
 /*
  * Constructors
  */
@@ -133,12 +114,14 @@
   * This method initializes a new <code>Encoder</code> to write to the
   * specified <code>OutputStream</code>.
   *
+  * @param name The character scheme name
   * @param out The <code>OutputStream</code> to read from
   */
-public
-Encoder(OutputStream out)
+protected
+Encoder(OutputStream out, String name)
 {
   this.out = out;
+  this.scheme_name = name;
 }
 
 /*************************************************************************/
@@ -212,7 +195,7 @@
 /*************************************************************************/
 
 /**
-  * This method converts <code>len<code> chars from a specified array to
+  * This method converts <code>len</code> chars from a specified array to
   * bytes starting at index <code>offset</code> into the array.  The
   * results are returned in a newly allocated byte array.
   *
Index: kaffe/libraries/javalib/gnu/java/io/encode/KaffeEncoder.java
diff -u kaffe/libraries/javalib/gnu/java/io/encode/KaffeEncoder.java:1.2 kaffe/libraries/javalib/gnu/java/io/encode/KaffeEncoder.java:1.3
--- kaffe/libraries/javalib/gnu/java/io/encode/KaffeEncoder.java:1.2	Mon Mar 22 11:24:14 2004
+++ kaffe/libraries/javalib/gnu/java/io/encode/KaffeEncoder.java	Tue May 18 16:13:28 2004
@@ -48,7 +48,7 @@
 public
 KaffeEncoder(OutputStream out, String enc)
 {
-  super(out);
+  super(out, enc);
   try {
       converter = CharToByteConverter.getConverter(enc);
   }
Index: kaffe/libraries/javalib/gnu/java/nio/channels/FileChannelImpl.java
diff -u kaffe/libraries/javalib/gnu/java/nio/channels/FileChannelImpl.java:1.1 kaffe/libraries/javalib/gnu/java/nio/channels/FileChannelImpl.java:1.2
--- kaffe/libraries/javalib/gnu/java/nio/channels/FileChannelImpl.java:1.1	Mon Apr 12 11:40:24 2004
+++ kaffe/libraries/javalib/gnu/java/nio/channels/FileChannelImpl.java	Tue May 18 16:13:29 2004
@@ -60,13 +60,8 @@
  * Instances of this class are created by invoking getChannel
  * Upon a Input/Output/RandomAccessFile object.
  */
-
 public final class FileChannelImpl extends FileChannel
 {
-  // These are WHENCE values for seek.
-//   public static final int SET = 0;
-//   public static final int CUR = 1;
-
   // These are mode values for open().
   public static final int READ   = 1;
   public static final int WRITE  = 2;
@@ -97,11 +92,9 @@
   // However, this is necessary because if open() throws an exception
   // we want to make sure this has the value -1.  This is the most
   // efficient way to accomplish that.
-  int fd = -1;
+  private int fd = -1;
 
-  int mode;
-  int length;
-  long pos;
+  private int mode;
 
   public FileChannelImpl ()
   {
@@ -114,30 +107,38 @@
     this.mode = mode;
   }
 
+  /* Used by init() (native code) */
+  FileChannelImpl (int fd, int mode)
+  {
+    this.fd = fd;
+    this.mode = mode;
+  }
+
   public static FileChannelImpl in;
   public static FileChannelImpl out;
   public static FileChannelImpl err;
 
   private native int open (String path, int mode) throws FileNotFoundException;
 
-  /** Attach to an already-opened file.  */
-  public FileChannelImpl (int desc, int mode)
-  {
-    fd = desc;
-    this.mode = mode;
-  }
-
   public native int available () throws IOException;
-  private native long implPosition ();
-  private native void seek (long newPosition);
-  private native void implTruncate (long size);
+  private native long implPosition () throws IOException;
+  private native void seek (long newPosition) throws IOException;
+  private native void implTruncate (long size) throws IOException;
   
-  public native void unlock (long pos, long len);
+  public native void unlock (long pos, long len) throws IOException;
 
   public native long size () throws IOException;
     
   protected native void implCloseChannel() throws IOException;
 
+  /**
+   * Makes sure the Channel is properly closed.
+   */
+  protected void finalize() throws IOException
+  {
+    this.close();
+  }
+
   public int read (ByteBuffer dst) throws IOException
   {
     int result;
@@ -356,7 +357,7 @@
    * Otherwise return false.
    */
   private native boolean lock(long position, long size,
-			      boolean shared, boolean wait);
+			      boolean shared, boolean wait) throws IOException;
   
   public FileLock lock (long position, long size, boolean shared)
     throws IOException
@@ -420,7 +421,9 @@
     if ((mode & WRITE) == 0)
        throw new NonWritableChannelException ();
 
-    implTruncate (size);
+    if (size < size ())
+      implTruncate (size);
+
     return this;
   }
 }
Index: kaffe/libraries/javalib/gnu/java/nio/charset/UTF_16Decoder.java
diff -u kaffe/libraries/javalib/gnu/java/nio/charset/UTF_16Decoder.java:1.1 kaffe/libraries/javalib/gnu/java/nio/charset/UTF_16Decoder.java:1.2
--- kaffe/libraries/javalib/gnu/java/nio/charset/UTF_16Decoder.java:1.1	Thu Nov 28 13:39:26 2002
+++ kaffe/libraries/javalib/gnu/java/nio/charset/UTF_16Decoder.java	Tue May 18 16:13:30 2004
@@ -144,24 +144,6 @@
       }
   }
 
-  /**
-   * Writes <code>c</code> to <code>out</code> in the byte order
-   * specified by <code>byteOrder</code>.
-   **/
-  private void put (ByteBuffer out, char c)
-  {
-    if (byteOrder == BIG_ENDIAN)
-      {
-        out.put ((byte) (c >> 8));
-        out.put ((byte) (c & 0xFF));
-      }
-    else
-      {
-        out.put ((byte) (c & 0xFF));
-        out.put ((byte) (c >> 8));
-      }
-  }
-
   protected void implReset ()
   {
     byteOrder = originalByteOrder;
Index: kaffe/libraries/javalib/gnu/java/security/der/DERReader.java
diff -u kaffe/libraries/javalib/gnu/java/security/der/DERReader.java:1.2 kaffe/libraries/javalib/gnu/java/security/der/DERReader.java:1.3
--- kaffe/libraries/javalib/gnu/java/security/der/DERReader.java:1.2	Mon Mar 22 11:24:24 2004
+++ kaffe/libraries/javalib/gnu/java/security/der/DERReader.java	Tue May 18 16:13:31 2004
@@ -38,23 +38,26 @@
 
 package gnu.java.security.der;
 
-import gnu.java.security.OID;
-
 import java.io.BufferedInputStream;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.EOFException;
-import java.io.IOException;
 import java.io.InputStream;
+import java.io.IOException;
+
 import java.math.BigInteger;
+
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetDecoder;
+
 import java.util.Calendar;
 import java.util.Date;
 import java.util.TimeZone;
 
+import gnu.java.security.OID;
+
 /**
  * This class decodes DER sequences into Java objects. The methods of
  * this class do not have knowledge of higher-levels of structure in the
@@ -332,7 +335,7 @@
               Integer.parseInt(str.substring( 6,  8)),    // hour
               Integer.parseInt(str.substring( 8, 10)));   // minute
             if (date.length() == 12);
-              calendar.set(calendar.SECOND,
+              calendar.set(Calendar.SECOND,
                 Integer.parseInt(str.substring(10, 12)));
           }
         catch (NumberFormatException nfe)
@@ -359,13 +362,13 @@
                 case 18:
                 case 17:
                 case 16:
-                  calendar.set(calendar.MILLISECOND,
+                  calendar.set(Calendar.MILLISECOND,
                     Integer.parseInt(date.substring(15)));
                 case 14:
-                  calendar.set(calendar.SECOND,
+                  calendar.set(Calendar.SECOND,
                     Integer.parseInt(date.substring(12, 14)));
                 case 12:
-                  calendar.set(calendar.MINUTE,
+                  calendar.set(Calendar.MINUTE,
                     Integer.parseInt(date.substring(10, 12)));
               }
           }
Index: kaffe/libraries/javalib/gnu/java/text/AttributedFormatBuffer.java
diff -u kaffe/libraries/javalib/gnu/java/text/AttributedFormatBuffer.java:1.3 kaffe/libraries/javalib/gnu/java/text/AttributedFormatBuffer.java:1.4
--- kaffe/libraries/javalib/gnu/java/text/AttributedFormatBuffer.java:1.3	Wed Mar 24 20:23:58 2004
+++ kaffe/libraries/javalib/gnu/java/text/AttributedFormatBuffer.java	Tue May 18 16:13:31 2004
@@ -40,6 +40,12 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 
+/**
+ * This class is an implementation of a FormatBuffer with attributes.
+ * 
+ * @author Guilhem Lavaux <guilhem at kaffe.org>
+ * @date April 10, 2004
+ */
 public class AttributedFormatBuffer implements FormatBuffer
 {
   private StringBuffer buffer;
@@ -50,13 +56,23 @@
   private int startingRange;
   AttributedCharacterIterator.Attribute defaultAttr;
 
+  /**
+   * This constructor accepts a StringBuffer. If the buffer contains
+   * already some characters they will not be attributed. 
+   */
   public AttributedFormatBuffer(StringBuffer buffer)
   {
     this.buffer = buffer;
     this.ranges = new ArrayList();
     this.attributes = new ArrayList();
     this.defaultAttr = null;
-    this.startingRange = -1;
+    if (buffer.length() != 0)
+      {
+	this.startingRange = buffer.length();
+	addAttribute(buffer.length(), null);
+      }
+    else
+      this.startingRange = -1;
   }
 
   public AttributedFormatBuffer(int prebuffer)
@@ -178,6 +194,10 @@
     startingRange = -1;
   }
 
+  /**
+   * This method synchronizes the state of the attribute array.
+   * After calling it you may call {@link #getDefaultAttribute()}.
+   */
   public void sync()
   {
     if (startingRange < 0 || startingRange == buffer.length())
@@ -193,16 +213,33 @@
     System.arraycopy(attributes.toArray(), 0, a_attributes, 0, a_attributes.length);
   }
 
+  /**
+   * This method returns the internal StringBuffer describing
+   * the attributed string.
+   *
+   * @return An instance of StringBuffer which contains the string.
+   */
   public StringBuffer getBuffer()
   {
     return buffer;
   }
-  
+
+  /**
+   * This method returns the ranges for the attributes.
+   *
+   * @return An array of int describing the ranges.
+   */
   public int[] getRanges()
   {
     return a_ranges;
   }
 
+  /**
+   * This method returns the array containing the map on the 
+   * attributes.
+   *
+   * @return An array of {@link java.util.Map} containing the attributes.
+   */
   public HashMap[] getAttributes()
   {
     return a_attributes;
Index: kaffe/libraries/javalib/gnu/java/text/CharacterBreakIterator.java
diff -u kaffe/libraries/javalib/gnu/java/text/CharacterBreakIterator.java:1.2 kaffe/libraries/javalib/gnu/java/text/CharacterBreakIterator.java:1.3
--- kaffe/libraries/javalib/gnu/java/text/CharacterBreakIterator.java:1.2	Mon Mar 22 11:24:26 2004
+++ kaffe/libraries/javalib/gnu/java/text/CharacterBreakIterator.java	Tue May 18 16:13:31 2004
@@ -160,7 +160,6 @@
     if (iter.getIndex() == iter.getBeginIndex())
       return DONE;
 
-    int start = iter.getBeginIndex();
     while (iter.getIndex() >= iter.getBeginIndex())
       {
 	char c = iter.previous();
Index: kaffe/libraries/javalib/gnu/java/text/FormatBuffer.java
diff -u kaffe/libraries/javalib/gnu/java/text/FormatBuffer.java:1.3 kaffe/libraries/javalib/gnu/java/text/FormatBuffer.java:1.4
--- kaffe/libraries/javalib/gnu/java/text/FormatBuffer.java:1.3	Wed Mar 24 20:23:58 2004
+++ kaffe/libraries/javalib/gnu/java/text/FormatBuffer.java	Tue May 18 16:13:31 2004
@@ -39,17 +39,98 @@
 import java.text.AttributedCharacterIterator;
 import java.util.HashMap;
 
+/**
+ * This interface describes a modifiable buffer which contains attributed
+ * characters. The implementation may or may not implements attributes. It
+ * aims to greatly simplify and clarify the implementation of java.text 
+ * formatters. The buffer may be appended or have its tail cut. It may also
+ * be completely cleant up.
+ *
+ * @author Guilhem Lavaux <guilhem at kaffe.org>
+ * @date April 10, 2004
+ */
 public interface FormatBuffer 
 {
+  /**
+   * This method appends a simple string to the buffer. This part of
+   * the buffer will be attributed using the default attribute.
+   *
+   * @param s The string to append to the buffer.
+   */
   public void append(String s);
+
+  /**
+   * This method appends a simple string to the buffer. This part of
+   * the buffer will have the specified attribute (and only this one).
+   * The default attribute may be changed after calling this method.
+   *
+   * @param s The string to append to the buffer.
+   * @param attr Attribute to use for the string in the buffer.
+   */
   public void append(String s, AttributedCharacterIterator.Attribute attr);
+
+  /**
+   * This method appends a simple string to the buffer. This part of
+   * the buffer will be attributed using the specified ranges and attributes.
+   * To have an example on how to specify ranges see {@link gnu.java.text.FormatCharacterIterator}. 
+   * 
+   * @param s The string to append to the buffer.
+   * @param ranges The ranges describing how the attributes should be applied
+   * to the string.
+   * @param attrs The attributes of the string in the buffer.
+   */
   public void append(String s, int[] ranges, HashMap[] attrs);
+
+  /**
+   * This method appends a simple char to the buffer. This part of
+   * the buffer will be attributed using the default attribute.
+   *
+   * @param c The character to append to the buffer.
+   */
   public void append(char c);
+
+  /**
+   * This method appends a simple character to the buffer. This part of
+   * the buffer will have the specified attribute (and only this one).
+   * The default attribute may be changed after calling this method.
+   *
+   * @param c The character to append to the buffer.
+   * @param attr Attribute to use for the character in the buffer.
+   */
   public void append(char c, AttributedCharacterIterator.Attribute attr);
+
+  /**
+   * This method changes the current default attribute for the next string
+   * or character which will be appended to the buffer.
+   *
+   * @param attr The attribute which will be used by default.
+   */
   public void setDefaultAttribute(AttributedCharacterIterator.Attribute attr);
+
+  /**
+   * This method returns the current default attribute for the buffer.
+   *
+   * @return The default attribute for the buffer.
+   */
   public AttributedCharacterIterator.Attribute getDefaultAttribute();
+
+  /**
+   * This method cuts the last characters of the buffer. The number of
+   * characters to cut is given by "length".

*** Patch too long, truncated ***




More information about the kaffe mailing list