diff options
Diffstat (limited to 'gnu/java')
631 files changed, 13480 insertions, 13608 deletions
diff --git a/gnu/java/awt/AWTUtilities.java b/gnu/java/awt/AWTUtilities.java index dcebc67fa..1b308cef4 100644 --- a/gnu/java/awt/AWTUtilities.java +++ b/gnu/java/awt/AWTUtilities.java @@ -57,7 +57,7 @@ import java.util.WeakHashMap; import java.lang.reflect.InvocationTargetException; /** - * This class mirrors the javax.swing.SwingUtilities class. It + * This class mirrors the javax.swing.SwingUtilities class. It * provides commonly needed functionalities for AWT classes without * the need to reference classes in the javax.swing package. */ @@ -91,13 +91,13 @@ public class AWTUtilities */ VisibleComponentIterator(int listIndex) { - this.listIndex = listIndex; - int visibleComponentsFound = 0; - for (index = 0; visibleComponentsFound != listIndex; index++) - { - if (components[index].isVisible()) - visibleComponentsFound++; - } + this.listIndex = listIndex; + int visibleComponentsFound = 0; + for (index = 0; visibleComponentsFound != listIndex; index++) + { + if (components[index].isVisible()) + visibleComponentsFound++; + } } /** @@ -109,16 +109,16 @@ public class AWTUtilities */ public boolean hasNext() { - boolean hasNext = false; - for (int i = index; i < components.length; i++) - { - if (components[i].isVisible()) - { - hasNext = true; - break; - } - } - return hasNext; + boolean hasNext = false; + for (int i = index; i < components.length; i++) + { + if (components[i].isVisible()) + { + hasNext = true; + break; + } + } + return hasNext; } /** @@ -130,23 +130,23 @@ public class AWTUtilities */ public Object next() { - Object o = null; - for (; index < components.length; index++) - { - if (components[index].isVisible()) - { - o = components[index]; - break; - } - } - if (o != null) - { - index++; - listIndex++; - return o; - } - else - throw new NoSuchElementException(); + Object o = null; + for (; index < components.length; index++) + { + if (components[index].isVisible()) + { + o = components[index]; + break; + } + } + if (o != null) + { + index++; + listIndex++; + return o; + } + else + throw new NoSuchElementException(); } /** @@ -158,16 +158,16 @@ public class AWTUtilities */ public boolean hasPrevious() { - boolean hasPrevious = false; - for (int i = index - 1; i >= 0; i--) - { - if (components[i].isVisible()) - { - hasPrevious = true; - break; - } - } - return hasPrevious; + boolean hasPrevious = false; + for (int i = index - 1; i >= 0; i--) + { + if (components[i].isVisible()) + { + hasPrevious = true; + break; + } + } + return hasPrevious; } /** @@ -179,22 +179,22 @@ public class AWTUtilities */ public Object previous() { - Object o = null; - for (index--; index >= 0; index--) - { - if (components[index].isVisible()) - { - o = components[index]; - break; - } - } - if (o != null) - { - listIndex--; - return o; - } - else - throw new NoSuchElementException(); + Object o = null; + for (index--; index >= 0; index--) + { + if (components[index].isVisible()) + { + o = components[index]; + break; + } + } + if (o != null) + { + listIndex--; + return o; + } + else + throw new NoSuchElementException(); } /** @@ -204,7 +204,7 @@ public class AWTUtilities */ public int nextIndex() { - return listIndex + 1; + return listIndex + 1; } /** @@ -214,7 +214,7 @@ public class AWTUtilities */ public int previousIndex() { - return listIndex - 1; + return listIndex - 1; } /** @@ -224,8 +224,8 @@ public class AWTUtilities */ public void remove() { - throw new UnsupportedOperationException - ("VisibleComponentList is immutable"); + throw new UnsupportedOperationException + ("VisibleComponentList is immutable"); } /** @@ -237,8 +237,8 @@ public class AWTUtilities */ public void set(Object o) { - throw new UnsupportedOperationException - ("VisibleComponentList is immutable"); + throw new UnsupportedOperationException + ("VisibleComponentList is immutable"); } /** @@ -250,8 +250,8 @@ public class AWTUtilities */ public void add(Object o) { - throw new UnsupportedOperationException - ("VisibleComponentList is immutable"); + throw new UnsupportedOperationException + ("VisibleComponentList is immutable"); } } @@ -291,8 +291,8 @@ public class AWTUtilities { int visibleComponents = 0; for (int i = 0; i < components.length; i++) - if (components[i].isVisible()) - visibleComponents++; + if (components[i].isVisible()) + visibleComponents++; return visibleComponents; } } @@ -322,8 +322,8 @@ public class AWTUtilities VisibleComponentList visibleChildren = null; if (o == null) { - visibleChildren = new VisibleComponentList(children); - visibleChildrenCache.put(children, visibleChildren); + visibleChildren = new VisibleComponentList(children); + visibleChildrenCache.put(children, visibleChildren); } else visibleChildren = (VisibleComponentList) o; @@ -419,8 +419,8 @@ public class AWTUtilities * * @see #getAncestorOfClass * @see #windowForComponent - * @see - * + * @see + * */ public static Container getAncestorOfClass(Class c, Component comp) { @@ -432,7 +432,7 @@ public class AWTUtilities /** * Equivalent to calling <code>getAncestorOfClass(Window, comp)</code>. * - * @param comp The component to search for an ancestor window + * @param comp The component to search for an ancestor window * * @return An ancestral window, or <code>null</code> if none exists */ @@ -500,7 +500,7 @@ public class AWTUtilities * <code>(x,y)</code>. Returns <code>null</code> when either * <code>(x,y)</code> is outside the bounds of parent, or parent is * <code>null</code>. - * + * * @param parent The component to search the descendents of * @param x Horizontal coordinate to search for * @param y Vertical coordinate to search for @@ -593,7 +593,7 @@ public class AWTUtilities if (destination == null) destination = getRoot(source); - + if (source.isShowing() && destination.isShowing()) { convertPointToScreen(pt, source); @@ -603,7 +603,7 @@ public class AWTUtilities return pt; } - + /** * Converts a rectangle from the coordinate space of one component to * another. This is equivalent to converting the rectangle from @@ -668,18 +668,18 @@ public class AWTUtilities } - /** + /** * Calls {@link java.awt.EventQueue.invokeLater} with the - * specified {@link Runnable}. + * specified {@link Runnable}. */ public static void invokeLater(Runnable doRun) { java.awt.EventQueue.invokeLater(doRun); } - /** + /** * Calls {@link java.awt.EventQueue.invokeAndWait} with the - * specified {@link Runnable}. + * specified {@link Runnable}. */ public static void invokeAndWait(Runnable doRun) throws InterruptedException, @@ -688,7 +688,7 @@ public class AWTUtilities java.awt.EventQueue.invokeAndWait(doRun); } - /** + /** * Calls {@link java.awt.EventQueue.isEventDispatchThread}. */ public static boolean isEventDispatchThread() diff --git a/gnu/java/awt/BitMaskExtent.java b/gnu/java/awt/BitMaskExtent.java index 281349910..be66fccc6 100644 --- a/gnu/java/awt/BitMaskExtent.java +++ b/gnu/java/awt/BitMaskExtent.java @@ -36,7 +36,7 @@ exception statement from your version. */ package gnu.java.awt; -/** +/** * Simple transparent utility class that can be used to perform bit * mask extent calculations. */ @@ -47,7 +47,7 @@ public final class BitMaskExtent /** The number of bits in the bit mask extent. */ public byte bitWidth; - + /** * Set the bit mask. This will calculate and set the leastSignificantBit * and bitWidth fields. @@ -63,17 +63,17 @@ public final class BitMaskExtent long shiftMask = mask; for (; (shiftMask&1) == 0; shiftMask >>>=1) leastSignificantBit++; for (; (shiftMask&1) != 0; shiftMask >>>=1) bitWidth++; - + if (shiftMask != 0) throw new IllegalArgumentException("mask must be continuous"); } - - /** + + /** * Calculate the bit mask based on the values of the * leastSignificantBit and bitWidth fields. */ public long toMask() { return ((1<<bitWidth)-1) << leastSignificantBit; - } + } } diff --git a/gnu/java/awt/BitwiseXORComposite.java b/gnu/java/awt/BitwiseXORComposite.java index 9205df1dd..e19b27fa9 100644 --- a/gnu/java/awt/BitwiseXORComposite.java +++ b/gnu/java/awt/BitwiseXORComposite.java @@ -63,7 +63,7 @@ import java.awt.image.WritableRaster; * white, blue, black, orange, green, and brown, respectively. Each * composite was used to paint a fully white rectangle on top of the * blue bar in the background. - * + * * <p>The purpose of this composite is to support the {@link * Graphics#setXORMode(Color)} method in composite-aware graphics * implementations. Applications typically would use @@ -96,7 +96,7 @@ public class BitwiseXORComposite */ protected Color xorColor; - + /** * Constructs a new composite for xor-ing the pixel value. * @@ -128,7 +128,7 @@ public class BitwiseXORComposite return new GeneralContext(srcColorModel, dstColorModel, xorColor); } - + /** * A fallback CompositeContext that performs bitwise XOR of pixel * values with the pixel value of the specified <code>xorColor</code>. @@ -164,7 +164,7 @@ public class BitwiseXORComposite Rectangle srcRect = src.getBounds(); Rectangle dstInRect = dstIn.getBounds(); Rectangle dstOutRect = dstOut.getBounds(); - + int xp = xorColor.getRGB(); int w = Math.min(Math.min(srcRect.width, dstOutRect.width), dstInRect.width); @@ -186,7 +186,7 @@ public class BitwiseXORComposite int sp = srcColorModel.getRGB(srcPix); int dp = dstColorModel.getRGB(dstPix); int rp = sp ^ xp ^ dp; - dstOut.setDataElements(x + dstOutRect.x, y + dstOutRect.y, + dstOut.setDataElements(x + dstOutRect.x, y + dstOutRect.y, dstColorModel.getDataElements(rp, rpPix)); } } @@ -249,7 +249,7 @@ public class BitwiseXORComposite srcLine = new int[width]; dstLine = new int[width]; - + /* We need an int[] array with at least one element here; * srcLine is as good as any other. */ @@ -268,7 +268,7 @@ public class BitwiseXORComposite } } - + /** * Determines whether an instance of this CompositeContext would * be able to process the specified color models. diff --git a/gnu/java/awt/Buffers.java b/gnu/java/awt/Buffers.java index 2015634bb..0c8d438c7 100644 --- a/gnu/java/awt/Buffers.java +++ b/gnu/java/awt/Buffers.java @@ -46,7 +46,7 @@ import java.awt.image.DataBufferInt; import java.awt.image.DataBufferShort; import java.awt.image.DataBufferUShort; -/** +/** * Utility class for creating and accessing data buffers of arbitrary * data types. */ @@ -60,7 +60,7 @@ public final class Buffers * @param size the size of the data buffer bank */ public static DataBuffer createBuffer(int dataType, Object data, - int size) + int size) { if (data == null) return createBuffer(dataType, size, 1); @@ -90,22 +90,22 @@ public final class Buffers switch (dataType) { case DataBuffer.TYPE_BYTE: - return new DataBufferByte(size, numBanks); + return new DataBufferByte(size, numBanks); case DataBuffer.TYPE_SHORT: - return new DataBufferShort(size, numBanks); + return new DataBufferShort(size, numBanks); case DataBuffer.TYPE_USHORT: - return new DataBufferUShort(size, numBanks); + return new DataBufferUShort(size, numBanks); case DataBuffer.TYPE_INT: - return new DataBufferInt(size, numBanks); + return new DataBufferInt(size, numBanks); case DataBuffer.TYPE_FLOAT: - return new DataBufferFloat(size, numBanks); + return new DataBufferFloat(size, numBanks); case DataBuffer.TYPE_DOUBLE: - return new DataBufferDouble(size, numBanks); + return new DataBufferDouble(size, numBanks); default: - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException(); } } - + /** * Create a data buffer of a particular type. * @@ -114,28 +114,28 @@ public final class Buffers * @param size the size of the data buffer bank */ public static DataBuffer createBufferFromData(int dataType, Object data, - int size) + int size) { switch (dataType) { case DataBuffer.TYPE_BYTE: - return new DataBufferByte((byte[]) data, size); + return new DataBufferByte((byte[]) data, size); case DataBuffer.TYPE_SHORT: - return new DataBufferShort((short[]) data, size); + return new DataBufferShort((short[]) data, size); case DataBuffer.TYPE_USHORT: - return new DataBufferUShort((short[]) data, size); + return new DataBufferUShort((short[]) data, size); case DataBuffer.TYPE_INT: - return new DataBufferInt((int[]) data, size); + return new DataBufferInt((int[]) data, size); case DataBuffer.TYPE_FLOAT: - return new DataBufferFloat((float[]) data, size); + return new DataBufferFloat((float[]) data, size); case DataBuffer.TYPE_DOUBLE: - return new DataBufferDouble((double[]) data, size); + return new DataBufferDouble((double[]) data, size); default: - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException(); } } - /** + /** * Return the data array of a data buffer, regardless of the data * type. * @@ -147,56 +147,56 @@ public final class Buffers return getData(buffer, 0, null, 0, buffer.getSize()); } - + /** * Copy data from array contained in data buffer, much like * System.arraycopy. Create a suitable destination array if the * given destination array is null. */ public static Object getData(DataBuffer src, int srcOffset, - Object dest, int dstOffset, - int length) + Object dest, int dstOffset, + int length) { Object from; switch(src.getDataType()) { case DataBuffer.TYPE_BYTE: - if (dest == null) dest = new byte[length+dstOffset]; - for(int i = 0; i < length; i++) - ((byte[])dest)[i + dstOffset] = (byte)src.getElem(i + srcOffset); - break; + if (dest == null) dest = new byte[length+dstOffset]; + for(int i = 0; i < length; i++) + ((byte[])dest)[i + dstOffset] = (byte)src.getElem(i + srcOffset); + break; case DataBuffer.TYPE_DOUBLE: - if (dest == null) dest = new double[length+dstOffset]; - for(int i = 0; i < length; i++) - ((double[])dest)[i + dstOffset] = src.getElemDouble(i + srcOffset); - break; + if (dest == null) dest = new double[length+dstOffset]; + for(int i = 0; i < length; i++) + ((double[])dest)[i + dstOffset] = src.getElemDouble(i + srcOffset); + break; case DataBuffer.TYPE_FLOAT: - if (dest == null) dest = new float[length+dstOffset]; - for(int i = 0; i < length; i++) - ((float[])dest)[i + dstOffset] = src.getElemFloat(i + srcOffset); - break; + if (dest == null) dest = new float[length+dstOffset]; + for(int i = 0; i < length; i++) + ((float[])dest)[i + dstOffset] = src.getElemFloat(i + srcOffset); + break; case DataBuffer.TYPE_INT: - if (dest == null) dest = new int[length+dstOffset]; - for(int i = 0; i < length; i++) - ((int[])dest)[i + dstOffset] = src.getElem(i + srcOffset); - break; + if (dest == null) dest = new int[length+dstOffset]; + for(int i = 0; i < length; i++) + ((int[])dest)[i + dstOffset] = src.getElem(i + srcOffset); + break; case DataBuffer.TYPE_SHORT: case DataBuffer.TYPE_USHORT: - if (dest == null) dest = new short[length+dstOffset]; - for(int i = 0; i < length; i++) - ((short[])dest)[i + dstOffset] = (short)src.getElem(i + srcOffset); - break; + if (dest == null) dest = new short[length+dstOffset]; + for(int i = 0; i < length; i++) + ((short[])dest)[i + dstOffset] = (short)src.getElem(i + srcOffset); + break; case DataBuffer.TYPE_UNDEFINED: - throw new ClassCastException("Unknown data buffer type"); + throw new ClassCastException("Unknown data buffer type"); } return dest; } - + /** * @param bits the width of a data element measured in bits * @@ -207,19 +207,19 @@ public final class Buffers { if (bits <= 8) { - return DataBuffer.TYPE_BYTE; + return DataBuffer.TYPE_BYTE; } else if (bits <= 16) { - return DataBuffer.TYPE_USHORT; - } + return DataBuffer.TYPE_USHORT; + } else if (bits <= 32) { - return DataBuffer.TYPE_INT; + return DataBuffer.TYPE_INT; } else { - return DataBuffer.TYPE_UNDEFINED; + return DataBuffer.TYPE_UNDEFINED; } } } diff --git a/gnu/java/awt/ClasspathGraphicsEnvironment.java b/gnu/java/awt/ClasspathGraphicsEnvironment.java index 865da1d95..fecefa03e 100644 --- a/gnu/java/awt/ClasspathGraphicsEnvironment.java +++ b/gnu/java/awt/ClasspathGraphicsEnvironment.java @@ -45,7 +45,7 @@ import java.awt.image.WritableRaster; /** * This class extends the GraphicsEnvironment API with some Classpath-specific * methods, in order to provide optimized graphics handling. - * + * * @author Francis Kung <fkung@redhat.com> */ public abstract class ClasspathGraphicsEnvironment @@ -54,7 +54,7 @@ public abstract class ClasspathGraphicsEnvironment /** * Returns an appropriate Raster that can efficiently back a * BufferedImage with the given ColorModel and SampleModel. - * + * * @param cm The color model. * @param sm The samepl model. * @return An appropriate WritableRaster, or null if acceleration/optimization diff --git a/gnu/java/awt/ClasspathToolkit.java b/gnu/java/awt/ClasspathToolkit.java index 7bbc70ccb..99c186aaa 100644 --- a/gnu/java/awt/ClasspathToolkit.java +++ b/gnu/java/awt/ClasspathToolkit.java @@ -102,7 +102,7 @@ public abstract class ClasspathToolkit * * @param name The logical name of the font. This may be either a face * name or a logical font name, or may even be null. A default - * implementation of name decoding is provided in + * implementation of name decoding is provided in * {@link ClasspathFontPeer}, but may be overridden in other toolkits. * * @param attrs Any extra {@link java.awt.font.TextAttribute} attributes @@ -110,17 +110,17 @@ public abstract class ClasspathToolkit * transformation. */ public abstract ClasspathFontPeer getClasspathFontPeer (String name, - Map<?,?> attrs); + Map<?,?> attrs); - /** + /** * Creates a {@link Font}, in a platform-specific manner. - * + * * The default implementation simply constructs a {@link Font}, but some - * toolkits may wish to override this, to return {@link Font} subclasses + * toolkits may wish to override this, to return {@link Font} subclasses * which implement {@link java.awt.font.OpenType} or * {@link java.awt.font.MultipleMaster}. */ - public Font getFont (String name, Map attrs) + public Font getFont (String name, Map attrs) { Font f = null; @@ -170,7 +170,7 @@ public abstract class ClasspathToolkit * * @throws IllegalArgumentException if <code>format</code> is * not supported. - * + * * @throws FontFormatException if <code>stream</code> does not * contain data in the expected format, or if required tables are * missing from a font. @@ -211,11 +211,11 @@ public abstract class ClasspathToolkit * toolkit implementors should overload this method if possible. * @since 1.5 */ - public int getMouseNumberOfButtons() + public int getMouseNumberOfButtons() { return -1; } - + /* (non-Javadoc) * @see java.awt.Toolkit#createDesktopPeer(java.awt.Desktop) */ @@ -224,9 +224,8 @@ public abstract class ClasspathToolkit { if (GraphicsEnvironment.isHeadless()) throw new HeadlessException(); - + return ClasspathDesktopPeer.getDesktop(); } } - diff --git a/gnu/java/awt/ComponentDataBlitOp.java b/gnu/java/awt/ComponentDataBlitOp.java index 545427ea7..becf54167 100644 --- a/gnu/java/awt/ComponentDataBlitOp.java +++ b/gnu/java/awt/ComponentDataBlitOp.java @@ -52,7 +52,7 @@ import java.awt.image.WritableRaster; * * @throws java.lang.ClassCastException if the sample models of the * rasters are not of type ComponentSampleModel. - * + * * @author Rolf W. Rasmussen (rolfwr@ii.uib.no) */ public class ComponentDataBlitOp implements RasterOp @@ -63,14 +63,14 @@ public class ComponentDataBlitOp implements RasterOp { if (dest == null) dest = createCompatibleDestRaster(src); - + DataBuffer srcDB = src.getDataBuffer(); DataBuffer destDB = dest.getDataBuffer(); - + ComponentSampleModel srcSM = (ComponentSampleModel) src.getSampleModel(); ComponentSampleModel destSM = (ComponentSampleModel) dest.getSampleModel(); - + // Calculate offset to data in the underlying arrays: int srcScanlineStride = srcSM.getScanlineStride(); @@ -84,8 +84,8 @@ public class ComponentDataBlitOp implements RasterOp /* We can't use getOffset(x, y) from the sample model since we don't want the band offset added in. */ - - int srcOffset = + + int srcOffset = numBands*srcX + srcScanlineStride*srcY + // from sample model srcDB.getOffset(); // from data buffer @@ -94,44 +94,44 @@ public class ComponentDataBlitOp implements RasterOp destDB.getOffset(); // from data buffer // Determine how much, and how many times to blit. - + int rowSize = src.getWidth()*numBands; int h = src.getHeight(); - + if ((rowSize == srcScanlineStride) && - (rowSize == destScanlineStride)) + (rowSize == destScanlineStride)) { - // collapse scan line blits to one large blit. - rowSize *= h; - h = 1; + // collapse scan line blits to one large blit. + rowSize *= h; + h = 1; } - + // Do blitting - + Object srcArray = Buffers.getData(srcDB); Object destArray = Buffers.getData(destDB); - + for (int yd = 0; yd<h; yd++) { - System.arraycopy(srcArray, srcOffset, - destArray, destOffset, - rowSize); - srcOffset += srcScanlineStride; - destOffset += destScanlineStride; + System.arraycopy(srcArray, srcOffset, + destArray, destOffset, + rowSize); + srcOffset += srcScanlineStride; + destOffset += destScanlineStride; } - + return dest; } - public Rectangle2D getBounds2D(Raster src) + public Rectangle2D getBounds2D(Raster src) { return src.getBounds(); } public WritableRaster createCompatibleDestRaster(Raster src) { - + /* FIXME: Maybe we should explicitly create a raster with a tightly pixel packed sample model, rather than assuming that the createCompatibleWritableRaster() method in Raster @@ -140,7 +140,7 @@ public class ComponentDataBlitOp implements RasterOp return src.createCompatibleWritableRaster(); } - public Point2D getPoint2D(Point2D srcPoint, Point2D destPoint) + public Point2D getPoint2D(Point2D srcPoint, Point2D destPoint) { if (destPoint == null) return (Point2D) srcPoint.clone(); @@ -149,7 +149,7 @@ public class ComponentDataBlitOp implements RasterOp return destPoint; } - public RenderingHints getRenderingHints() + public RenderingHints getRenderingHints() { throw new UnsupportedOperationException("not implemented"); } diff --git a/gnu/java/awt/EmbeddedWindow.java b/gnu/java/awt/EmbeddedWindow.java index 7c04e7daf..6734a7b1b 100644 --- a/gnu/java/awt/EmbeddedWindow.java +++ b/gnu/java/awt/EmbeddedWindow.java @@ -49,13 +49,13 @@ import java.security.AccessController; /** * Represents an AWT window that can be embedded into another * application. - * + * * @author Michael Koch (konqueror@gmx.de) */ public class EmbeddedWindow extends Frame { private long handle; - + /** * Creates a window to be embedded into another application. The * window will only be embedded after its setHandle method has been @@ -66,7 +66,7 @@ public class EmbeddedWindow extends Frame super(); this.handle = 0; } - + /** * Creates a window to be embedded into another application. * @@ -78,7 +78,7 @@ public class EmbeddedWindow extends Frame super(); this.handle = handle; } - + /** * Creates the native peer for this embedded window. */ @@ -91,9 +91,9 @@ public class EmbeddedWindow extends Frame // java.awt.Component.peer member variable. try { - Field peerField = Component.class.getDeclaredField("peer"); - AccessController.doPrivileged(new SetAccessibleAction(peerField)); - peerField.set(this, tk.createEmbeddedWindow (this)); + Field peerField = Component.class.getDeclaredField("peer"); + AccessController.doPrivileged(new SetAccessibleAction(peerField)); + peerField.set(this, tk.createEmbeddedWindow (this)); } catch (IllegalAccessException e) { diff --git a/gnu/java/awt/GradientPaintContext.java b/gnu/java/awt/GradientPaintContext.java index 5e1d62dd9..f33926c12 100644 --- a/gnu/java/awt/GradientPaintContext.java +++ b/gnu/java/awt/GradientPaintContext.java @@ -1,4 +1,4 @@ -/* GradientPaintContext.java -- +/* GradientPaintContext.java -- Copyright (C) 2005, Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -47,39 +47,39 @@ import java.awt.Color; /** * A {@link PaintContext} used by the {@link GradientPaint} class. */ -public class GradientPaintContext implements PaintContext +public class GradientPaintContext implements PaintContext { - // This implementation follows the technique described in + // This implementation follows the technique described in // "Java(tm) 2D Graphics" by Jonathan Knudsen (O'Reilly 1999). - + /** The x-coordinate of the anchor point for color 1. */ private final float x1; - + /** The y-coordinate of the anchor point for color 1. */ private final float y1; - + /** Color 1. */ private final Color c1; - + /** The x-coordinate of the anchor point for color 2. */ private final float x2; - + /** The y-coordinate of the anchor point for color 2. */ private final float y2; - + /** Color 2. */ private final Color c2; - + /** A flag indicating whether the gradient is cyclic or acyclic. */ private final boolean cyclic; - + /** The length of the gradient line - computed from the two anchor points. */ - private final double length; + private final double length; /** * Creates a new instance. - * + * * @param x1 the x-coordinate for the anchor point for color 1. * @param y1 the y-coordinate for the anchor point for color 1. * @param c1 color 1. @@ -89,9 +89,9 @@ public class GradientPaintContext implements PaintContext * @param cyclic a flag that determines whether the gradient is cyclic * or acyclic. */ - public GradientPaintContext(float x1, float y1, Color c1, - float x2, float y2, Color c2, boolean cyclic) - { + public GradientPaintContext(float x1, float y1, Color c1, + float x2, float y2, Color c2, boolean cyclic) + { this.x1 = x1; this.y1 = y1; this.c1 = c1; @@ -101,7 +101,7 @@ public class GradientPaintContext implements PaintContext this.cyclic = cyclic; length = Point2D.distance(x1, y1, x2, y2); } - + /** * Return the color model of this context. It may be different from the * hint specified during createContext, as not all contexts can generate @@ -109,9 +109,9 @@ public class GradientPaintContext implements PaintContext * * @return the context color model */ - public ColorModel getColorModel() + public ColorModel getColorModel() { - return ColorModel.getRGBdefault(); + return ColorModel.getRGBdefault(); } /** @@ -131,21 +131,21 @@ public class GradientPaintContext implements PaintContext for (int r = 0; r < h; r++) { for (int c = 0; c < w; c++) { double u = 0.0; - if (pd2 != 0) - u = (((x + c) - x1) * (x2 - x1) + ((y + r) - y1) * (y2 - y1)) + if (pd2 != 0) + u = (((x + c) - x1) * (x2 - x1) + ((y + r) - y1) * (y2 - y1)) / Math.sqrt(pd2); double ratio = u / length; if (cyclic) ratio = Math.abs(ratio - Math.floor((ratio + 1.0) / 2.0) * 2.0); - else + else ratio = Math.max(0.0, Math.min(1.0, ratio)); int base = (r * w + c) * 4; data[base] = (int) (c1.getRed() + ratio * (c2.getRed() - c1.getRed())); - data[base + 1] + data[base + 1] = (int) (c1.getGreen() + ratio * (c2.getGreen() - c1.getGreen())); - data[base + 2] + data[base + 2] = (int) (c1.getBlue() + ratio * (c2.getBlue() - c1.getBlue())); - data[base + 3] + data[base + 3] = (int) (c1.getAlpha() + ratio * (c2.getAlpha() - c1.getAlpha())); } } @@ -154,11 +154,11 @@ public class GradientPaintContext implements PaintContext } /** - * Release the resources allocated for the paint (none in this + * Release the resources allocated for the paint (none in this * implementation). */ public void dispose() { - // nothing to do + // nothing to do } - + } diff --git a/gnu/java/awt/color/CieXyzConverter.java b/gnu/java/awt/color/CieXyzConverter.java index 174280585..e1b548e98 100644 --- a/gnu/java/awt/color/CieXyzConverter.java +++ b/gnu/java/awt/color/CieXyzConverter.java @@ -40,7 +40,7 @@ package gnu.java.awt.color; /** * CieXyzConverter - converts to/from a D50-relative CIE XYZ color space. - * + * * The sRGB<->CIE XYZ conversions in SrgbConverter are used. * * @author Sven de Marothy diff --git a/gnu/java/awt/color/ClutProfileConverter.java b/gnu/java/awt/color/ClutProfileConverter.java index bff97cc9b..5229ce804 100644 --- a/gnu/java/awt/color/ClutProfileConverter.java +++ b/gnu/java/awt/color/ClutProfileConverter.java @@ -56,24 +56,24 @@ public class ClutProfileConverter implements ColorSpaceConverter nChannels = profile.getNumComponents(); // Sun does not specifiy which rendering intent should be used, - // neither does the ICC v2 spec really. + // neither does the ICC v2 spec really. // Try intent 0 try { - toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB0Tag); + toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB0Tag); } catch (Exception e) { - toPCS = null; + toPCS = null; } try { - fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA0Tag); + fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA0Tag); } catch (Exception e) { - fromPCS = null; + fromPCS = null; } if (toPCS != null || fromPCS != null) @@ -82,20 +82,20 @@ public class ClutProfileConverter implements ColorSpaceConverter // If no intent 0 clut is available, look for a intent 1 clut. try { - toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB1Tag); + toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB1Tag); } catch (Exception e) { - toPCS = null; + toPCS = null; } try { - fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA1Tag); + fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA1Tag); } catch (Exception e) { - fromPCS = null; + fromPCS = null; } if (toPCS != null || fromPCS != null) @@ -104,20 +104,20 @@ public class ClutProfileConverter implements ColorSpaceConverter // Last shot.. intent 2 CLUT. try { - toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB2Tag); + toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB2Tag); } catch (Exception e) { - toPCS = null; + toPCS = null; } try { - fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA2Tag); + fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA2Tag); } catch (Exception e) { - fromPCS = null; + fromPCS = null; } if (toPCS == null && fromPCS == null) diff --git a/gnu/java/awt/color/ColorLookUpTable.java b/gnu/java/awt/color/ColorLookUpTable.java index 6b6418bc2..581320c3e 100644 --- a/gnu/java/awt/color/ColorLookUpTable.java +++ b/gnu/java/awt/color/ColorLookUpTable.java @@ -77,7 +77,7 @@ public class ColorLookUpTable float[][] inMatrix; // input matrix (XYZ only) boolean useMatrix; // Whether to use the matrix or not. int[] multiplier; - int[] offsets; // Hypercube offsets + int[] offsets; // Hypercube offsets boolean inputLab; // Set if the CLUT input CS is Lab boolean outputLab; // Set if the CLUT output CS is Lab @@ -95,21 +95,21 @@ public class ColorLookUpTable case ICC_Profile.icSigAToB0Tag: case ICC_Profile.icSigAToB1Tag: case ICC_Profile.icSigAToB2Tag: - if (profile.getColorSpaceType() == ColorSpace.TYPE_XYZ) - useMatrix = true; - inputLab = false; - outputLab = (profile.getPCSType() == ColorSpace.TYPE_Lab); - break; + if (profile.getColorSpaceType() == ColorSpace.TYPE_XYZ) + useMatrix = true; + inputLab = false; + outputLab = (profile.getPCSType() == ColorSpace.TYPE_Lab); + break; case ICC_Profile.icSigBToA0Tag: case ICC_Profile.icSigBToA1Tag: case ICC_Profile.icSigBToA2Tag: - if (profile.getPCSType() == ColorSpace.TYPE_XYZ) - useMatrix = true; - inputLab = (profile.getPCSType() == ColorSpace.TYPE_Lab); - outputLab = false; - break; + if (profile.getPCSType() == ColorSpace.TYPE_XYZ) + useMatrix = true; + inputLab = (profile.getPCSType() == ColorSpace.TYPE_Lab); + outputLab = false; + break; default: - throw new IllegalArgumentException("Not a clut-type tag."); + throw new IllegalArgumentException("Not a clut-type tag."); } byte[] data = profile.getData(tag); @@ -144,24 +144,24 @@ public class ColorLookUpTable inMatrix = new float[3][3]; for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) - inMatrix[i][j] = ((float) (buf.getInt(12 + (i * 3 + j) * 4))) / 65536.0f; + inMatrix[i][j] = ((float) (buf.getInt(12 + (i * 3 + j) * 4))) / 65536.0f; inTable = new double[nIn][nInTableEntries]; for (int channel = 0; channel < nIn; channel++) for (int i = 0; i < nInTableEntries; i++) - inTable[channel][i] = (double) ((int) buf.getShort(52 - + (channel * nInTableEntries - + i) * 2) - & (0xFFFF)) / 65536.0; + inTable[channel][i] = (double) ((int) buf.getShort(52 + + (channel * nInTableEntries + + i) * 2) + & (0xFFFF)) / 65536.0; nClut = nOut; multiplier = new int[nIn]; multiplier[nIn - 1] = nOut; for (int i = 0; i < nIn; i++) { - nClut *= gridpoints; - if (i > 0) - multiplier[nIn - i - 1] = multiplier[nIn - i] * gridpoints; + nClut *= gridpoints; + if (i > 0) + multiplier[nIn - i - 1] = multiplier[nIn - i] * gridpoints; } int clutOffset = 52 + nIn * nInTableEntries * 2; @@ -172,18 +172,18 @@ public class ColorLookUpTable outTable = new short[nOut][nOutTableEntries]; for (int channel = 0; channel < nOut; channel++) for (int i = 0; i < nOutTableEntries; i++) - outTable[channel][i] = buf.getShort(clutOffset - + (nClut - + channel * nOutTableEntries + i) * 2); + outTable[channel][i] = buf.getShort(clutOffset + + (nClut + + channel * nOutTableEntries + i) * 2); // calculate the hypercube corner offsets offsets = new int[(1 << nIn)]; offsets[0] = 0; for (int j = 0; j < nIn; j++) { - int factor = 1 << j; - for (int i = 0; i < factor; i++) - offsets[factor + i] = offsets[i] + multiplier[j]; + int factor = 1 << j; + for (int i = 0; i < factor; i++) + offsets[factor + i] = offsets[i] + multiplier[j]; } } @@ -203,23 +203,23 @@ public class ColorLookUpTable inMatrix = new float[3][3]; for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) - inMatrix[i][j] = ((float) (buf.getInt(12 + (i * 3 + j) * 4))) / 65536.0f; + inMatrix[i][j] = ((float) (buf.getInt(12 + (i * 3 + j) * 4))) / 65536.0f; inTable = new double[nIn][nInTableEntries]; for (int channel = 0; channel < nIn; channel++) for (int i = 0; i < nInTableEntries; i++) - inTable[channel][i] = (double) ((int) buf.get(48 - + (channel * nInTableEntries - + i)) & (0xFF)) / 255.0; + inTable[channel][i] = (double) ((int) buf.get(48 + + (channel * nInTableEntries + + i)) & (0xFF)) / 255.0; nClut = nOut; multiplier = new int[nIn]; multiplier[nIn - 1] = nOut; for (int i = 0; i < nIn; i++) { - nClut *= gridpoints; - if (i > 0) - multiplier[nIn - i - 1] = multiplier[nIn - i] * gridpoints; + nClut *= gridpoints; + if (i > 0) + multiplier[nIn - i - 1] = multiplier[nIn - i] * gridpoints; } int clutOffset = 48 + nIn * nInTableEntries; @@ -230,18 +230,18 @@ public class ColorLookUpTable outTable = new short[nOut][nOutTableEntries]; for (int channel = 0; channel < nOut; channel++) for (int i = 0; i < nOutTableEntries; i++) - outTable[channel][i] = (short) (buf.get(clutOffset + nClut - + channel * nOutTableEntries - + i) * 257); + outTable[channel][i] = (short) (buf.get(clutOffset + nClut + + channel * nOutTableEntries + + i) * 257); // calculate the hypercube corner offsets offsets = new int[(1 << nIn)]; offsets[0] = 0; for (int j = 0; j < nIn; j++) { - int factor = 1 << j; - for (int i = 0; i < factor; i++) - offsets[factor + i] = offsets[i] + multiplier[j]; + int factor = 1 << j; + for (int i = 0; i < factor; i++) + offsets[factor + i] = offsets[i] + multiplier[j]; } } @@ -260,32 +260,32 @@ public class ColorLookUpTable float[] in2 = new float[in.length]; if (useMatrix) { - for (int i = 0; i < 3; i++) - in2[i] = in[0] * inMatrix[i][0] + in[1] * inMatrix[i][1] - + in[2] * inMatrix[i][2]; + for (int i = 0; i < 3; i++) + in2[i] = in[0] * inMatrix[i][0] + in[1] * inMatrix[i][1] + + in[2] * inMatrix[i][2]; } else if (inputLab) in2 = XYZtoLab(in); else System.arraycopy(in, 0, in2, 0, in.length); - // input table + // input table for (int i = 0; i < nIn; i++) { - int index = (int) Math.floor(in2[i] * (double) (nInTableEntries - 1)); // floor in - - // clip values. - if (index >= nInTableEntries - 1) - in2[i] = (float) inTable[i][nInTableEntries - 1]; - else if (index < 0) - in2[i] = (float) inTable[i][0]; - else - { - // linear interpolation - double alpha = in2[i] * ((double) nInTableEntries - 1.0) - index; - in2[i] = (float) (inTable[i][index] * (1 - alpha) - + inTable[i][index + 1] * alpha); - } + int index = (int) Math.floor(in2[i] * (double) (nInTableEntries - 1)); // floor in + + // clip values. + if (index >= nInTableEntries - 1) + in2[i] = (float) inTable[i][nInTableEntries - 1]; + else if (index < 0) + in2[i] = (float) inTable[i][0]; + else + { + // linear interpolation + double alpha = in2[i] * ((double) nInTableEntries - 1.0) - index; + in2[i] = (float) (inTable[i][index] * (1 - alpha) + + inTable[i][index + 1] * alpha); + } } // CLUT lookup @@ -295,31 +295,31 @@ public class ColorLookUpTable int offset = 0; // = gp for (int i = 0; i < nIn; i++) { - int index = (int) Math.floor(in2[i] * ((double) gridpoints - 1.0)); - double alpha = in2[i] * ((double) gridpoints - 1.0) - (double) index; - - // clip values. - if (index >= gridpoints - 1) - { - index = gridpoints - 1; - alpha = 1.0; - } - else if (index < 0) - index = 0; - clutalpha[i] = alpha; - offset += index * multiplier[i]; + int index = (int) Math.floor(in2[i] * ((double) gridpoints - 1.0)); + double alpha = in2[i] * ((double) gridpoints - 1.0) - (double) index; + + // clip values. + if (index >= gridpoints - 1) + { + index = gridpoints - 1; + alpha = 1.0; + } + else if (index < 0) + index = 0; + clutalpha[i] = alpha; + offset += index * multiplier[i]; } // Calculate interpolation weights weights[0] = 1.0; for (int j = 0; j < nIn; j++) { - int factor = 1 << j; - for (int i = 0; i < factor; i++) - { - weights[factor + i] = weights[i] * clutalpha[j]; - weights[i] *= (1.0 - clutalpha[j]); - } + int factor = 1 << j; + for (int i = 0; i < factor; i++) + { + weights[factor + i] = weights[i] * clutalpha[j]; + weights[i] *= (1.0 - clutalpha[j]); + } } for (int i = 0; i < nOut; i++) @@ -327,32 +327,32 @@ public class ColorLookUpTable for (int i = 1; i < (1 << nIn); i++) { - int offset2 = offset + offsets[i]; - for (int f = 0; f < nOut; f++) - output2[f] += weights[i] * clut[offset2 + f]; + int offset2 = offset + offsets[i]; + for (int f = 0; f < nOut; f++) + output2[f] += weights[i] * clut[offset2 + f]; } - // output table + // output table float[] output = new float[nOut]; for (int i = 0; i < nOut; i++) { - int index = (int) Math.floor(output2[i] * ((double) nOutTableEntries - - 1.0)); - - // clip values. - if (index >= nOutTableEntries - 1) - output[i] = outTable[i][nOutTableEntries - 1]; - else if (index < 0) - output[i] = outTable[i][0]; - else - { - // linear interpolation - double a = output2[i] * ((double) nOutTableEntries - 1.0) - - (double) index; - output[i] = (float) ((double) ((int) outTable[i][index] & (0xFFFF)) * (1 - - a) - + (double) ((int) outTable[i][index + 1] & (0xFFFF)) * a) / 65536f; - } + int index = (int) Math.floor(output2[i] * ((double) nOutTableEntries + - 1.0)); + + // clip values. + if (index >= nOutTableEntries - 1) + output[i] = outTable[i][nOutTableEntries - 1]; + else if (index < 0) + output[i] = outTable[i][0]; + else + { + // linear interpolation + double a = output2[i] * ((double) nOutTableEntries - 1.0) + - (double) index; + output[i] = (float) ((double) ((int) outTable[i][index] & (0xFFFF)) * (1 + - a) + + (double) ((int) outTable[i][index + 1] & (0xFFFF)) * a) / 65536f; + } } if (outputLab) @@ -365,7 +365,7 @@ public class ColorLookUpTable */ private float[] LabtoXYZ(float[] in) { - // Convert from byte-packed format to a + // Convert from byte-packed format to a // more convenient one (actual Lab values) // (See ICC spec for details) // factor is 100 * 65536 / 65280 @@ -381,12 +381,12 @@ public class ColorLookUpTable for (int i = 0; i < 3; i++) { - double exp = out[i] * out[i] * out[i]; - if (exp <= 0.008856) - out[i] = (out[i] - 16.0f / 116.0f) / 7.787f; - else - out[i] = (float) exp; - out[i] = D50[i] * out[i]; + double exp = out[i] * out[i] * out[i]; + if (exp <= 0.008856) + out[i] = (out[i] - 16.0f / 116.0f) / 7.787f; + else + out[i] = (float) exp; + out[i] = D50[i] * out[i]; } return out; } @@ -400,12 +400,12 @@ public class ColorLookUpTable for (int i = 0; i < 3; i++) { - temp[i] = in[i] / D50[i]; + temp[i] = in[i] / D50[i]; - if (temp[i] <= 0.008856f) - temp[i] = (7.7870689f * temp[i]) + (16f / 116.0f); - else - temp[i] = (float) Math.exp((1.0 / 3.0) * Math.log(temp[i])); + if (temp[i] <= 0.008856f) + temp[i] = (7.7870689f * temp[i]) + (16f / 116.0f); + else + temp[i] = (float) Math.exp((1.0 / 3.0) * Math.log(temp[i])); } float[] out = new float[3]; @@ -419,10 +419,10 @@ public class ColorLookUpTable out[2] = (out[2] + 128f) / 256f; for (int i = 0; i < 3; i++) { - if (out[i] < 0f) - out[i] = 0f; - if (out[i] > 1f) - out[i] = 1f; + if (out[i] < 0f) + out[i] = 0f; + if (out[i] > 1f) + out[i] = 1f; } return out; } diff --git a/gnu/java/awt/color/GrayProfileConverter.java b/gnu/java/awt/color/GrayProfileConverter.java index 3c725138a..3f95b07d7 100644 --- a/gnu/java/awt/color/GrayProfileConverter.java +++ b/gnu/java/awt/color/GrayProfileConverter.java @@ -67,11 +67,11 @@ public class GrayProfileConverter implements ColorSpaceConverter { try { - trc = new ToneReproductionCurve(profile.getGamma()); + trc = new ToneReproductionCurve(profile.getGamma()); } catch (ProfileDataException e) { - trc = new ToneReproductionCurve(profile.getTRC()); + trc = new ToneReproductionCurve(profile.getTRC()); } // linear grayscale converter @@ -84,20 +84,20 @@ public class GrayProfileConverter implements ColorSpaceConverter // unpredictable results. This is in line with the Java specification, try { - toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB0Tag); + toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB0Tag); } catch (Exception e) { - toPCS = null; + toPCS = null; } try { - fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA0Tag); + fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA0Tag); } catch (Exception e) { - fromPCS = null; + fromPCS = null; } } diff --git a/gnu/java/awt/color/GrayScaleConverter.java b/gnu/java/awt/color/GrayScaleConverter.java index 7a27ddba8..beea9d287 100644 --- a/gnu/java/awt/color/GrayScaleConverter.java +++ b/gnu/java/awt/color/GrayScaleConverter.java @@ -95,15 +95,15 @@ public class GrayScaleConverter implements ColorSpaceConverter out[0] = 0; for (int i = 0; i < 3; i++) { - float n = in[i]; - if (n < 0) - n = 0f; - if (n > 1) - n = 1f; - if (n <= 0.03928f) - out[0] += (float) (coeff[i] * n / 12.92); - else - out[0] += (float) (coeff[i] * Math.exp(2.4 * Math.log((n + 0.055) / 1.055))); + float n = in[i]; + if (n < 0) + n = 0f; + if (n > 1) + n = 1f; + if (n <= 0.03928f) + out[0] += (float) (coeff[i] * n / 12.92); + else + out[0] += (float) (coeff[i] * Math.exp(2.4 * Math.log((n + 0.055) / 1.055))); } return out; } diff --git a/gnu/java/awt/color/LinearRGBConverter.java b/gnu/java/awt/color/LinearRGBConverter.java index 13a4e2c04..1eaf6479e 100644 --- a/gnu/java/awt/color/LinearRGBConverter.java +++ b/gnu/java/awt/color/LinearRGBConverter.java @@ -58,16 +58,16 @@ public class LinearRGBConverter implements ColorSpaceConverter float[] out = new float[3]; for (int i = 0; i < 3; i++) { - float n = in[i]; - if (n < 0) - n = 0f; - if (n > 1) - n = 1f; - if (n <= 0.00304f) - out[i] = in[0] * 12.92f; - else - out[i] = 1.055f * ((float) Math.exp((1 / 2.4) * Math.log(n))) - - 0.055f; + float n = in[i]; + if (n < 0) + n = 0f; + if (n > 1) + n = 1f; + if (n <= 0.00304f) + out[i] = in[0] * 12.92f; + else + out[i] = 1.055f * ((float) Math.exp((1 / 2.4) * Math.log(n))) + - 0.055f; } return out; } @@ -84,15 +84,15 @@ public class LinearRGBConverter implements ColorSpaceConverter // numbers from the w3 spec. for (int i = 0; i < 3; i++) { - float n = in[i]; - if (n < 0) - n = 0f; - if (n > 1) - n = 1f; - if (n <= 0.03928f) - out[i] = (float) (n / 12.92); - else - out[i] = (float) (Math.exp(2.4 * Math.log((n + 0.055) / 1.055))); + float n = in[i]; + if (n < 0) + n = 0f; + if (n > 1) + n = 1f; + if (n <= 0.03928f) + out[i] = (float) (n / 12.92); + else + out[i] = (float) (Math.exp(2.4 * Math.log((n + 0.055) / 1.055))); } return out; } diff --git a/gnu/java/awt/color/ProfileHeader.java b/gnu/java/awt/color/ProfileHeader.java index 4fdef560a..2a6402dbc 100644 --- a/gnu/java/awt/color/ProfileHeader.java +++ b/gnu/java/awt/color/ProfileHeader.java @@ -57,7 +57,7 @@ public class ProfileHeader /** * Mapping from ICC Profile signatures to ColorSpace types */ - private static final int[] csTypeMap = + private static final int[] csTypeMap = { ICC_Profile.icSigXYZData, ColorSpace.TYPE_XYZ, @@ -119,7 +119,7 @@ public class ProfileHeader /** * Mapping of ICC class signatures to profile class constants */ - private static final int[] classMap = + private static final int[] classMap = { ICC_Profile.icSigInputClass, ICC_Profile.CLASS_INPUT, @@ -194,7 +194,7 @@ public class ProfileHeader { ByteBuffer buf = ByteBuffer.wrap(data); - // Get size (the sign bit shouldn't matter. + // Get size (the sign bit shouldn't matter. // A valid profile can never be +2Gb) size = buf.getInt(ICC_Profile.icHdrSize); @@ -211,8 +211,8 @@ public class ProfileHeader for (int i = 0; i < classMap.length; i += 2) if (classMap[i] == classSig) { - profileClass = classMap[i + 1]; - break; + profileClass = classMap[i + 1]; + break; } // get the data color space @@ -221,8 +221,8 @@ public class ProfileHeader for (int i = 0; i < csTypeMap.length; i += 2) if (csTypeMap[i] == csSig) { - colorSpace = csTypeMap[i + 1]; - break; + colorSpace = csTypeMap[i + 1]; + break; } // get the profile color space (PCS), must be xyz or lab except @@ -231,19 +231,19 @@ public class ProfileHeader profileColorSpace = -1; if (profileClass != ICC_Profile.CLASS_DEVICELINK) { - if (pcsSig == ICC_Profile.icSigXYZData) - profileColorSpace = ColorSpace.TYPE_XYZ; - if (pcsSig == ICC_Profile.icSigLabData) - profileColorSpace = ColorSpace.TYPE_Lab; + if (pcsSig == ICC_Profile.icSigXYZData) + profileColorSpace = ColorSpace.TYPE_XYZ; + if (pcsSig == ICC_Profile.icSigLabData) + profileColorSpace = ColorSpace.TYPE_Lab; } else { - for (int i = 0; i < csTypeMap.length; i += 2) - if (csTypeMap[i] == pcsSig) - { - profileColorSpace = csTypeMap[i + 1]; - break; - } + for (int i = 0; i < csTypeMap.length; i += 2) + if (csTypeMap[i] == pcsSig) + { + profileColorSpace = csTypeMap[i + 1]; + break; + } } // creation timestamp @@ -266,7 +266,7 @@ public class ProfileHeader System.arraycopy(data, ICC_Profile.icHdrAttributes, attributes, 0, 8); // rendering intent intent = buf.getInt(ICC_Profile.icHdrRenderingIntent); - // illuminant info + // illuminant info illuminant = new byte[12]; System.arraycopy(data, ICC_Profile.icHdrIlluminant, illuminant, 0, 12); // Creator signature @@ -321,13 +321,13 @@ public class ProfileHeader (short) (majorVersion << 8 | minorVersion)); for (int i = 1; i < classMap.length; i += 2) if (profileClass == classMap[i]) - buf.putInt(ICC_Profile.icHdrDeviceClass, classMap[i - 1]); + buf.putInt(ICC_Profile.icHdrDeviceClass, classMap[i - 1]); for (int i = 1; i < csTypeMap.length; i += 2) if (csTypeMap[i] == colorSpace) - buf.putInt(ICC_Profile.icHdrColorSpace, csTypeMap[i - 1]); + buf.putInt(ICC_Profile.icHdrColorSpace, csTypeMap[i - 1]); for (int i = 1; i < csTypeMap.length; i += 2) if (csTypeMap[i] == profileColorSpace) - buf.putInt(ICC_Profile.icHdrPcs, csTypeMap[i - 1]); + buf.putInt(ICC_Profile.icHdrPcs, csTypeMap[i - 1]); System.arraycopy(timestamp, 0, data, ICC_Profile.icHdrDate, timestamp.length); diff --git a/gnu/java/awt/color/RgbProfileConverter.java b/gnu/java/awt/color/RgbProfileConverter.java index 0cbd28f6c..7623890a4 100644 --- a/gnu/java/awt/color/RgbProfileConverter.java +++ b/gnu/java/awt/color/RgbProfileConverter.java @@ -82,27 +82,27 @@ public class RgbProfileConverter implements ColorSpaceConverter // get TRCs try { - rTRC = new ToneReproductionCurve(profile.getGamma(ICC_ProfileRGB.REDCOMPONENT)); + rTRC = new ToneReproductionCurve(profile.getGamma(ICC_ProfileRGB.REDCOMPONENT)); } catch (ProfileDataException e) { - rTRC = new ToneReproductionCurve(profile.getTRC(ICC_ProfileRGB.REDCOMPONENT)); + rTRC = new ToneReproductionCurve(profile.getTRC(ICC_ProfileRGB.REDCOMPONENT)); } try { - gTRC = new ToneReproductionCurve(profile.getGamma(ICC_ProfileRGB.GREENCOMPONENT)); + gTRC = new ToneReproductionCurve(profile.getGamma(ICC_ProfileRGB.GREENCOMPONENT)); } catch (ProfileDataException e) { - gTRC = new ToneReproductionCurve(profile.getTRC(ICC_ProfileRGB.GREENCOMPONENT)); + gTRC = new ToneReproductionCurve(profile.getTRC(ICC_ProfileRGB.GREENCOMPONENT)); } try { - bTRC = new ToneReproductionCurve(profile.getGamma(ICC_ProfileRGB.BLUECOMPONENT)); + bTRC = new ToneReproductionCurve(profile.getGamma(ICC_ProfileRGB.BLUECOMPONENT)); } catch (ProfileDataException e) { - bTRC = new ToneReproductionCurve(profile.getTRC(ICC_ProfileRGB.BLUECOMPONENT)); + bTRC = new ToneReproductionCurve(profile.getTRC(ICC_ProfileRGB.BLUECOMPONENT)); } // If a CLUT is available, it should be used, and the TRCs ignored. @@ -112,30 +112,30 @@ public class RgbProfileConverter implements ColorSpaceConverter // unpredictable results. This is in line with the Java specification, try { - toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB0Tag); + toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB0Tag); } catch (Exception e) { - toPCS = null; + toPCS = null; } try { - fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA0Tag); + fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA0Tag); } catch (Exception e) { - fromPCS = null; + fromPCS = null; } // Calculate the inverse matrix if no reverse CLUT is available if(fromPCS == null) - inv_matrix = invertMatrix(matrix); - else + inv_matrix = invertMatrix(matrix); + else { // otherwise just set it to an identity matrix - inv_matrix = new float[3][3]; - inv_matrix[0][0] = inv_matrix[1][1] = inv_matrix[2][2] = 1.0f; + inv_matrix = new float[3][3]; + inv_matrix[0][0] = inv_matrix[1][1] = inv_matrix[2][2] = 1.0f; } } @@ -191,7 +191,7 @@ public class RgbProfileConverter implements ColorSpaceConverter out[2] = bTRC.reverseLookup(temp[2]); // FIXME: Sun appears to clip the return values to [0,1] - // I don't believe that is a Good Thing, + // I don't believe that is a Good Thing, // (some colorspaces may allow values outside that range.) // So we return the actual values here. return out; diff --git a/gnu/java/awt/color/SrgbConverter.java b/gnu/java/awt/color/SrgbConverter.java index a30a0db90..76831c0ea 100644 --- a/gnu/java/awt/color/SrgbConverter.java +++ b/gnu/java/awt/color/SrgbConverter.java @@ -107,15 +107,15 @@ public class SrgbConverter implements ColorSpaceConverter float[] out = new float[3]; for (int i = 0; i < 3; i++) { - if (temp[i] < 0) - temp[i] = 0.0f; - if (temp[i] > 1) - temp[i] = 1.0f; - if (temp[i] <= 0.00304f) - out[i] = temp[i] * 12.92f; - else - out[i] = 1.055f * ((float) Math.exp((1 / 2.4) * Math.log(temp[i]))) - - 0.055f; + if (temp[i] < 0) + temp[i] = 0.0f; + if (temp[i] > 1) + temp[i] = 1.0f; + if (temp[i] <= 0.00304f) + out[i] = temp[i] * 12.92f; + else + out[i] = 1.055f * ((float) Math.exp((1 / 2.4) * Math.log(temp[i]))) + - 0.055f; } return out; } @@ -132,9 +132,9 @@ public class SrgbConverter implements ColorSpaceConverter float[] out = new float[3]; for (int i = 0; i < 3; i++) if (in[i] <= 0.03928f) - temp[i] = in[i] / 12.92f; + temp[i] = in[i] / 12.92f; else - temp[i] = (float) Math.exp(2.4 * Math.log((in[i] + 0.055) / 1.055)); + temp[i] = (float) Math.exp(2.4 * Math.log((in[i] + 0.055) / 1.055)); /* * Note: The numbers which were used to calculate this only had four diff --git a/gnu/java/awt/color/ToneReproductionCurve.java b/gnu/java/awt/color/ToneReproductionCurve.java index a1bccbd40..208e16883 100644 --- a/gnu/java/awt/color/ToneReproductionCurve.java +++ b/gnu/java/awt/color/ToneReproductionCurve.java @@ -103,20 +103,20 @@ public class ToneReproductionCurve if (trc == null) { - if (in == 0f) - return 0.0f; - return (float) Math.exp(gamma * Math.log(in)); + if (in == 0f) + return 0.0f; + return (float) Math.exp(gamma * Math.log(in)); } else { - double alpha = in * (trc.length - 1); - int index = (int) Math.floor(alpha); - alpha = alpha - (double) index; - if (index >= trc.length - 1) - return trc[trc.length - 1]; - if (index <= 0) - return trc[0]; - out = (float) (trc[index] * (1.0 - alpha) + trc[index + 1] * alpha); + double alpha = in * (trc.length - 1); + int index = (int) Math.floor(alpha); + alpha = alpha - (double) index; + if (index >= trc.length - 1) + return trc[trc.length - 1]; + if (index <= 0) + return trc[0]; + out = (float) (trc[index] * (1.0 - alpha) + trc[index + 1] * alpha); } return out; } @@ -130,21 +130,21 @@ public class ToneReproductionCurve if (trc == null) { - if (in == 0f) - return 0.0f; - return (float) Math.exp((1.0 / gamma) * Math.log(in)); + if (in == 0f) + return 0.0f; + return (float) Math.exp((1.0 / gamma) * Math.log(in)); } else { - double alpha = in * (reverseTrc.length - 1); - int index = (int) Math.floor(alpha); - alpha = alpha - (double) index; - if (index >= reverseTrc.length - 1) - return reverseTrc[reverseTrc.length - 1]; - if (index <= 0) - return reverseTrc[0]; - out = (float) (reverseTrc[index] * (1.0 - alpha) - + reverseTrc[index + 1] * alpha); + double alpha = in * (reverseTrc.length - 1); + int index = (int) Math.floor(alpha); + alpha = alpha - (double) index; + if (index >= reverseTrc.length - 1) + return reverseTrc[reverseTrc.length - 1]; + if (index <= 0) + return reverseTrc[0]; + out = (float) (reverseTrc[index] * (1.0 - alpha) + + reverseTrc[index + 1] * alpha); } return out; } @@ -164,14 +164,14 @@ public class ToneReproductionCurve int j = 0; for (int i = 0; i < 10000; i++) { - float n = ((float) i) / 10000f; - while (trc[j + 1] < n && j < trc.length - 2) - j++; - - if (j == trc.length - 2) - reverseTrc[i] = trc[trc.length - 1]; - else - reverseTrc[i] = (j + (n - trc[j]) / (trc[j + 1] - trc[j])) / ((float) trc.length); + float n = ((float) i) / 10000f; + while (trc[j + 1] < n && j < trc.length - 2) + j++; + + if (j == trc.length - 2) + reverseTrc[i] = trc[trc.length - 1]; + else + reverseTrc[i] = (j + (n - trc[j]) / (trc[j + 1] - trc[j])) / ((float) trc.length); } } } diff --git a/gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java b/gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java index 1f0c3ad2d..4ef8c2918 100644 --- a/gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java +++ b/gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java @@ -59,28 +59,28 @@ public class GtkMouseDragGestureRecognizer { this (ds, c, 0, null); } - + public GtkMouseDragGestureRecognizer (DragSource ds, Component c, int act) { this(ds, c, act, null); } - + public GtkMouseDragGestureRecognizer (DragSource ds, Component c, int act, DragGestureListener dgl) { super(ds, c, act, dgl); } - + public void registerListeners () { super.registerListeners(); } - + public void unregisterListeners () { super.unregisterListeners(); } - + public void mouseClicked (MouseEvent e) { // Nothing to do here. @@ -115,7 +115,7 @@ public class GtkMouseDragGestureRecognizer if (!events.isEmpty()) { int act = getDropActionFromEvent(e); - + if (act == DnDConstants.ACTION_NONE) return; @@ -124,14 +124,14 @@ public class GtkMouseDragGestureRecognizer int dx = Math.abs(origin.x - current.x); int dy = Math.abs(origin.y - current.y); int threshold = DragSource.getDragThreshold(); - + if (dx > threshold || dy > threshold) fireDragGestureRecognized(act, origin); else appendEvent(e); } } - + public void mouseMoved (MouseEvent e) { // Nothing to do here. @@ -142,10 +142,10 @@ public class GtkMouseDragGestureRecognizer int modEx = e.getModifiersEx(); int buttons = modEx & (MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.BUTTON2_DOWN_MASK | MouseEvent.BUTTON3_DOWN_MASK); - if (!(buttons == MouseEvent.BUTTON1_DOWN_MASK || + if (!(buttons == MouseEvent.BUTTON1_DOWN_MASK || buttons == MouseEvent.BUTTON2_DOWN_MASK)) return DnDConstants.ACTION_NONE; - + // Convert modifier to a drop action int sourceActions = getSourceActions(); int mod = modEx diff --git a/gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java b/gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java index b68fa1058..4d1097626 100644 --- a/gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java +++ b/gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java @@ -62,54 +62,54 @@ public class GtkDragSourceContextPeer private Cursor cursor; private DragSourceContext context; public static Component target; - + native void nativeStartDrag(Image i, int x, int y, int action, String target); native void connectSignals(ComponentPeer comp); native void create(ComponentPeer comp); native void nativeSetCursor(int cursor); native void setTarget(GtkDropTargetContextPeer target); - + public GtkDragSourceContextPeer(DragGestureEvent e) { super(e.getComponent()); Component comp = e.getComponent(); peer = getComponentPeer(comp); - + create(peer); connectSignals(peer); cursor = comp.getCursor(); - + // FIXME: Where do we set the target? - + if ((target != null)) setTarget(new GtkDropTargetContextPeer(target)); } - + ComponentPeer getComponentPeer(Component c) { if (c == null) return null; - + Component curr = c; while (curr.getPeer() instanceof LightweightPeer) curr = curr.getParent(); - + if (curr != null) return curr.getPeer(); return null; } - + public void startDrag(DragSourceContext context, Cursor c, Image i, Point p) throws InvalidDnDOperationException - { + { this.context = context; if (p == null) p = new Point(); - + // FIXME: use proper DataFlavor, not "text/plain". // Also, add check to determine if dragging. - + setCursor(c); nativeStartDrag(i, p.x, p.y, context.getTrigger().getDragAction(), "text/plain"); @@ -133,7 +133,7 @@ public class GtkDragSourceContextPeer { // Nothing to do here. } - + /** * Called from native code. */ diff --git a/gnu/java/awt/dnd/peer/gtk/GtkDropTargetContextPeer.java b/gnu/java/awt/dnd/peer/gtk/GtkDropTargetContextPeer.java index f24b3f39b..315a2bdf1 100644 --- a/gnu/java/awt/dnd/peer/gtk/GtkDropTargetContextPeer.java +++ b/gnu/java/awt/dnd/peer/gtk/GtkDropTargetContextPeer.java @@ -50,12 +50,12 @@ public class GtkDropTargetContextPeer extends GtkGenericPeer implements DropTargetContextPeer { - + public GtkDropTargetContextPeer(Object obj) { super(obj); } - + public void setTargetActions(int actions) { // FIXME: Not Implemented diff --git a/gnu/java/awt/dnd/peer/gtk/GtkDropTargetPeer.java b/gnu/java/awt/dnd/peer/gtk/GtkDropTargetPeer.java index 88b75ad96..0799df5ba 100644 --- a/gnu/java/awt/dnd/peer/gtk/GtkDropTargetPeer.java +++ b/gnu/java/awt/dnd/peer/gtk/GtkDropTargetPeer.java @@ -52,7 +52,7 @@ public class GtkDropTargetPeer { super(null); } - + public void addDropTarget(DropTarget target) { // FIXME: Not Implemented diff --git a/gnu/java/awt/font/FontDelegate.java b/gnu/java/awt/font/FontDelegate.java index a77873309..e5c03a10f 100644 --- a/gnu/java/awt/font/FontDelegate.java +++ b/gnu/java/awt/font/FontDelegate.java @@ -77,8 +77,8 @@ public interface FontDelegate * @return the face name. */ public String getFullName(Locale locale); - - + + /** * Returns the name of the family to which this font face belongs, * for example <i>“Univers”</i>. @@ -99,8 +99,8 @@ public interface FontDelegate * @return the name of the face inside its family. */ public String getSubFamilyName(Locale locale); - - + + /** * Returns the PostScript name of this font face, for example * <i>“Helvetica-Bold”</i>. @@ -131,7 +131,7 @@ public interface FontDelegate * glyph as an empty box. */ public int getMissingGlyphCode(); - + /** * Creates a GlyphVector by mapping each character in a @@ -205,7 +205,7 @@ public interface FontDelegate boolean fractionalMetrics, boolean horizontal, Point2D advance); - + /** * Returns the shape of a glyph. diff --git a/gnu/java/awt/font/FontFactory.java b/gnu/java/awt/font/FontFactory.java index 6c1084eef..53eb5df5f 100644 --- a/gnu/java/awt/font/FontFactory.java +++ b/gnu/java/awt/font/FontFactory.java @@ -58,7 +58,7 @@ public final class FontFactory { } - + /** * Creates FontDelegate objects for the fonts in the specified buffer. * The following font formats are currently recognized: diff --git a/gnu/java/awt/font/GNUGlyphVector.java b/gnu/java/awt/font/GNUGlyphVector.java index 22f331e15..9fd80e79e 100644 --- a/gnu/java/awt/font/GNUGlyphVector.java +++ b/gnu/java/awt/font/GNUGlyphVector.java @@ -113,7 +113,7 @@ public class GNUGlyphVector this.font = font; this.renderContext = renderContext; this.glyphs = glyphs; - + fontSize = font.getSize2D(); transform = font.getTransform(); // returns a modifiable copy //transform.concatenate(renderContext.getTransform()); @@ -156,7 +156,7 @@ public class GNUGlyphVector for (i = p = 0; i < glyphs.length; i++) { p += 2; - + if ((transforms == null) || (tx = transforms[i]) == null) tx = this.transform; else @@ -164,7 +164,7 @@ public class GNUGlyphVector tx = new AffineTransform(tx); tx.concatenate(this.transform); } - + fontDelegate.getAdvance(glyphs[i], fontSize, tx, renderContext.isAntiAliased(), renderContext.usesFractionalMetrics(), @@ -502,11 +502,11 @@ public class GNUGlyphVector { return layoutFlags; } - - + + /** * Returns the positions of a range of glyphs in this vector. - * + * * @param firstGlyphIndex the index of the first glyph whose * position is retrieved. * @@ -546,7 +546,7 @@ public class GNUGlyphVector return outPositions; } - + private float getAscent() { return fontDelegate.getAscent(fontSize, transform, @@ -561,7 +561,7 @@ public class GNUGlyphVector return fontDelegate.getDescent(fontSize, transform, renderContext.isAntiAliased(), renderContext.usesFractionalMetrics(), - /* horizontal */ true); + /* horizontal */ true); } diff --git a/gnu/java/awt/font/OpenTypeFontPeer.java b/gnu/java/awt/font/OpenTypeFontPeer.java index e8124528e..d8bff1199 100644 --- a/gnu/java/awt/font/OpenTypeFontPeer.java +++ b/gnu/java/awt/font/OpenTypeFontPeer.java @@ -180,7 +180,7 @@ public class OpenTypeFontPeer { return 0.F; } - + } private class XFontMetrics @@ -207,7 +207,7 @@ public class OpenTypeFontPeer return (int) fontDelegate.getDescent(getFont().getSize(), IDENDITY, false, false, false); } - + public int getHeight() { GlyphVector gv = fontDelegate.createGlyphVector(getFont(), @@ -441,7 +441,7 @@ public class OpenTypeFontPeer case Font.PLAIN: default: key.append("p"); - + } return key.toString(); diff --git a/gnu/java/awt/font/autofit/GlyphHints.java b/gnu/java/awt/font/autofit/GlyphHints.java index 72f07ed81..033d63fa4 100644 --- a/gnu/java/awt/font/autofit/GlyphHints.java +++ b/gnu/java/awt/font/autofit/GlyphHints.java @@ -84,7 +84,7 @@ class GlyphHints metrics = m; // TODO: Copy scalerFlags. } - + void reload(Zone outline) { numPoints = 0; diff --git a/gnu/java/awt/font/autofit/Latin.java b/gnu/java/awt/font/autofit/Latin.java index 8951e8b19..c132c2cdc 100644 --- a/gnu/java/awt/font/autofit/Latin.java +++ b/gnu/java/awt/font/autofit/Latin.java @@ -103,7 +103,7 @@ class Latin hints.alignStrongPoints(dim); if (hints.doAlignWeakPoints()) hints.alignWeakPoints(dim); - + } } // FreeType does a save call here. I guess that's not needed as we operate @@ -407,7 +407,7 @@ class Latin dist += 54; else dist += delta; - + } else { @@ -969,7 +969,7 @@ class Latin blue.flags = 0; if (isTopBlue(bb)) blue.flags |= LatinBlue.FLAG_TOP; - // The following flag is used later to adjust y and x scales in + // The following flag is used later to adjust y and x scales in // order to optimize the pixel grid alignment of the top small // letters. if (bb == SMALL_TOP) @@ -1043,7 +1043,7 @@ class Latin last = point; boolean passed = false; boolean onEdge = false; - while (true) + while (true) { int u, v; if (onEdge) @@ -1099,7 +1099,7 @@ class Latin point = point.getNext(); } } - + } private boolean isTopBlue(int b) @@ -1276,7 +1276,7 @@ class Latin // Debug: Print out all edges. // System.err.println("edge# " + e + ": " + edge); - } + } } private void computeBlueEdges(GlyphHints hints, LatinMetrics metrics) @@ -1297,7 +1297,7 @@ class Latin // System.err.println("checking edge: " + edge); Width bestBlue = null; int bestDist = Fixed.mul16(metrics.unitsPerEm / 40, scale); - + if (bestDist > 64 / 2) bestDist = 64 / 2; for (int bb = 0; bb < BLUE_MAX; bb++) diff --git a/gnu/java/awt/font/autofit/Utils.java b/gnu/java/awt/font/autofit/Utils.java index 4df4705a8..ca45bb2e4 100644 --- a/gnu/java/awt/font/autofit/Utils.java +++ b/gnu/java/awt/font/autofit/Utils.java @@ -158,7 +158,7 @@ class Utils return angle; } - + angle = 0; if (dx < 0) { diff --git a/gnu/java/awt/font/opentype/CharGlyphMap.java b/gnu/java/awt/font/opentype/CharGlyphMap.java index 184075094..8529f7e47 100644 --- a/gnu/java/awt/font/opentype/CharGlyphMap.java +++ b/gnu/java/awt/font/opentype/CharGlyphMap.java @@ -89,7 +89,7 @@ public abstract class CharGlyphMap /** * Reads a CharGlyphMap from an OpenType or TrueType <code>cmap</code> * table. The current implementation works as follows: - * + * * <p><ol><li>If the font has a type 4 cmap for the Unicode platform * (encoding 0, 1, 2, 3 or 4), or a type 4 cmap for the Microsoft * platform (encodings 1 or 10), that table is used to map Unicode @@ -132,7 +132,7 @@ public abstract class CharGlyphMap version = buf.getChar(); if (version != 0) return null; - + numTables = buf.getChar(); for (int i = 0; i < numTables; i++) { @@ -229,8 +229,8 @@ public abstract class CharGlyphMap return 0; } } - - + + /** * A mapping from Unicode code points to glyph IDs through CMAP Type * 0 tables. These tables have serious limitations: Only the first @@ -255,8 +255,8 @@ public abstract class CharGlyphMap * Unicode code point of glyph <code>i</code> in the font. */ private char[] glyphToUCS2 = new char[256]; - - + + /** * A String whose <code>charAt(i)</code> is the Unicode character * that corresponds to the codepoint <code>i + 127</code> in the @@ -562,7 +562,7 @@ public abstract class CharGlyphMap /* The CMAP version must be 0. */ if (buf.getChar() != 0) throw new IllegalStateException(); - + numTables = buf.getChar(); for (int i = 0; i < numTables; i++) { @@ -705,7 +705,7 @@ public abstract class CharGlyphMap return null; } } - + /** * A mapping from Unicode code points to glyph IDs through CMAP Type @@ -805,7 +805,7 @@ public abstract class CharGlyphMap buf.position(pos); idRangeOffset_glyphID = buf.asCharBuffer(); - + endCode.limit(segCount); startCode.limit(segCount); idDelta.limit(segCount); @@ -856,7 +856,7 @@ public abstract class CharGlyphMap segStart = firstChar.get(segment); if ((c < segStart) || (c > lastChar.get(segment))) return 0; - + /* * System.out.println("seg " + segment * + ", range=" + (int) rangeID[segment] @@ -912,8 +912,8 @@ public abstract class CharGlyphMap { int numGroups; IntBuffer data; - - + + /** * Determines whether this implementation supports a combination * of platform and encoding for a type 12 <code>cmap</code> table. @@ -964,8 +964,8 @@ public abstract class CharGlyphMap numGroups = buf.getInt(); data = buf.asIntBuffer(); } - - + + /** * Determines the glyph index for a given Unicode codepoint. Users * should be aware that the character-to-glyph mapping not not @@ -993,7 +993,7 @@ public abstract class CharGlyphMap startCharCode = data.get(3 * mid); endCharCode = data.get(3 * mid + 1); - + /* System.out.println("group " + mid + " (U+" + Integer.toHexString(startCharCode) @@ -1005,7 +1005,7 @@ public abstract class CharGlyphMap return ucs4 - startCharCode + /* startGlyphID */ data.get(mid * 3 + 2); - + if (endCharCode < ucs4) min = mid + 1; else diff --git a/gnu/java/awt/font/opentype/GlyphNamer.java b/gnu/java/awt/font/opentype/GlyphNamer.java index c2b009de3..72cecb542 100644 --- a/gnu/java/awt/font/opentype/GlyphNamer.java +++ b/gnu/java/awt/font/opentype/GlyphNamer.java @@ -411,7 +411,7 @@ final class GlyphNamer readPost(); } - + /** * Sets up the information which allows to retrieve the information @@ -625,7 +625,7 @@ final class GlyphNamer * print " private static final String %s" % name * for i in range(0, len(s), 60): * print ' + "%s"' % s[i:i+60] - * + * * glyphs = {} * for line in open('aglfn13.txt', 'r').readlines(): * if line[0] == '#': continue @@ -1009,7 +1009,7 @@ final class GlyphNamer */ min = 0; max = AGLFN_GLYPHS.length() - 1; - mid = max >> 1; + mid = max >> 1; midChar = AGLFN_GLYPHS.charAt(mid); do { @@ -1023,7 +1023,7 @@ final class GlyphNamer midChar = AGLFN_GLYPHS.charAt(mid); } while (min < max); - + if (midChar != c) return null; @@ -1078,7 +1078,7 @@ final class GlyphNamer if (name != null) return name; } - + CPStringBuilder buf = new CPStringBuilder(numChars * 8); for (int i = 0; i < numChars; i++) { diff --git a/gnu/java/awt/font/opentype/MacResourceFork.java b/gnu/java/awt/font/opentype/MacResourceFork.java index 8115e0403..c0f3de80e 100644 --- a/gnu/java/awt/font/opentype/MacResourceFork.java +++ b/gnu/java/awt/font/opentype/MacResourceFork.java @@ -123,7 +123,7 @@ final class MacResourceFork } } } - + public Resource[] getResources(int type) { @@ -137,7 +137,7 @@ final class MacResourceFork } return null; } - + public Resource getResource(int type, short id) { @@ -149,7 +149,7 @@ final class MacResourceFork { if (types[i] != type) continue; - + res = resources[i]; for (int j = 0; j < res.length; j++) if (res[j].getID() == id) diff --git a/gnu/java/awt/font/opentype/NameDecoder.java b/gnu/java/awt/font/opentype/NameDecoder.java index e4ea202bb..1f1d50ac1 100644 --- a/gnu/java/awt/font/opentype/NameDecoder.java +++ b/gnu/java/awt/font/opentype/NameDecoder.java @@ -139,20 +139,20 @@ public class NameDecoder nameLen = nameTable.getShort(); nameStart = offset + nameTable.getShort(); - + if (nameID != name) continue; // Handle PS seperately as it can be only ASCII, although // possibly encoded as UTF-16BE if ( name == NAME_POSTSCRIPT ) - { - if( nameTable.get(nameStart) == 0 ) // Peek at top byte - result = decodeName("UTF-16BE", nameTable, nameStart, nameLen); - else - result = decodeName("ASCII", nameTable, nameStart, nameLen); - return result; - } + { + if( nameTable.get(nameStart) == 0 ) // Peek at top byte + result = decodeName("UTF-16BE", nameTable, nameStart, nameLen); + else + result = decodeName("ASCII", nameTable, nameStart, nameLen); + return result; + } match = false; switch (namePlatform) @@ -186,7 +186,7 @@ public class NameDecoder break; } - + if (match) { result = decodeName(namePlatform, nameEncoding, nameLanguage, @@ -316,7 +316,7 @@ public class NameDecoder if (loc == null) return -1; - + code = findLanguageCode(loc.getLanguage(), macLanguageCodes); switch (code) { @@ -333,10 +333,10 @@ public class NameDecoder // know what do do about them. See the method documentation for // details. } - + return code; } - + /** * Maps a Java Locale into a Microsoft language code. @@ -348,7 +348,7 @@ public class NameDecoder if (locale == null) return -1; - + isoCode = locale.getLanguage(); code = findLanguageCode(isoCode, microsoftLanguageCodes); if (code == -1) @@ -572,7 +572,7 @@ public class NameDecoder } } - + /** * Maps a Microsoft locale ID (LCID) to the name of the * corresponding Java Charset. @@ -664,7 +664,7 @@ public class NameDecoder case 3: /* Microsoft Windows */ return getWindowsLocale(language); - + default: return null; } diff --git a/gnu/java/awt/font/opentype/OpenTypeFont.java b/gnu/java/awt/font/opentype/OpenTypeFont.java index 6c2193b94..f46addc3c 100644 --- a/gnu/java/awt/font/opentype/OpenTypeFont.java +++ b/gnu/java/awt/font/opentype/OpenTypeFont.java @@ -83,7 +83,7 @@ public final class OpenTypeFont static final int TAG_TRUE = 0x74727565; // 'true' static final int TAG_TTCF = 0x74746366; // 'ttcf' static final int TAG_ZAPF = 0x5a617066; // 'Zapf' - + /** * A buffer containing the font data. Note that this may well be an @@ -112,7 +112,7 @@ public final class OpenTypeFont */ private int version; - + /** * The number of font units per em. For fonts with TrueType * outlines, this is usually a power of two (such as 2048). For @@ -133,7 +133,7 @@ public final class OpenTypeFont * The scaler to which the actual scaling work is delegated. */ private Scaler scaler; - + /** * A delegate object for mapping Unicode UCS-4 codepoints to glyph @@ -277,8 +277,8 @@ public final class OpenTypeFont return i; return -1; } - - + + /** * Returns the name of the family to which this font face belongs, @@ -352,8 +352,8 @@ public final class OpenTypeFont return name; } - - + + /** * Returns the full name of this font face, for example @@ -404,7 +404,7 @@ public final class OpenTypeFont */ return numGlyphs; } - + /** * Returns the index of the glyph which gets displayed if the font @@ -489,7 +489,7 @@ public final class OpenTypeFont result.limit(len); return result; } - + /** * Returns the size of one of the tables in the font, @@ -508,7 +508,7 @@ public final class OpenTypeFont { if (cmap != null) return cmap; - + synchronized (this) { if (cmap == null) @@ -545,7 +545,7 @@ public final class OpenTypeFont return getCharGlyphMap().getGlyph(ucs4); } - + /** * Creates a GlyphVector by mapping each character in a * CharacterIterator to the corresponding glyph. @@ -584,7 +584,7 @@ public final class OpenTypeFont // Initialize hinter if necessary. checkHinter(FontDelegate.FLAG_FITTED); - CharGlyphMap cmap; + CharGlyphMap cmap; int numGlyphs; int[] glyphs; int glyph; diff --git a/gnu/java/awt/font/opentype/OpenTypeFontFactory.java b/gnu/java/awt/font/opentype/OpenTypeFontFactory.java index 3a00dfba2..32c4828c9 100644 --- a/gnu/java/awt/font/opentype/OpenTypeFontFactory.java +++ b/gnu/java/awt/font/opentype/OpenTypeFontFactory.java @@ -126,7 +126,7 @@ public final class OpenTypeFontFactory rsrc = fork.getResources(OpenTypeFont.TAG_SFNT); fonts = new OpenTypeFont[rsrc.length]; - for (int i = 0; i < fonts.length; i++) + for (int i = 0; i < fonts.length; i++) fonts[i] = new OpenTypeFont(rsrc[i].getContent(), 0); return fonts; diff --git a/gnu/java/awt/font/opentype/truetype/GlyphLoader.java b/gnu/java/awt/font/opentype/truetype/GlyphLoader.java index 249a87dd4..8a3c56665 100644 --- a/gnu/java/awt/font/opentype/truetype/GlyphLoader.java +++ b/gnu/java/awt/font/opentype/truetype/GlyphLoader.java @@ -71,8 +71,8 @@ final class GlyphLoader * glyph. */ private final GlyphMeasurer glyphMeasurer; - - + + /** * The virtual machine for executing TrueType bytecodes. */ @@ -157,7 +157,7 @@ final class GlyphLoader yMin = glyph.getChar(); xMax = glyph.getChar(); yMax = glyph.getChar(); - + if (numContours >= 0) loadSimpleGlyph(glyphIndex, pointSize, transform, antialias, @@ -272,13 +272,13 @@ final class GlyphLoader if ((flags & WE_HAVE_A_SCALE) != 0) { a = d = getDouble214(glyph); - b = c = 0.0; + b = c = 0.0; } else if ((flags & WE_HAVE_AN_X_AND_Y_SCALE) != 0) { a = getDouble214(glyph); d = getDouble214(glyph); - b = c = 0.0; + b = c = 0.0; } else if ((flags & WE_HAVE_A_TWO_BY_TWO) != 0) { @@ -310,7 +310,7 @@ final class GlyphLoader if (Math.abs(Math.abs(c) - Math.abs(d)) <= 33.0/65536.0) n = n * 2; - + if ((flags & ARGS_ARE_XY_VALUES) != 0) { e = m * arg1; @@ -320,14 +320,14 @@ final class GlyphLoader e = f = 0.0; componentTransform.setTransform(a, b, c, d, 0.0, 0.0); - + // System.out.println("componentTransform = " + componentTransform // + ", e=" + e + ", f=" + f); componentTransform.concatenate(transform); int pos = glyph.position(); int lim = glyph.limit(); - + loadSubGlyph(subGlyphIndex, pointSize, componentTransform, antialias, subGlyphZone, Math.round((float) e + preTranslateX), @@ -431,7 +431,7 @@ final class GlyphLoader glyphMeasurer.getAdvanceWidth(glyphIndex, true)); glyphZone.setOriginalY(numPoints + 1, glyphMeasurer.getAdvanceHeight(glyphIndex, true)); - + /* Phantom point 2: Vertical origin. */ int vertX = glyphMeasurer.getAscent(/* vertical */ false); int vertY = glyphMeasurer.getAscent(/* horizontal */ true); diff --git a/gnu/java/awt/font/opentype/truetype/GlyphLocator.java b/gnu/java/awt/font/opentype/truetype/GlyphLocator.java index a2db8aca7..fc2256b15 100644 --- a/gnu/java/awt/font/opentype/truetype/GlyphLocator.java +++ b/gnu/java/awt/font/opentype/truetype/GlyphLocator.java @@ -94,7 +94,7 @@ abstract class GlyphLocator case 1: return new GlyphLocator.FourByte(loca, glyf); - + default: throw new FontFormatException("unsupported loca format"); } diff --git a/gnu/java/awt/font/opentype/truetype/GlyphMeasurer.java b/gnu/java/awt/font/opentype/truetype/GlyphMeasurer.java index bbd0b9bff..452456d13 100644 --- a/gnu/java/awt/font/opentype/truetype/GlyphMeasurer.java +++ b/gnu/java/awt/font/opentype/truetype/GlyphMeasurer.java @@ -69,7 +69,7 @@ final class GlyphMeasurer * font’s <code>vmtx</code> table as shorts. */ private final ShortBuffer verticalGlyphMetrics; - + private final int numLongHorizontalMetricsEntries; private final int numLongVerticalMetricsEntries; @@ -82,7 +82,7 @@ final class GlyphMeasurer private final int horizontalLineGap; - + /** * Constructs a GlyphMeasurer from TrueType/OpenType font tables. * @@ -145,7 +145,7 @@ final class GlyphMeasurer { return horizontal ? horizontalAscent : verticalAscent; } - + /** * Returns the distance from the baseline to the lowest descender. @@ -156,7 +156,7 @@ final class GlyphMeasurer * @return the maximal descent, in font units. */ public int getDescent(boolean horizontal) - { + { return horizontal ? horizontalDescent : verticalDescent; } @@ -188,7 +188,7 @@ final class GlyphMeasurer * @return the advance width, in font units. */ public int getAdvanceWidth(int glyphIndex, boolean horizontal) - { + { if (!horizontal) return 0; diff --git a/gnu/java/awt/font/opentype/truetype/Point.java b/gnu/java/awt/font/opentype/truetype/Point.java index 31c12037c..438eb6558 100644 --- a/gnu/java/awt/font/opentype/truetype/Point.java +++ b/gnu/java/awt/font/opentype/truetype/Point.java @@ -53,7 +53,7 @@ public class Point public static final short FLAG_INFLECTION = 32; public static final short FLAG_DONE_X = 64; public static final short FLAG_DONE_Y = 128; - + /** * Right direction. */ diff --git a/gnu/java/awt/font/opentype/truetype/TrueTypeScaler.java b/gnu/java/awt/font/opentype/truetype/TrueTypeScaler.java index 5f5cc0001..1d5c53f9d 100644 --- a/gnu/java/awt/font/opentype/truetype/TrueTypeScaler.java +++ b/gnu/java/awt/font/opentype/truetype/TrueTypeScaler.java @@ -137,7 +137,7 @@ public final class TrueTypeScaler ByteBuffer htmx, ByteBuffer vhea, ByteBuffer vtmx, - ByteBuffer maxp, + ByteBuffer maxp, ByteBuffer controlValueTable, ByteBuffer fpgm, int locaFormat, ByteBuffer loca, @@ -254,7 +254,7 @@ public final class TrueTypeScaler advance.setLocation( scaleFactor * glyphMeasurer.getAdvanceWidth(glyphIndex, horizontal), scaleFactor * glyphMeasurer.getAdvanceHeight(glyphIndex, horizontal)); - + transform.transform(advance, advance); } diff --git a/gnu/java/awt/font/opentype/truetype/VirtualMachine.java b/gnu/java/awt/font/opentype/truetype/VirtualMachine.java index c88d4c649..512c39ffd 100644 --- a/gnu/java/awt/font/opentype/truetype/VirtualMachine.java +++ b/gnu/java/awt/font/opentype/truetype/VirtualMachine.java @@ -70,7 +70,7 @@ import java.nio.ShortBuffer; * obtained from Apple Computer to use the patented technology inside * the United States. For other countries, different dates might * apply, or no license might be needed. - * + * * <p>The default build of this class does not use the patented * algorithms. If you have obtained a license from Apple, or if the * patent protection has expired, or if no license is required for @@ -348,7 +348,7 @@ class VirtualMachine /* Read the contents of the Control Value Table. */ if (controlValueTable != null) this.controlValueTable = controlValueTable.asShortBuffer(); - + maxInstructionDefs = maxp.getChar(22); maxStackElements = maxp.getChar(24); storage = new int[maxStorage]; @@ -356,7 +356,7 @@ class VirtualMachine this.preProgram = preProgram; numTwilightPoints = maxp.getChar(16); } - + /** * Sets the graphics state to default values. @@ -462,7 +462,7 @@ class VirtualMachine changeCTM = ((pointSize_Fixed != this.pointSize) || !deviceTransform.equals(this.deviceTransform) || (antialiased != this.antialiased)); - + if (changeCTM) { this.pointSize = pointSize_Fixed; @@ -489,7 +489,7 @@ class VirtualMachine return executeGlyphInstructions; } - + /** * Executes a stream of TrueType instructions. @@ -577,7 +577,7 @@ class VirtualMachine sbuf.append(getHex(inst.get(pc + 1 + i))); } } - + while (sbuf.length() < 30) sbuf.append(' '); sbuf.append('|'); @@ -814,7 +814,7 @@ class VirtualMachine case 0x16: // SZPS, Set Zone PointerS zp0 = zp1 = zp2 = getZone(stack[sp--]); break; - + case 0x17: // SLOOP, Set LOOP variable loop = stack[sp--]; break; @@ -837,7 +837,7 @@ class VirtualMachine /* illegal: --, -- */ -1, -1, /* handle nested if clauses */ true); break; - + case 0x1C: // JMPR, JuMP Relative inst.position(inst.position() - 1 + stack[sp--]); break; @@ -905,7 +905,7 @@ class VirtualMachine execute(fdefBuffer[i], fdefEntryPoint[i]); inst.position(e1); break; - + case 0x2C: // FDEF, Function DEFinition i = stack[sp--]; fdefBuffer[i] = inst; @@ -1170,7 +1170,7 @@ class VirtualMachine sp -= 2 * count; deltaC(stack, sp + 1, count, 32); break; - + case 0x76: // SROUND, Super ROUND setRoundingMode(Fixed.ONE, stack[sp--]); break; @@ -1198,7 +1198,7 @@ class VirtualMachine break; case 0x7c: // RUTG, Round Up To Grid - setRoundingMode(Fixed.ONE, 0x40); + setRoundingMode(Fixed.ONE, 0x40); break; case 0x7d: // RDTG, Round Down To Grid @@ -1279,7 +1279,7 @@ class VirtualMachine break; } break; - + case 0xb0: // PUSHB[0] case 0xb1: // PUSHB[1] case 0xb2: // PUSHB[2] @@ -1424,7 +1424,7 @@ class VirtualMachine delta = (arg & 15) - 8; if (delta >= 0) ++delta; - + rightShift = deltaShift - 6; if (rightShift > 0) delta = delta >> rightShift; @@ -1570,7 +1570,7 @@ class VirtualMachine org_a = getOriginalProjection(zp0, rp1); cur_a = getProjection(zp0, rp1); - org_b = getOriginalProjection(zp1, rp2); + org_b = getOriginalProjection(zp1, rp2); cur_b = getProjection(zp1, rp2); while (--loop >= 0) @@ -1643,7 +1643,7 @@ class VirtualMachine { result = compensation - roundPhase + roundThreshold - distance; result &= -roundPeriod; - return Math.max(-result, 0) - roundPhase; + return Math.max(-result, 0) - roundPhase; } } @@ -1694,7 +1694,7 @@ class VirtualMachine { cachedPixelsPerEM = Fixed.intValue(Fixed.vectorLength( applyCTM_x(projX >> 8, projY >> 8), - applyCTM_y(projX >> 8, projY >> 8))); + applyCTM_y(projX >> 8, projY >> 8))); } return cachedPixelsPerEM; diff --git a/gnu/java/awt/font/opentype/truetype/Zone.java b/gnu/java/awt/font/opentype/truetype/Zone.java index 7c25a0a6a..b0559e0e3 100644 --- a/gnu/java/awt/font/opentype/truetype/Zone.java +++ b/gnu/java/awt/font/opentype/truetype/Zone.java @@ -229,7 +229,7 @@ public final class Zone System.out.print('.'); else System.out.print('c'); - if (isContourEnd(i)) + if (isContourEnd(i)) System.out.print('E'); System.out.println(); if (isContourEnd(i)) diff --git a/gnu/java/awt/font/opentype/truetype/ZonePathIterator.java b/gnu/java/awt/font/opentype/truetype/ZonePathIterator.java index 0f60828b8..f4534f36f 100644 --- a/gnu/java/awt/font/opentype/truetype/ZonePathIterator.java +++ b/gnu/java/awt/font/opentype/truetype/ZonePathIterator.java @@ -70,7 +70,7 @@ final class ZonePathIterator */ private static final int EMIT_CLOSE = 1; - + /** * If <code>state</code> has this value, <code>currentSegment</code> * will emit a <code>SEG_MOVETO</code> segment to the first point in @@ -115,7 +115,7 @@ final class ZonePathIterator */ private int contourStart; - + private int type; /** @@ -152,7 +152,7 @@ final class ZonePathIterator return (state != EMIT_CLOSE) && (curPoint >= numPoints); } - + public void next() { boolean onCurve; @@ -231,7 +231,7 @@ final class ZonePathIterator else return p + 1; } - + /** @@ -244,7 +244,7 @@ final class ZonePathIterator { case EMIT_CLOSE: return PathIterator.SEG_CLOSE; - + case EMIT_MOVETO: return getStartSegment(curPoint, coords); @@ -270,7 +270,7 @@ final class ZonePathIterator if (floats == null) floats = new float[6]; int result; - + result = currentSegment(floats); for (int i = 0; i < 6; i++) coords[i] = floats[i]; @@ -362,7 +362,7 @@ final class ZonePathIterator if (zone.isOnCurve(contourStart)) { x = zone.getX(contourStart, type); - y = zone.getY(contourStart, type); + y = zone.getY(contourStart, type); } else { diff --git a/gnu/java/awt/image/AsyncImage.java b/gnu/java/awt/image/AsyncImage.java index 935601a88..4fa33740e 100644 --- a/gnu/java/awt/image/AsyncImage.java +++ b/gnu/java/awt/image/AsyncImage.java @@ -159,9 +159,9 @@ public class AsyncImage g = r.getGraphics(); // Should we return some dummy graphics instead? return g; } - + public boolean isComplete() { - return complete; + return complete; } public int getHeight(ImageObserver observer) diff --git a/gnu/java/awt/image/ImageConverter.java b/gnu/java/awt/image/ImageConverter.java index f607b3496..f9c6268c3 100644 --- a/gnu/java/awt/image/ImageConverter.java +++ b/gnu/java/awt/image/ImageConverter.java @@ -55,7 +55,7 @@ import java.util.Hashtable; /** * Convert an Image to a BufferedImage. - * + * * @author Roman Kennke (kennke@aicas.com) */ public class ImageConverter implements ImageConsumer @@ -121,7 +121,7 @@ public class ImageConverter implements ImageConsumer scansize, transparency); } else if (model instanceof IndexColorModel - && targetColorModel.equals(ColorModel.getRGBdefault())) + && targetColorModel.equals(ColorModel.getRGBdefault())) { transparency = convertIndexColorModelToSRGB(x, y, w, h, (IndexColorModel) model, @@ -246,7 +246,7 @@ public class ImageConverter implements ImageConsumer * @param offset the offset in the pixel array * @param scansize the scanline size * @param transparency the assumed transparency - * + * * @return the determined transparency */ private int transferPixels(int x, int y, int w, int h, ColorModel model, @@ -281,7 +281,7 @@ public class ImageConverter implements ImageConsumer * @param offset the offset in the pixel array * @param scansize the scanline size * @param transparency the assumed transparency - * + * * @return the determined transparency */ private int transferPixels(int x, int y, int w, int h, ColorModel model, @@ -317,7 +317,7 @@ public class ImageConverter implements ImageConsumer * @param offset the offset in the pixel array * @param scansize the scanline size * @param transparency the assumed transparency - * + * * @return the determined transparency */ private int convertPixels(int x, int y, int w, int h, ColorModel model, @@ -356,7 +356,7 @@ public class ImageConverter implements ImageConsumer * @param offset the offset in the pixel array * @param scansize the scanline size * @param transparency the assumed transparency - * + * * @return the determined transparency */ private int convertPixels(int x, int y, int w, int h, ColorModel model, @@ -394,7 +394,7 @@ public class ImageConverter implements ImageConsumer * @param offset the offset in the pixel array * @param scansize the scanline size * @param transparency the assumed transparency - * + * * @return the determined transparency */ private int convertIndexColorModelToSRGB(int x, int y, int w, int h, @@ -447,7 +447,7 @@ public class ImageConverter implements ImageConsumer * @param offset the offset in the pixel array * @param scansize the scanline size * @param transparency the assumed transparency - * + * * @return the determined transparency */ private int convertIndexColorModelToSRGB(int x, int y, int w, int h, diff --git a/gnu/java/awt/image/ImageDecoder.java b/gnu/java/awt/image/ImageDecoder.java index 8e8eecb25..a572ea33b 100644 --- a/gnu/java/awt/image/ImageDecoder.java +++ b/gnu/java/awt/image/ImageDecoder.java @@ -48,7 +48,7 @@ import java.io.InputStream; import java.net.URL; import java.util.Vector; -public abstract class ImageDecoder implements ImageProducer +public abstract class ImageDecoder implements ImageProducer { Vector consumers = new Vector (); String filename; @@ -94,7 +94,7 @@ public abstract class ImageDecoder implements ImageProducer length = imagelength; } - public void addConsumer (ImageConsumer ic) + public void addConsumer (ImageConsumer ic) { consumers.addElement (ic); } @@ -103,7 +103,7 @@ public abstract class ImageDecoder implements ImageProducer { return consumers.contains (ic); } - + public void removeConsumer (ImageConsumer ic) { consumers.removeElement (ic); @@ -115,20 +115,20 @@ public abstract class ImageDecoder implements ImageProducer addConsumer(ic); Vector list = (Vector) consumers.clone (); - try + try { - // Create the input stream here rather than in the - // ImageDecoder constructors so that exceptions cause - // imageComplete to be called with an appropriate error - // status. + // Create the input stream here rather than in the + // ImageDecoder constructors so that exceptions cause + // imageComplete to be called with an appropriate error + // status. if (input == null) { - try + try { if (url != null) input = url.openStream(); - else if (datainput != null) - input = new DataInputStreamWrapper(datainput); + else if (datainput != null) + input = new DataInputStreamWrapper(datainput); else { if (filename != null) @@ -137,8 +137,8 @@ public abstract class ImageDecoder implements ImageProducer input = new ByteArrayInputStream (data, offset, length); } produce (list, input); - } - finally + } + finally { input = null; } @@ -150,16 +150,16 @@ public abstract class ImageDecoder implements ImageProducer } catch (Exception e) { - for (int i = 0; i < list.size (); i++) - { - ImageConsumer ic2 = (ImageConsumer) list.elementAt (i); - ic2.imageComplete (ImageConsumer.IMAGEERROR); - } + for (int i = 0; i < list.size (); i++) + { + ImageConsumer ic2 = (ImageConsumer) list.elementAt (i); + ic2.imageComplete (ImageConsumer.IMAGEERROR); + } } } - public void requestTopDownLeftRightResend (ImageConsumer ic) - { + public void requestTopDownLeftRightResend (ImageConsumer ic) + { } public abstract void produce (Vector v, InputStream is) throws IOException; @@ -176,13 +176,13 @@ public abstract class ImageDecoder implements ImageProducer public int read() throws IOException { try - { - return datainput.readByte() & 0xFF; - } + { + return datainput.readByte() & 0xFF; + } catch (EOFException eofe) - { - return -1; - } + { + return -1; + } } } } diff --git a/gnu/java/awt/image/XBMDecoder.java b/gnu/java/awt/image/XBMDecoder.java index 0793d8ee7..35a3568b8 100644 --- a/gnu/java/awt/image/XBMDecoder.java +++ b/gnu/java/awt/image/XBMDecoder.java @@ -55,8 +55,8 @@ public class XBMDecoder extends ImageDecoder static final ColorModel cm = ColorModel.getRGBdefault (); static final int black = 0xff000000; static final int transparent = 0x00000000; - static final int masktable[] = { 0x01, 0x02, 0x04, 0x08, - 0x10, 0x20, 0x40, 0x80 }; + static final int masktable[] = { 0x01, 0x02, 0x04, 0x08, + 0x10, 0x20, 0x40, 0x80 }; public XBMDecoder (String filename) { @@ -75,27 +75,27 @@ public class XBMDecoder extends ImageDecoder for (int i = 0; i < 2; i++) { - String line = reader.readLine (); - StringTokenizer st = new StringTokenizer (line); - - st.nextToken (); // #define - st.nextToken (); // name_[width|height] - if (i == 0) - width = Integer.parseInt (st.nextToken (), 10); - else - height = Integer.parseInt (st.nextToken (), 10); + String line = reader.readLine (); + StringTokenizer st = new StringTokenizer (line); + + st.nextToken (); // #define + st.nextToken (); // name_[width|height] + if (i == 0) + width = Integer.parseInt (st.nextToken (), 10); + else + height = Integer.parseInt (st.nextToken (), 10); } for (int i = 0; i < v.size (); i++) { - ImageConsumer ic = (ImageConsumer) v.elementAt (i); - - ic.setDimensions (width, height); - ic.setColorModel (cm); - ic.setHints (ImageConsumer.COMPLETESCANLINES - | ImageConsumer.SINGLEFRAME - | ImageConsumer.SINGLEPASS - | ImageConsumer.TOPDOWNLEFTRIGHT); + ImageConsumer ic = (ImageConsumer) v.elementAt (i); + + ic.setDimensions (width, height); + ic.setColorModel (cm); + ic.setHints (ImageConsumer.COMPLETESCANLINES + | ImageConsumer.SINGLEFRAME + | ImageConsumer.SINGLEPASS + | ImageConsumer.TOPDOWNLEFTRIGHT); } /* skip to the byte array */ @@ -104,22 +104,22 @@ public class XBMDecoder extends ImageDecoder /* loop through each scanline */ for (int line = 0; line < height; line++) { - int scanline[] = getScanline (reader, width); + int scanline[] = getScanline (reader, width); - for (int i = 0; i < v.size (); i++) - { - ImageConsumer ic = (ImageConsumer) v.elementAt (i); - ic.setPixels (0, 0 + line, width, 1, cm, scanline, 0, width); - } + for (int i = 0; i < v.size (); i++) + { + ImageConsumer ic = (ImageConsumer) v.elementAt (i); + ic.setPixels (0, 0 + line, width, 1, cm, scanline, 0, width); + } } /* tell each ImageConsumer that we're finished */ for (int i = 0; i < v.size (); i++) { - ImageConsumer ic = (ImageConsumer) v.elementAt (i); - ic.imageComplete (ImageConsumer.STATICIMAGEDONE); + ImageConsumer ic = (ImageConsumer) v.elementAt (i); + ic.imageComplete (ImageConsumer.STATICIMAGEDONE); } - } + } public static int[] getScanline (Reader in, int len) throws IOException { @@ -129,25 +129,25 @@ public class XBMDecoder extends ImageDecoder while (x < len) { - int ch = in.read (); - if (ch == '0') - { - in.read (); // 'x' - - byteStr[0] = (char) in.read (); - byteStr[1] = (char) in.read (); - - int byteVal = Integer.parseInt (new String (byteStr), 16); - - for (int i = 0; i < 8; i++, x++) - { - if (x == len) // condition occurs if bitmap is padded - return scanline; - - scanline[x] = ((byteVal & masktable[i]) != 0) ? - black : transparent; - } - } + int ch = in.read (); + if (ch == '0') + { + in.read (); // 'x' + + byteStr[0] = (char) in.read (); + byteStr[1] = (char) in.read (); + + int byteVal = Integer.parseInt (new String (byteStr), 16); + + for (int i = 0; i < 8; i++, x++) + { + if (x == len) // condition occurs if bitmap is padded + return scanline; + + scanline[x] = ((byteVal & masktable[i]) != 0) ? + black : transparent; + } + } } return scanline; diff --git a/gnu/java/awt/java2d/AbstractGraphics2D.java b/gnu/java/awt/java2d/AbstractGraphics2D.java index 850465938..1334866f2 100644 --- a/gnu/java/awt/java2d/AbstractGraphics2D.java +++ b/gnu/java/awt/java2d/AbstractGraphics2D.java @@ -166,7 +166,7 @@ public abstract class AbstractGraphics2D */ protected static final WeakHashMap<Image, HashMap<Dimension,Image>> imageCache = new WeakHashMap<Image, HashMap<Dimension, Image>>(); - + /** * Wether we use anti aliasing for rendering text by default or not. */ @@ -234,7 +234,7 @@ public abstract class AbstractGraphics2D */ private Color foreground = Color.BLACK; private boolean isForegroundColorNull = true; - + /** * The current font. */ @@ -287,16 +287,16 @@ public abstract class AbstractGraphics2D private static final HashMap<Key, Object> STANDARD_HINTS; static { - + HashMap<Key, Object> hints = new HashMap<Key, Object>(); hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT); hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_DEFAULT); - + STANDARD_HINTS = hints; } - + /** * Creates a new AbstractGraphics2D instance. */ @@ -398,8 +398,8 @@ public abstract class AbstractGraphics2D * * @param image the source buffered image * @param op the filter to apply to the buffered image before rendering - * @param x the x coordinate to render the image to - * @param y the y coordinate to render the image to + * @param x the x coordinate to render the image to + * @param y the y coordinate to render the image to */ public void drawImage(BufferedImage image, BufferedImageOp op, int x, int y) { @@ -415,7 +415,7 @@ public abstract class AbstractGraphics2D * transform is used to convert the image into user space. The transform * of this AbstractGraphics2D object is used to transform from user space * to device space. - * + * * The rendering is performed using the scanline algorithm that performs the * rendering of other shapes and a custom Paint implementation, that supplies * the pixel values of the rendered image. @@ -438,7 +438,7 @@ public abstract class AbstractGraphics2D * of this AbstractGraphics2D object is used to transform from user space * to device space. Only the area specified by <code>areaOfInterest</code> * is finally rendered to the target. - * + * * The rendering is performed using the scanline algorithm that performs the * rendering of other shapes and a custom Paint implementation, that supplies * the pixel values of the rendered image. @@ -504,7 +504,7 @@ public abstract class AbstractGraphics2D (int) image.getWidth(), (int) image.getHeight()); drawRenderableImageImpl(image, xform, areaOfInterest); - + } /** @@ -648,7 +648,7 @@ public abstract class AbstractGraphics2D if (p != null) { paint = p; - + if (! (paint instanceof Color)) { isOptimized = false; @@ -665,11 +665,11 @@ public abstract class AbstractGraphics2D this.foreground = Color.BLACK; isForegroundColorNull = true; } - + // free resources if needed, then put the paint context to null if (this.paintContext != null) this.paintContext.dispose(); - + this.paintContext = null; } @@ -745,7 +745,7 @@ public abstract class AbstractGraphics2D * Translates the coordinate system by (x, y). * * @param x the translation X coordinate - * @param y the translation Y coordinate + * @param y the translation Y coordinate */ public void translate(int x, int y) { @@ -775,7 +775,7 @@ public abstract class AbstractGraphics2D * Translates the coordinate system by (tx, ty). * * @param tx the translation X coordinate - * @param ty the translation Y coordinate + * @param ty the translation Y coordinate */ public void translate(double tx, double ty) { @@ -992,7 +992,7 @@ public abstract class AbstractGraphics2D if (clip == null) setClip(s); - // This is so common, let's optimize this. + // This is so common, let's optimize this. else if (clip instanceof Rectangle && s instanceof Rectangle) { Rectangle clipRect = (Rectangle) clip; @@ -1076,8 +1076,8 @@ public abstract class AbstractGraphics2D else copy.clip = null; - copy.renderingHints = new RenderingHints(null); - copy.renderingHints.putAll(renderingHints); + copy.renderingHints = new RenderingHints(null); + copy.renderingHints.putAll(renderingHints); copy.transform = new AffineTransform(transform); // The remaining state is inmmutable and doesn't need to be copied. return copy; @@ -1097,7 +1097,7 @@ public abstract class AbstractGraphics2D { if (isForegroundColorNull) return null; - + return this.foreground; } @@ -1107,7 +1107,7 @@ public abstract class AbstractGraphics2D * @param color the foreground to set */ public void setColor(Color color) - { + { this.setPaint(color); } @@ -1298,7 +1298,7 @@ public abstract class AbstractGraphics2D /** * Fills a rectangle with the current background color. * - * This implementation temporarily sets the foreground color to the + * This implementation temporarily sets the foreground color to the * background and forwards the call to {@link #fillRect(int, int, int, int)}. * * @param x the upper left corner, X coordinate @@ -1590,7 +1590,7 @@ public abstract class AbstractGraphics2D int dy = Math.min(dy1, dy2); int dw = Math.abs(dx1 - dx2); int dh = Math.abs(dy1 - dy2); - + AffineTransform t = new AffineTransform(); t.translate(sx - dx, sy - dy); double scaleX = (double) sw / (double) dw; @@ -1693,7 +1693,7 @@ public abstract class AbstractGraphics2D * * @param x0 the starting point, X coordinate * @param y0 the starting point, Y coordinate - * @param x1 the end point, X coordinate + * @param x1 the end point, X coordinate * @param y1 the end point, Y coordinate */ protected void rawDrawLine(int x0, int y0, int x1, int y1) @@ -1806,7 +1806,7 @@ public abstract class AbstractGraphics2D public void renderScanline(int y, ScanlineCoverage c) { PaintContext pCtx = getPaintContext(); - + int x0 = c.getMinX(); int x1 = c.getMaxX(); Raster paintRaster = pCtx.getRaster(x0, y, x1 - x0, 1); @@ -1842,7 +1842,7 @@ public abstract class AbstractGraphics2D renderingHints); WritableRaster raster = getDestinationRaster(); WritableRaster targetChild = raster.createWritableTranslatedChild(-x0, -y); - + cCtx.compose(paintRaster, targetChild, targetChild); updateRaster(raster, x0, y, x1 - x0, 1); cCtx.dispose(); @@ -2042,7 +2042,7 @@ public abstract class AbstractGraphics2D getTransform(), getRenderingHints()); } - + return this.paintContext; } diff --git a/gnu/java/awt/java2d/AlphaCompositeContext.java b/gnu/java/awt/java2d/AlphaCompositeContext.java index 2e3690d83..f1f082abe 100644 --- a/gnu/java/awt/java2d/AlphaCompositeContext.java +++ b/gnu/java/awt/java2d/AlphaCompositeContext.java @@ -82,7 +82,7 @@ public class AlphaCompositeContext /** * Creates a new AlphaCompositeContext. * - * @param aComp the AlphaComposite object + * @param aComp the AlphaComposite object * @param srcCM the source color model * @param dstCM the destination color model */ @@ -93,7 +93,7 @@ public class AlphaCompositeContext srcColorModel = srcCM; dstColorModel = dstCM; - + // Determine the blending factors according to the rule in the // AlphaComposite. For some rules the factors must be determined // dynamically because they depend on the actual pixel value. @@ -301,7 +301,7 @@ public class AlphaCompositeContext { for (int i = 0; i < dstComponentsLength - 1; i++) { - dstComponents[i] = dstComponents[i] / dstAlpha; + dstComponents[i] = dstComponents[i] / dstAlpha; } } diff --git a/gnu/java/awt/java2d/CubicSegment.java b/gnu/java/awt/java2d/CubicSegment.java index bf66be870..8197c94c5 100644 --- a/gnu/java/awt/java2d/CubicSegment.java +++ b/gnu/java/awt/java2d/CubicSegment.java @@ -80,11 +80,11 @@ public class CubicSegment extends Segment public Object clone() { CubicSegment segment = null; - + try { segment = (CubicSegment) super.clone(); - + segment.P1 = (Point2D) P1.clone(); segment.P2 = (Point2D) P2.clone(); segment.cp1 = (Point2D) cp1.clone(); @@ -96,7 +96,7 @@ public class CubicSegment extends Segment ie.initCause(cnse); throw ie; } - + return segment; } @@ -161,7 +161,7 @@ public class CubicSegment extends Segment return new Segment[] { segmentTop, segmentBottom }; } - + public void reverse() { Point2D temp = P1; @@ -174,11 +174,11 @@ public class CubicSegment extends Segment public double[] cp1() { - return new double[]{cp1.getX(), cp1.getY()}; + return new double[]{cp1.getX(), cp1.getY()}; } public double[] cp2() { - return new double[]{cp2.getX(), cp2.getY()}; + return new double[]{cp2.getX(), cp2.getY()}; } } // class CubicSegment diff --git a/gnu/java/awt/java2d/LineSegment.java b/gnu/java/awt/java2d/LineSegment.java index 0395fd0af..904037989 100644 --- a/gnu/java/awt/java2d/LineSegment.java +++ b/gnu/java/awt/java2d/LineSegment.java @@ -63,7 +63,7 @@ public class LineSegment extends Segment public Object clone() { LineSegment segment = null; - + try { segment = (LineSegment) super.clone(); @@ -76,7 +76,7 @@ public class LineSegment extends Segment ie.initCause(cnse); throw ie; } - + return segment; } @@ -108,11 +108,11 @@ public class LineSegment extends Segment public double[] cp1() { - return new double[]{P2.getX(), P2.getY()}; + return new double[]{P2.getX(), P2.getY()}; } public double[] cp2() { - return new double[]{P1.getX(), P1.getY()}; + return new double[]{P1.getX(), P1.getY()}; } } // class LineSegment diff --git a/gnu/java/awt/java2d/PixelCoverage.java b/gnu/java/awt/java2d/PixelCoverage.java index c83ad1fff..356021b3d 100644 --- a/gnu/java/awt/java2d/PixelCoverage.java +++ b/gnu/java/awt/java2d/PixelCoverage.java @@ -124,7 +124,7 @@ final class PixelCoverage Bucket match = current; while (match != null && match.xPos != x) { - + } return match; diff --git a/gnu/java/awt/java2d/QuadSegment.java b/gnu/java/awt/java2d/QuadSegment.java index 97a5372f6..b8d0ff52e 100644 --- a/gnu/java/awt/java2d/QuadSegment.java +++ b/gnu/java/awt/java2d/QuadSegment.java @@ -89,7 +89,7 @@ public class QuadSegment extends Segment public Object clone() { QuadSegment segment = null; - + try { segment = (QuadSegment) super.clone(); @@ -104,7 +104,7 @@ public class QuadSegment extends Segment ie.initCause(cnse); throw ie; } - + return segment; } @@ -135,10 +135,10 @@ public class QuadSegment extends Segment return new Segment[]{s1, s2}; } - + private QuadSegment offsetSubdivided(QuadCurve2D curve, boolean plus) { - double[] n1 = normal(curve.getX1(), curve.getY1(), + double[] n1 = normal(curve.getX1(), curve.getY1(), curve.getCtrlX(), curve.getCtrlY()); double[] n2 = normal(curve.getCtrlX(), curve.getCtrlY(), curve.getX2(), curve.getY2()); @@ -152,7 +152,7 @@ public class QuadSegment extends Segment n2[0] = -n2[0]; n2[1] = -n2[1]; } - + // Handle special cases where the control point is equal to an end point // or end points are equal (ie, straight lines) if (curve.getP1().equals(curve.getCtrlPt())) @@ -179,7 +179,7 @@ public class QuadSegment extends Segment double ratio = radius / length; deltaX *= ratio; deltaY *= ratio; - + if (plus) cp.setLocation(cp.getX() + deltaX, cp.getY() + deltaY); else @@ -192,16 +192,16 @@ public class QuadSegment extends Segment } else { - cp = lineIntersection(curve.getX1() + n1[0], + cp = lineIntersection(curve.getX1() + n1[0], curve.getY1() + n1[1], curve.getCtrlX() + n1[0], curve.getCtrlY() + n1[1], curve.getCtrlX() + n2[0], curve.getCtrlY() + n2[1], - curve.getX2() + n2[0], + curve.getX2() + n2[0], curve.getY2() + n2[1], true); } - + s = new QuadSegment(curve.getX1() + n1[0], curve.getY1() + n1[1], cp.getX(), cp.getY(), curve.getX2() + n2[0], curve.getY2() + n2[1]); @@ -209,9 +209,9 @@ public class QuadSegment extends Segment return s; } - private Point2D lineIntersection(double X1, double Y1, - double X2, double Y2, - double X3, double Y3, + private Point2D lineIntersection(double X1, double Y1, + double X2, double Y2, + double X3, double Y3, double X4, double Y4, boolean infinite) { @@ -250,11 +250,11 @@ public class QuadSegment extends Segment public double[] cp1() { - return new double[]{cp.getX(), cp.getY()}; + return new double[]{cp.getX(), cp.getY()}; } public double[] cp2() { - return new double[]{cp.getX(), cp.getY()}; + return new double[]{cp.getX(), cp.getY()}; } } diff --git a/gnu/java/awt/java2d/RasterGraphics.java b/gnu/java/awt/java2d/RasterGraphics.java index 04eb55eb8..193ea4c7c 100644 --- a/gnu/java/awt/java2d/RasterGraphics.java +++ b/gnu/java/awt/java2d/RasterGraphics.java @@ -77,10 +77,10 @@ public class RasterGraphics { if (y >= getDeviceBounds().width) return; - + super.renderScanline(y, c); } - + /** * Returns the color model of this Graphics object. * diff --git a/gnu/java/awt/java2d/ScanlineConverter.java b/gnu/java/awt/java2d/ScanlineConverter.java index b00a15c16..2c3481b6c 100644 --- a/gnu/java/awt/java2d/ScanlineConverter.java +++ b/gnu/java/awt/java2d/ScanlineConverter.java @@ -206,7 +206,7 @@ public final class ScanlineConverter // Ok, now we can perform the actual scanlining. int realY = Fixed.intValue(FIXED_DIGITS, y + resolution); boolean push = lastRealY != realY; - + doScanline(p, y, push, haveClip); // Remove obsolete active edges. @@ -299,7 +299,7 @@ public final class ScanlineConverter p.renderScanline(Fixed.intValue(FIXED_DIGITS, y), scanlineCoverage); scanlineCoverage.clear(); } - } + } /** diff --git a/gnu/java/awt/java2d/ScanlineCoverage.java b/gnu/java/awt/java2d/ScanlineCoverage.java index deb603bcb..9ffb63e1d 100644 --- a/gnu/java/awt/java2d/ScanlineCoverage.java +++ b/gnu/java/awt/java2d/ScanlineCoverage.java @@ -199,7 +199,7 @@ public final class ScanlineCoverage /** * Returns the X start position (left) on the scanline. This value * is considered to be in pixels and device space. - * + * * @return the X position on the scanline */ public int getXPos() @@ -445,7 +445,7 @@ public final class ScanlineCoverage * Returns the maximum coverage value for the scanline. * * @return the maximum coverage value for the scanline - */ + */ public int getMaxCoverage() { return maxCoverage; @@ -574,7 +574,7 @@ public final class ScanlineCoverage // Testpoint 6. cov = new Coverage(); } - + cov.xPos = x; cov.covDelta = 0; cov.pixelCoverage = 0; diff --git a/gnu/java/awt/java2d/Segment.java b/gnu/java/awt/java2d/Segment.java index df1f67605..1d9a57001 100644 --- a/gnu/java/awt/java2d/Segment.java +++ b/gnu/java/awt/java2d/Segment.java @@ -45,12 +45,12 @@ public abstract class Segment implements Cloneable // Start and end points of THIS segment public Point2D P1; public Point2D P2; - + // Segments can be linked together internally as a linked list public Segment first; public Segment next; public Segment last; - + // Half the stroke width protected double radius; @@ -116,7 +116,7 @@ public abstract class Segment implements Cloneable { dy = radius * ((dx > 0)?1:-1); dx = 0; - } + } else if( dx == 0 ) { dx = radius * ((dy > 0)?-1:1); @@ -148,7 +148,7 @@ public abstract class Segment implements Cloneable * for a line segment. */ public abstract double[] cp1(); - + /** * Returns the coordinates of the second control point, or the end point * for a line segment. diff --git a/gnu/java/awt/java2d/TexturePaintContext.java b/gnu/java/awt/java2d/TexturePaintContext.java index db0a2e658..2523d2311 100644 --- a/gnu/java/awt/java2d/TexturePaintContext.java +++ b/gnu/java/awt/java2d/TexturePaintContext.java @@ -148,7 +148,7 @@ public class TexturePaintContext * @param h the height * * @return the Raster that is used for painting - * + * */ public Raster getRaster(int x1, int y1, int w, int h) { @@ -175,9 +175,9 @@ public class TexturePaintContext int dy = (int) dest[1]; // The modulo operation gives us the replication effect. - dx = ((dx - minX) % width) + minX; + dx = ((dx - minX) % width) + minX; dy = ((dy - minY) % height) + minY; - + // Handle possible negative values (replicating above the top-left) if (dx < 0) dx += width; diff --git a/gnu/java/awt/peer/ClasspathDesktopPeer.java b/gnu/java/awt/peer/ClasspathDesktopPeer.java index bef42dcea..fd4f498aa 100644 --- a/gnu/java/awt/peer/ClasspathDesktopPeer.java +++ b/gnu/java/awt/peer/ClasspathDesktopPeer.java @@ -51,7 +51,7 @@ import java.util.prefs.Preferences; /** * Offers a common implementation for the Desktop peers, that enables * access to default system application within java processes. - * + * * @author Mario Torre <neugens@limasoftware.net> */ public class ClasspathDesktopPeer @@ -59,39 +59,39 @@ public class ClasspathDesktopPeer { /** This is the fallback browser, if no desktop was detected. */ protected static final String _DEFAULT_BROWSER = "firefox"; - + /** gnu.java.awt.peer.Desktop.html.command */ protected static final String _BROWSE = "html"; - + /** gnu.java.awt.peer.Desktop.mail.command */ protected static final String _MAIL = "mail"; - + /** gnu.java.awt.peer.Desktop.edit.command */ protected static final String _EDIT = "edit"; - + /** gnu.java.awt.peer.Desktop.print.command */ protected static final String _PRINT = "print"; - + /** gnu.java.awt.peer.Desktop.open.command */ protected static final String _OPEN = "open"; - + /** */ protected static final KDEDesktopPeer kde = new KDEDesktopPeer(); - + /** */ protected static final GnomeDesktopPeer gnome = new GnomeDesktopPeer(); - + /** */ protected static final ClasspathDesktopPeer classpath = - new ClasspathDesktopPeer(); - + new ClasspathDesktopPeer(); + /** * Preference subsystem. Packagers and users can override the default * behaviour of this class via preferences and system properties. */ protected Preferences prefs = Preferences.userNodeForPackage(ClasspathDesktopPeer.class).node("Desktop"); - + /** * @param target */ @@ -103,131 +103,131 @@ public class ClasspathDesktopPeer public boolean isSupported(Action action) { String check = null; - + switch(action) { case BROWSE: check = _BROWSE; break; - + case MAIL: check = _MAIL; break; - + case EDIT: check = _EDIT; break; - + case PRINT: check = _PRINT; break; - + case OPEN: default: check = _OPEN; break; } - + return this.supportCommand(check); } public void browse(URI url) throws IOException { checkPermissions(); - + String browser = getCommand(_BROWSE); - + if (browser == null) throw new UnsupportedOperationException(); - + browser = browser + " " + url.toString(); - + Runtime.getRuntime().exec(browser); } public void edit(File file) throws IOException { checkPermissions(file, false); - + String edit = getCommand(_EDIT); - + if (edit == null) throw new UnsupportedOperationException(); - - edit = edit + " " + file.getAbsolutePath(); + + edit = edit + " " + file.getAbsolutePath(); Runtime.getRuntime().exec(edit); } public void mail(URI mailtoURL) throws IOException { checkPermissions(); - + String scheme = mailtoURL.getScheme(); if (scheme == null || !scheme.equalsIgnoreCase("mailto")) throw new IllegalArgumentException("URI Scheme not of type mailto"); - + String mail = getCommand(_MAIL); - + if (mail == null) throw new UnsupportedOperationException(); - + mail = mail + " " + mailtoURL.toString(); - + Runtime.getRuntime().exec(mail); } public void mail() throws IOException { checkPermissions(); - + String mail = getCommand(_MAIL); - + if (mail == null) throw new UnsupportedOperationException(); - + Runtime.getRuntime().exec(mail); } - + public void open(File file) throws IOException { checkPermissions(file, true); - + String open = getCommand(_OPEN); - + if (open == null) throw new UnsupportedOperationException(); - - open = open + " " + file.getAbsolutePath(); + + open = open + " " + file.getAbsolutePath(); Runtime.getRuntime().exec(open); } public void print(File file) throws IOException { checkPrintPermissions(file); - + String print = getCommand(_PRINT); - + if (print == null) throw new UnsupportedOperationException(); - - print = print + " " + file.getAbsolutePath(); + + print = print + " " + file.getAbsolutePath(); Runtime.getRuntime().exec(print); } - + protected String getCommand(String action) { // check if a system property exist String command = System.getProperty("gnu.java.awt.peer.Desktop." + action + ".command"); - + // otherwise, get it from preferences, if any if (command == null) { command = prefs.node(action).get("command", null); } - + return command; } - + /** * Note: Checks for AWTPermission("showWindowWithoutWarningBanner") only. */ @@ -238,22 +238,22 @@ public class ClasspathDesktopPeer sm.checkPermission(new AWTPermission("showWindowWithoutWarningBanner")); } } - + /** - * Calls checkPermissions() and checks for SecurityManager.checkRead() - * and, if readOnly is false, for SecurityManager.checkWrite() + * Calls checkPermissions() and checks for SecurityManager.checkRead() + * and, if readOnly is false, for SecurityManager.checkWrite() */ protected void checkPermissions(File file, boolean readOnly) { checkPermissions(); - + SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkRead(file.toString()); if (!readOnly) sm.checkWrite(file.toString()); } } - + /** * Calls checkPermissions(file, true) and checks for * SecurityManager.checkPrintJobAccess() @@ -261,13 +261,13 @@ public class ClasspathDesktopPeer protected void checkPrintPermissions(File file) { checkPermissions(file, true); - + SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPrintJobAccess(); - } + } } - + /** * @param check * @return @@ -276,7 +276,7 @@ public class ClasspathDesktopPeer { return ((this.getCommand(check) != null) ? true : false); } - + /** * @return */ @@ -285,7 +285,7 @@ public class ClasspathDesktopPeer // check if we are under Gnome or KDE or anything else String desktopSession = System.getenv("GNOME_DESKTOP_SESSION_ID"); if (desktopSession == null) - { + { desktopSession = System.getenv("KDE_FULL_SESSION"); if (desktopSession != null) return kde; @@ -294,7 +294,7 @@ public class ClasspathDesktopPeer { return gnome; } - + // revert to this class for default values return classpath; } diff --git a/gnu/java/awt/peer/ClasspathFontPeer.java b/gnu/java/awt/peer/ClasspathFontPeer.java index e43e5f284..96677a4af 100644 --- a/gnu/java/awt/peer/ClasspathFontPeer.java +++ b/gnu/java/awt/peer/ClasspathFontPeer.java @@ -68,7 +68,7 @@ import java.util.Map; * object in the default implementation. If you wish to share peers between * fonts, you will need to subclass both ClasspathFontPeer and * {@link ClasspathToolKit}.</p> - * + * * <p><b>Thread Safety:</b> Methods of this interface may be called * from arbitrary threads at any time. Implementations of the * <code>ClasspathFontPeer</code> interface are required to perform @@ -85,11 +85,11 @@ public abstract class ClasspathFontPeer { /*************************************************************************/ - + /* * Instance Variables */ - + /** * The 3 names of this font. all fonts have 3 names, some of which * may be equal: @@ -98,19 +98,19 @@ public abstract class ClasspathFontPeer * family -- a designer or brand name (Helvetica) * face -- specific instance of a design (Helvetica Regular) * - * @see isLogicalFontName + * @see isLogicalFontName */ - + protected String logicalName; protected String familyName; protected String faceName; - + /** * The font style, which is a combination (by OR-ing) of the font style * constants PLAIN, BOLD and ITALIC, in this class. */ protected int style; - + /** * The font point size. A point is 1/72 of an inch. */ @@ -143,13 +143,13 @@ public abstract class ClasspathFontPeer return (ClasspathToolkit)(Toolkit.getDefaultToolkit ()); } - /* + /* * Confusingly, a Logical Font is a concept unrelated to - * a Font's Logical Name. + * a Font's Logical Name. * * A Logical Font is one of 6 built-in, abstract font types * which must be supported by any java environment: SansSerif, - * Serif, Monospaced, Dialog, and DialogInput. + * Serif, Monospaced, Dialog, and DialogInput. * * A Font's Logical Name is the name the font was constructed * from. This might be the name of a Logical Font, or it might @@ -209,32 +209,32 @@ public abstract class ClasspathFontPeer if (fam != null) attrs.put (TextAttribute.FAMILY, fam); } - + public static void copySizeToAttrs (float size, Map attrs) { attrs.put (TextAttribute.SIZE, new Float (size)); } - + protected static void copyTransformToAttrs (AffineTransform trans, Map attrs) { if (trans != null) { - TransformAttribute ta; + TransformAttribute ta; synchronized(transCache) { - ta = transCache.get(trans); - if (ta == null) - { - ta = new TransformAttribute(trans); - transCache.put(trans, ta); - } - } - attrs.put(TextAttribute.TRANSFORM, ta); + ta = transCache.get(trans); + if (ta == null) + { + ta = new TransformAttribute(trans); + transCache.put(trans, ta); + } + } + attrs.put(TextAttribute.TRANSFORM, ta); } } - protected void setStandardAttributes (String name, String family, int style, + protected void setStandardAttributes (String name, String family, int style, float size, AffineTransform trans) { this.logicalName = name; @@ -248,7 +248,7 @@ public abstract class ClasspathFontPeer this.familyName = family; else this.familyName = faceNameToFamilyName (faceName); - + this.style = style; this.size = size; this.transform = trans; @@ -296,16 +296,16 @@ public abstract class ClasspathFontPeer if (attribs.containsKey (TextAttribute.TRANSFORM)) { - TransformAttribute ta = (TransformAttribute) + TransformAttribute ta = (TransformAttribute) attribs.get(TextAttribute.TRANSFORM); - trans = ta.getTransform (); + trans = ta.getTransform (); } setStandardAttributes (name, family, style, size, trans); } protected void getStandardAttributes (Map attrs) - { + { copyFamilyToAttrs (this.familyName, attrs); copySizeToAttrs (this.size, attrs); copyStyleToAttrs (this.style, attrs); @@ -322,11 +322,11 @@ public abstract class ClasspathFontPeer public ClasspathFontPeer (String name, int style, int size) { - setStandardAttributes (name, (String)null, style, + setStandardAttributes (name, (String)null, style, (float)size, (AffineTransform)null); } - /** + /** * Implementation of {@link Font#getName} * * @param font the font this peer is being called from. This may be @@ -334,12 +334,12 @@ public abstract class ClasspathFontPeer * be ignored. */ - public String getName (Font font) - { - return logicalName; + public String getName (Font font) + { + return logicalName; } - /** + /** * Implementation of {@link Font#getFamily()} * * @param font the font this peer is being called from. This may be @@ -347,12 +347,12 @@ public abstract class ClasspathFontPeer * be ignored. */ - public String getFamily (Font font) - { - return familyName; + public String getFamily (Font font) + { + return familyName; } - /** + /** * Implementation of {@link Font#getFamily(Locale)} * * @param font the font this peer is being called from. This may be @@ -360,12 +360,12 @@ public abstract class ClasspathFontPeer * be ignored. */ - public String getFamily (Font font, Locale lc) - { - return familyName; + public String getFamily (Font font, Locale lc) + { + return familyName; } - /** + /** * Implementation of {@link Font#getFontName()} * * @param font the font this peer is being called from. This may be @@ -373,12 +373,12 @@ public abstract class ClasspathFontPeer * be ignored. */ - public String getFontName (Font font) - { - return faceName; + public String getFontName (Font font) + { + return faceName; } - /** + /** * Implementation of {@link Font#getFontName(Locale)} * * @param font the font this peer is being called from. This may be @@ -386,12 +386,12 @@ public abstract class ClasspathFontPeer * be ignored. */ - public String getFontName (Font font, Locale lc) - { - return faceName; + public String getFontName (Font font, Locale lc) + { + return faceName; } - /** + /** * Implementation of {@link Font#getSize} * * @param font the font this peer is being called from. This may be @@ -399,38 +399,38 @@ public abstract class ClasspathFontPeer * be ignored. */ - public float getSize (Font font) - { - return size; + public float getSize (Font font) + { + return size; } - /** + /** * Implementation of {@link Font#isPlain} * * @param font the font this peer is being called from. This may be * useful if you are sharing peers between Font objects. Otherwise it may * be ignored. */ - - public boolean isPlain (Font font) - { - return style == Font.PLAIN; + + public boolean isPlain (Font font) + { + return style == Font.PLAIN; } - /** + /** * Implementation of {@link Font#isBold} * * @param font the font this peer is being called from. This may be * useful if you are sharing peers between Font objects. Otherwise it may * be ignored. */ - - public boolean isBold (Font font) - { - return ((style & Font.BOLD) == Font.BOLD); + + public boolean isBold (Font font) + { + return ((style & Font.BOLD) == Font.BOLD); } - /** + /** * Implementation of {@link Font#isItalic} * * @param font the font this peer is being called from. This may be @@ -438,12 +438,12 @@ public abstract class ClasspathFontPeer * be ignored. */ - public boolean isItalic (Font font) - { - return ((style & Font.ITALIC) == Font.ITALIC); + public boolean isItalic (Font font) + { + return ((style & Font.ITALIC) == Font.ITALIC); } - /** + /** * Implementation of {@link Font#deriveFont(int, float)} * * @param font the font this peer is being called from. This may be @@ -460,7 +460,7 @@ public abstract class ClasspathFontPeer return tk().getFont (logicalName, attrs); } - /** + /** * Implementation of {@link Font#deriveFont(float)} * * @param font the font this peer is being called from. This may be @@ -476,7 +476,7 @@ public abstract class ClasspathFontPeer return tk().getFont (logicalName, attrs); } - /** + /** * Implementation of {@link Font#deriveFont(int)} * * @param font the font this peer is being called from. This may be @@ -492,7 +492,7 @@ public abstract class ClasspathFontPeer return tk().getFont (logicalName, attrs); } - /** + /** * Implementation of {@link Font#deriveFont(int, AffineTransform)} * * @param font the font this peer is being called from. This may be @@ -509,7 +509,7 @@ public abstract class ClasspathFontPeer return tk().getFont (logicalName, attrs); } - /** + /** * Implementation of {@link Font#deriveFont(AffineTransform)} * * @param font the font this peer is being called from. This may be @@ -525,7 +525,7 @@ public abstract class ClasspathFontPeer return tk().getFont (logicalName, attrs); } - /** + /** * Implementation of {@link Font#deriveFont(Map)} * * @param font the font this peer is being called from. This may be @@ -538,7 +538,7 @@ public abstract class ClasspathFontPeer return tk().getFont (logicalName, attrs); } - /** + /** * Implementation of {@link Font#getAttributes()} * * @param font the font this peer is being called from. This may be @@ -553,7 +553,7 @@ public abstract class ClasspathFontPeer return h; } - /** + /** * Implementation of {@link Font#getAvailableAttributes()} * * @param font the font this peer is being called from. This may be @@ -563,7 +563,7 @@ public abstract class ClasspathFontPeer public AttributedCharacterIterator.Attribute[] getAvailableAttributes(Font font) { - AttributedCharacterIterator.Attribute a[] = + AttributedCharacterIterator.Attribute a[] = new AttributedCharacterIterator.Attribute[5]; a[0] = TextAttribute.FAMILY; a[1] = TextAttribute.SIZE; @@ -573,7 +573,7 @@ public abstract class ClasspathFontPeer return a; } - /** + /** * Implementation of {@link Font#getTransform()} * * @param font the font this peer is being called from. This may be @@ -588,7 +588,7 @@ public abstract class ClasspathFontPeer return transform; } - /** + /** * Implementation of {@link Font#isTransformed()} * * @param font the font this peer is being called from. This may be @@ -601,7 +601,7 @@ public abstract class ClasspathFontPeer return ! transform.isIdentity (); } - /** + /** * Implementation of {@link Font#getItalicAngle()} * * @param font the font this peer is being called from. This may be @@ -618,7 +618,7 @@ public abstract class ClasspathFontPeer } - /** + /** * Implementation of {@link Font#getStyle()} * * @param font the font this peer is being called from. This may be @@ -626,9 +626,9 @@ public abstract class ClasspathFontPeer * be ignored. */ - public int getStyle (Font font) - { - return style; + public int getStyle (Font font) + { + return style; } @@ -636,7 +636,7 @@ public abstract class ClasspathFontPeer /* Remaining methods are abstract */ - /** + /** * Implementation of {@link Font#canDisplay(char)} * * @param font the font this peer is being called from. This may be @@ -646,7 +646,7 @@ public abstract class ClasspathFontPeer public abstract boolean canDisplay (Font font, int c); - /** + /** * Implementation of {@link Font#canDisplay(String)}, * {@link Font#canDisplay(char [], int, int)}, and * {@link Font#canDisplay(CharacterIterator, int, int)}. @@ -678,9 +678,9 @@ public abstract class ClasspathFontPeer */ public abstract String getSubFamilyName (Font font, Locale locale); - - /** + + /** * Implementation of {@link Font#getPSName()} * * @param font the font this peer is being called from. This may be @@ -691,7 +691,7 @@ public abstract class ClasspathFontPeer public abstract String getPostScriptName (Font font); - /** + /** * Implementation of {@link Font#getNumGlyphs()} * * @param font the font this peer is being called from. This may be @@ -702,7 +702,7 @@ public abstract class ClasspathFontPeer public abstract int getNumGlyphs (Font font); - /** + /** * Implementation of {@link Font#getMissingGlyphCode()} * * @param font the font this peer is being called from. This may be @@ -713,7 +713,7 @@ public abstract class ClasspathFontPeer public abstract int getMissingGlyphCode (Font font); - /** + /** * Implementation of {@link Font#getBaselineFor(char)} * * @param font the font this peer is being called from. This may be @@ -767,7 +767,7 @@ public abstract class ClasspathFontPeer public abstract String getGlyphName (Font font, int glyphIndex); - /** + /** * Implementation of {@link * Font#createGlyphVector(FontRenderContext, String)}, {@link * Font#createGlyphVector(FontRenderContext, char[])}, and {@link @@ -782,9 +782,9 @@ public abstract class ClasspathFontPeer public abstract GlyphVector createGlyphVector (Font font, FontRenderContext frc, CharacterIterator ci); - - /** + + /** * Implementation of {@link Font#createGlyphVector(FontRenderContext, * int[])}. * @@ -794,12 +794,12 @@ public abstract class ClasspathFontPeer * not with font peers. */ - public abstract GlyphVector createGlyphVector (Font font, - FontRenderContext ctx, + public abstract GlyphVector createGlyphVector (Font font, + FontRenderContext ctx, int[] glyphCodes); - /** + /** * Implementation of {@link Font#layoutGlyphVector(FontRenderContext, * char[], int, int, int)}. * @@ -809,13 +809,13 @@ public abstract class ClasspathFontPeer * not with font peers. */ - public abstract GlyphVector layoutGlyphVector (Font font, - FontRenderContext frc, - char[] chars, int start, + public abstract GlyphVector layoutGlyphVector (Font font, + FontRenderContext frc, + char[] chars, int start, int limit, int flags); - /** + /** * Implementation of {@link Font#getFontMetrics()} * * @param font the font this peer is being called from. This may be @@ -826,7 +826,7 @@ public abstract class ClasspathFontPeer public abstract FontMetrics getFontMetrics (Font font); - /** + /** * Implementation of {@link Font#hasUniformLineMetrics()} * * @param font the font this peer is being called from. This may be @@ -837,7 +837,7 @@ public abstract class ClasspathFontPeer public abstract boolean hasUniformLineMetrics (Font font); - /** + /** * Implementation of {@link Font#getLineMetrics(CharacterIterator, int, * int, FontRenderContext)} * @@ -846,12 +846,12 @@ public abstract class ClasspathFontPeer * be ignored. */ - public abstract LineMetrics getLineMetrics (Font font, - CharacterIterator ci, - int begin, int limit, + public abstract LineMetrics getLineMetrics (Font font, + CharacterIterator ci, + int begin, int limit, FontRenderContext rc); - /** + /** * Implementation of {@link Font#getMaxCharBounds(FontRenderContext)} * * @param font the font this peer is being called from. This may be @@ -859,7 +859,7 @@ public abstract class ClasspathFontPeer * be ignored. */ - public abstract Rectangle2D getMaxCharBounds (Font font, + public abstract Rectangle2D getMaxCharBounds (Font font, FontRenderContext rc); } diff --git a/gnu/java/awt/peer/GLightweightPeer.java b/gnu/java/awt/peer/GLightweightPeer.java index bf40bf379..fe128c26c 100644 --- a/gnu/java/awt/peer/GLightweightPeer.java +++ b/gnu/java/awt/peer/GLightweightPeer.java @@ -71,7 +71,7 @@ import java.awt.peer.LightweightPeer; * Lightweight components are painted directly onto their parent * containers through an Image object provided by the toolkit. */ -public class GLightweightPeer +public class GLightweightPeer implements LightweightPeer, ContainerPeer { public GLightweightPeer() @@ -80,39 +80,39 @@ public class GLightweightPeer } // -------- java.awt.peer.ContainerPeer implementation: - + public Insets insets() { // Nothing to do here for lightweights. return null; } - + public Insets getInsets() { // Nothing to do here for lightweights. return null; } - + public void beginValidate() { // Nothing to do here for lightweights. } - + public void endValidate() { // Nothing to do here for lightweights. } - + public void beginLayout() { // Nothing to do here for lightweights. } - + public void endLayout() { // Nothing to do here for lightweights. } - + public boolean isPaintPending() { // Nothing to do here for lightweights. @@ -235,7 +235,7 @@ public class GLightweightPeer // Nothing to do here for lightweights. } - public boolean isFocusable() + public boolean isFocusable() { // Nothing to do here for lightweights. return false; @@ -263,7 +263,7 @@ public class GLightweightPeer } public boolean prepareImage(Image img, int width, int height, - ImageObserver o) + ImageObserver o) { // Nothing to do here for lightweights. return false; @@ -373,10 +373,10 @@ public class GLightweightPeer // Nothing to do here for lightweights. } - public VolatileImage createVolatileImage(int width, int height) - { + public VolatileImage createVolatileImage(int width, int height) + { // Nothing to do here for lightweights. - return null; + return null; } public boolean handlesWheelScrolling() @@ -385,7 +385,7 @@ public class GLightweightPeer return false; } - public void createBuffers(int x, BufferCapabilities capabilities) + public void createBuffers(int x, BufferCapabilities capabilities) throws AWTException { // Nothing to do here for lightweights. diff --git a/gnu/java/awt/peer/GnomeDesktopPeer.java b/gnu/java/awt/peer/GnomeDesktopPeer.java index cc41f749d..2347371ad 100644 --- a/gnu/java/awt/peer/GnomeDesktopPeer.java +++ b/gnu/java/awt/peer/GnomeDesktopPeer.java @@ -60,13 +60,13 @@ public class GnomeDesktopPeer { // check if a command already exists String command = super.getCommand(action); - + if (command == null) { try { if (action == _BROWSE) - { + { command = execQuery(BROWSER_QUERY_GNOME); } else if (action == _PRINT) @@ -83,46 +83,46 @@ public class GnomeDesktopPeer command = null; } } - + return command; } - + public void browse(URI url) throws IOException { checkPermissions(); - + String browser = getCommand(_BROWSE); - + if (browser == null) throw new UnsupportedOperationException(); - + browser = browser + " " + url.toString(); - + Runtime.getRuntime().exec(browser); } protected boolean supportCommand(String check) { if (check == _PRINT) - { + { return super.supportCommand(check); } - + return true; } public void mail() throws IOException { checkPermissions(); - + String mail = getCommand(_MAIL); - + if (mail == null) throw new UnsupportedOperationException(); - + Runtime.getRuntime().exec(mail + " mailto:"); } - + protected String execQuery(String command) throws IOException { InputStream in = null; @@ -149,7 +149,7 @@ public class GnomeDesktopPeer // remove %s from the string, leave only the command line int index = output.indexOf("%s"); output.delete(index, index + 1); - + return output.toString().trim(); } } diff --git a/gnu/java/awt/peer/KDEDesktopPeer.java b/gnu/java/awt/peer/KDEDesktopPeer.java index 8bc3e65b2..44a508435 100644 --- a/gnu/java/awt/peer/KDEDesktopPeer.java +++ b/gnu/java/awt/peer/KDEDesktopPeer.java @@ -56,16 +56,16 @@ public class KDEDesktopPeer "gconftool-2 -g /desktop/gnome/url-handlers/http/command"; protected String getCommand(String action) - { + { // check if a command already exists String command = super.getCommand(action); - + if (command == null) { try { if (action == _MAIL) - { + { command = "kfmclient exec"; } else if (action == _PRINT) @@ -82,27 +82,27 @@ public class KDEDesktopPeer command = null; } } - + return command; } - + protected boolean supportCommand(String check) { return true; } - + public void mail() throws IOException { checkPermissions(); - + String mail = getCommand(_MAIL); - + if (mail == null) throw new UnsupportedOperationException(); - + Runtime.getRuntime().exec(mail + " 'mailto: '"); } - + protected String execQuery(String command) throws IOException { InputStream in = null; @@ -129,7 +129,7 @@ public class KDEDesktopPeer // remove %s from the string, leave only the command line int index = output.indexOf("%s"); output.delete(index, index + 1); - + return output.toString().trim(); } } diff --git a/gnu/java/awt/peer/gtk/AsyncImage.java b/gnu/java/awt/peer/gtk/AsyncImage.java index dad537aa7..786dcf26b 100644 --- a/gnu/java/awt/peer/gtk/AsyncImage.java +++ b/gnu/java/awt/peer/gtk/AsyncImage.java @@ -98,7 +98,7 @@ public class AsyncImage ic.imageComplete(ImageConsumer.SINGLEFRAMEDONE); } } - + } /** diff --git a/gnu/java/awt/peer/gtk/BufferedImageGraphics.java b/gnu/java/awt/peer/gtk/BufferedImageGraphics.java index 31c5e641e..f9609bff6 100644 --- a/gnu/java/awt/peer/gtk/BufferedImageGraphics.java +++ b/gnu/java/awt/peer/gtk/BufferedImageGraphics.java @@ -64,7 +64,7 @@ import java.util.WeakHashMap; /** * Implementation of Graphics2D on a Cairo surface. * - * Simutanously maintains a CairoSurface and updates the + * Simutanously maintains a CairoSurface and updates the * BufferedImage from that after each drawing operation. */ public class BufferedImageGraphics extends CairoGraphics2D @@ -73,7 +73,7 @@ public class BufferedImageGraphics extends CairoGraphics2D * the buffered Image. */ private BufferedImage image, buffer; - + /** * Image size. */ @@ -104,7 +104,7 @@ public class BufferedImageGraphics extends CairoGraphics2D this.image = bi; imageWidth = bi.getWidth(); imageHeight = bi.getHeight(); - + if (!(image.getSampleModel() instanceof SinglePixelPackedSampleModel)) hasFastCM = false; else if(bi.getColorModel().equals(CairoSurface.cairoCM_opaque)) @@ -151,11 +151,11 @@ public class BufferedImageGraphics extends CairoGraphics2D { int[] pixels2 = new int[imageWidth * imageHeight]; int scanline = sm.getScanlineStride(); - + for (int i = 0; i < imageHeight; i++) System.arraycopy(pixels, (i - minY) * scanline - minX, pixels2, i * imageWidth, imageWidth); - + pixels = pixels2; } @@ -172,11 +172,11 @@ public class BufferedImageGraphics extends CairoGraphics2D System.arraycopy(pixels, 0, surface.getData(), 0, pixels.length); } - + setup( cairo_t ); setClip(0, 0, imageWidth, imageHeight); } - + BufferedImageGraphics(BufferedImageGraphics copyFrom) { image = copyFrom.image; @@ -184,7 +184,7 @@ public class BufferedImageGraphics extends CairoGraphics2D cairo_t = surface.newCairoContext(); imageWidth = copyFrom.imageWidth; imageHeight = copyFrom.imageHeight; - + hasFastCM = copyFrom.hasFastCM; hasAlpha = copyFrom.hasAlpha; @@ -195,7 +195,7 @@ public class BufferedImageGraphics extends CairoGraphics2D * Update a rectangle of the bufferedImage. This can be improved upon a lot. */ private void updateBufferedImage(int x, int y, int width, int height) - { + { Rectangle bounds = new Rectangle(x, y, width, height); bounds = getTransformedBounds(bounds, transform).getBounds(); x = bounds.x; @@ -207,7 +207,7 @@ public class BufferedImageGraphics extends CairoGraphics2D if( x > imageWidth || y > imageHeight ) return; - + // Deal with negative width/height. if (height < 0) { @@ -219,44 +219,44 @@ public class BufferedImageGraphics extends CairoGraphics2D x += width; width = -width; } - + // Clip edges. if( x < 0 ) x = 0; if( y < 0 ) y = 0; - - if( x + width > imageWidth ) + + if( x + width > imageWidth ) width = imageWidth - x; - if( y + height > imageHeight ) + if( y + height > imageHeight ) height = imageHeight - y; - + if(!hasFastCM) { - image.setRGB(x, y, width, height, pixels, + image.setRGB(x, y, width, height, pixels, x + y * imageWidth, imageWidth); // The setRGB method assumes (or should assume) that pixels are NOT // alpha-premultiplied, but Cairo stores data with premultiplication // (thus the pixels returned in getPixels are premultiplied). // This is ignored for consistency, however, since in // CairoGrahpics2D.drawImage we also use non-premultiplied data - + } else { int[] db = ((DataBufferInt)image.getRaster().getDataBuffer()). getData(); - + // This should not fail, as we check the image sample model when we // set the hasFastCM flag SinglePixelPackedSampleModel sm = (SinglePixelPackedSampleModel)image.getSampleModel() ; - + int minX = image.getRaster().getSampleModelTranslateX(); int minY = image.getRaster().getSampleModelTranslateY(); - - if (sm.getScanlineStride() == imageWidth && minX == 0) + + if (sm.getScanlineStride() == imageWidth && minX == 0) { - System.arraycopy(pixels, y * imageWidth, + System.arraycopy(pixels, y * imageWidth, db, (y - minY) * imageWidth, height * imageWidth); } @@ -266,19 +266,19 @@ public class BufferedImageGraphics extends CairoGraphics2D for (int i = y; i < (height + y); i++) System.arraycopy(pixels, i * imageWidth + x, db, (i - minY) * scanline + x - minX, width); - + } } } /** * Abstract methods. - */ + */ public Graphics create() { return new BufferedImageGraphics(this); } - + public GraphicsConfiguration getDeviceConfiguration() { return null; @@ -288,7 +288,7 @@ public class BufferedImageGraphics extends CairoGraphics2D { return new Rectangle2D.Double(0.0, 0.0, imageWidth, imageHeight); } - + public void copyAreaImpl(int x, int y, int width, int height, int dx, int dy) { surface.copyAreaNative(x, y, width, height, dx, dy, surface.width); @@ -296,7 +296,7 @@ public class BufferedImageGraphics extends CairoGraphics2D } /** - * Overloaded methods that do actual drawing need to enter the gdk threads + * Overloaded methods that do actual drawing need to enter the gdk threads * and also do certain things before and after. */ public void draw(Shape s) @@ -308,7 +308,7 @@ public class BufferedImageGraphics extends CairoGraphics2D r.width++; r.height++; } - + // Do the drawing if (comp == null || comp instanceof AlphaComposite) { @@ -318,13 +318,13 @@ public class BufferedImageGraphics extends CairoGraphics2D else { createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setStroke(this.getStroke()); g2d.setColor(this.getColor()); g2d.setTransform(transform); g2d.draw(s); - + drawComposite(r.getBounds2D(), null); } } @@ -340,13 +340,13 @@ public class BufferedImageGraphics extends CairoGraphics2D else { createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setPaint(this.getPaint()); g2d.setColor(this.getColor()); g2d.setTransform(transform); g2d.fill(s); - + drawComposite(s.getBounds2D(), null); } } @@ -366,14 +366,14 @@ public class BufferedImageGraphics extends CairoGraphics2D g2d.setRenderingHints(this.getRenderingHints()); g2d.setTransform(transform); g2d.drawRenderedImage(image, xform); - + drawComposite(buffer.getRaster().getBounds(), null); } } protected boolean drawImage(Image img, AffineTransform xform, - Color bgcolor, ImageObserver obs) + Color bgcolor, ImageObserver obs) { if (comp == null || comp instanceof AlphaComposite) { @@ -392,16 +392,16 @@ public class BufferedImageGraphics extends CairoGraphics2D img = Toolkit.getDefaultToolkit().createImage(source); } BufferedImage bImg = (BufferedImage) img; - + // Find translated bounds Rectangle2D bounds = new Rectangle(bImg.getMinX(), bImg.getMinY(), bImg.getWidth(), bImg.getHeight()); if (xform != null) bounds = getTransformedBounds(bounds, xform); - + // Create buffer and draw image createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setRenderingHints(this.getRenderingHints()); g2d.drawImage(img, xform, obs); @@ -413,20 +413,20 @@ public class BufferedImageGraphics extends CairoGraphics2D public void drawGlyphVector(GlyphVector gv, float x, float y) { - // Find absolute bounds, in user-space, of this glyph vector + // Find absolute bounds, in user-space, of this glyph vector Rectangle2D bounds = gv.getLogicalBounds(); bounds = new Rectangle2D.Double(x + bounds.getX(), y + bounds.getY(), bounds.getWidth(), bounds.getHeight()); - + // Perform draw operation if (comp == null || comp instanceof AlphaComposite) { super.drawGlyphVector(gv, x, y); - + // this returns an integer-based Rectangle (rather than a // Rectangle2D), which takes care of any necessary rounding for us. bounds = bounds.getBounds(); - + updateBufferedImage((int)bounds.getX(), (int)bounds.getY(), (int)bounds.getWidth(), (int)bounds.getHeight()); } @@ -439,17 +439,17 @@ public class BufferedImageGraphics extends CairoGraphics2D g2d.setStroke(this.getStroke()); g2d.setTransform(transform); g2d.drawGlyphVector(gv, x, y); - + drawComposite(bounds, null); } } - + /** * Perform composite drawing from the buffer onto the main image. - * + * * The image to be composited should already be drawn into the buffer, in the * proper place, after all necessary transforms have been applied. - * + * * @param bounds The bounds to draw, in user-space. * @param observer The image observer, if any (may be null). * @return True on success, false on failure. @@ -465,7 +465,7 @@ public class BufferedImageGraphics extends CairoGraphics2D devClip = new Rectangle(buffer.getMinX(), buffer.getMinY(), buffer.getWidth(), buffer.getHeight()); Rectangle2D.intersect(bounds, devClip, bounds); - + // Round bounds as needed, but be careful in our rounding // (otherwise it may leave unpainted stripes) double x = bounds.getX(); @@ -475,7 +475,7 @@ public class BufferedImageGraphics extends CairoGraphics2D x = Math.round(x); y = Math.round(y); bounds.setRect(x, y, Math.round(maxX - x), Math.round(maxY - y)); - + // Find subimage of internal buffer for updating BufferedImage buffer2 = buffer; if (!bounds.equals(buffer2.getRaster().getBounds())) @@ -492,12 +492,12 @@ public class BufferedImageGraphics extends CairoGraphics2D // Perform actual composite operation compCtx.compose(buffer2.getRaster(), current.getRaster(), current.getRaster()); - + // Set cairo's composite to direct SRC, since we've already done our own - // compositing + // compositing Composite oldcomp = comp; setComposite(AlphaComposite.Src); - + // This MUST call directly into the "action" method in CairoGraphics2D, // not one of the wrappers, to ensure that the composite isn't processed // more than once! @@ -509,7 +509,7 @@ public class BufferedImageGraphics extends CairoGraphics2D updateColor(); return rv; } - + private void createBuffer() { if (buffer == null) @@ -520,20 +520,19 @@ public class BufferedImageGraphics extends CairoGraphics2D else { Graphics2D g2d = ((Graphics2D)buffer.getGraphics()); - + g2d.setBackground(new Color(0,0,0,0)); g2d.clearRect(0, 0, buffer.getWidth(), buffer.getHeight()); } } - + protected ColorModel getNativeCM() { return image.getColorModel(); } - + protected ColorModel getBufferCM() { return ColorModel.getRGBdefault(); } } - diff --git a/gnu/java/awt/peer/gtk/CairoGraphics2D.java b/gnu/java/awt/peer/gtk/CairoGraphics2D.java index d1ad2d38c..3507e5b14 100644 --- a/gnu/java/awt/peer/gtk/CairoGraphics2D.java +++ b/gnu/java/awt/peer/gtk/CairoGraphics2D.java @@ -101,7 +101,7 @@ import java.util.HashMap; import java.util.Map; /** - * This is an abstract implementation of Graphics2D on Cairo. + * This is an abstract implementation of Graphics2D on Cairo. * * It should be subclassed for different Cairo contexts. * @@ -112,7 +112,7 @@ import java.util.Map; * GraphicsConfiguration getDeviceConfiguration() * copyArea(int x, int y, int width, int height, int dx, int dy) * - * Also, dispose() must be overloaded to free any native datastructures + * Also, dispose() must be overloaded to free any native datastructures * used by subclass and in addition call super.dispose() to free the * native cairographics2d structure and cairo_t. * @@ -120,7 +120,7 @@ import java.util.Map; */ public abstract class CairoGraphics2D extends Graphics2D { - static + static { if (Configuration.INIT_LOAD_LIBRARY) { @@ -177,7 +177,7 @@ public abstract class CairoGraphics2D extends Graphics2D * Rendering hint map. */ private RenderingHints hints; - + /** * Status of the anti-alias flag in cairo. */ @@ -187,7 +187,7 @@ public abstract class CairoGraphics2D extends Graphics2D /** * Some operations (drawing rather than filling) require that their * coords be shifted to land on 0.5-pixel boundaries, in order to land on - * "middle of pixel" coordinates and light up complete pixels. + * "middle of pixel" coordinates and light up complete pixels. */ protected boolean shiftDrawCalls = false; @@ -203,8 +203,8 @@ public abstract class CairoGraphics2D extends Graphics2D private static BasicStroke draw3DRectStroke = new BasicStroke(); static ColorModel rgb32 = new DirectColorModel(32, 0xFF0000, 0xFF00, 0xFF); - static ColorModel argb32 = new DirectColorModel(32, 0xFF0000, 0xFF00, 0xFF, - 0xFF000000); + static ColorModel argb32 = new DirectColorModel(32, 0xFF0000, 0xFF00, 0xFF, + 0xFF000000); /** * Native constants for interpolation methods. @@ -217,7 +217,7 @@ public abstract class CairoGraphics2D extends Graphics2D ALPHA_INTERPOLATION_QUALITY = 3, ALPHA_INTERPOLATION_DEFAULT = 4; // TODO: Does ALPHA_INTERPOLATION really correspond to CAIRO_FILTER_FAST/BEST/GOOD? - + /** * Constructor does nothing. */ @@ -230,7 +230,7 @@ public abstract class CairoGraphics2D extends Graphics2D * @param cairo_t_pointer a native pointer to a cairo_t of the context. */ public void setup(long cairo_t_pointer) - { + { nativePointer = init(cairo_t_pointer); setRenderingHints(new RenderingHints(getDefaultHints())); setFont(new Font("SansSerif", Font.PLAIN, 12)); @@ -251,7 +251,7 @@ public abstract class CairoGraphics2D extends Graphics2D paint = g.paint; stroke = g.stroke; setRenderingHints(g.hints); - + Color foreground; if (g.fg.getAlpha() != -1) @@ -286,7 +286,7 @@ public abstract class CairoGraphics2D extends Graphics2D setTransformImpl(transform); setClip(clip); setComposite(comp); - + antialias = !g.antialias; setAntialias(g.antialias); } @@ -300,9 +300,9 @@ public abstract class CairoGraphics2D extends Graphics2D } /** - * Disposes the native cairographics2d structure, including the - * cairo_t and any gradient stuff, if allocated. - * Subclasses should of course overload and call this if + * Disposes the native cairographics2d structure, including the + * cairo_t and any gradient stuff, if allocated. + * Subclasses should of course overload and call this if * they have additional native structures. */ public void dispose() @@ -332,7 +332,7 @@ public abstract class CairoGraphics2D extends Graphics2D /** * Find the bounds of this graphics context, in device space. - * + * * @return the bounds in device-space */ protected abstract Rectangle2D getRealBounds(); @@ -359,7 +359,7 @@ public abstract class CairoGraphics2D extends Graphics2D double x2, double y2, int r1, int g1, int b1, int a1, int r2, int g2, int b2, int a2, boolean cyclic); - + protected native void setPaintPixels(long pointer, int[] pixels, int w, int h, int stride, boolean repeat, int x, int y); @@ -368,7 +368,7 @@ public abstract class CairoGraphics2D extends Graphics2D * Set the current transform matrix */ protected native void cairoSetMatrix(long pointer, double[] m); - + /** * Scaling method */ @@ -406,8 +406,8 @@ public abstract class CairoGraphics2D extends Graphics2D /* * Draws a Glyph Vector */ - protected native void cairoDrawGlyphVector(long pointer, GdkFontPeer font, - float x, float y, int n, + protected native void cairoDrawGlyphVector(long pointer, GdkFontPeer font, + float x, float y, int n, int[] codes, float[] positions, long[] fontset); /** @@ -420,7 +420,7 @@ public abstract class CairoGraphics2D extends Graphics2D */ protected native void cairoRectangle(long pointer, double x, double y, double width, double height); - + /** * Appends an arc to the current path */ @@ -438,7 +438,7 @@ public abstract class CairoGraphics2D extends Graphics2D */ protected native void cairoNewPath(long pointer); - /** + /** * Close current path */ protected native void cairoClosePath(long pointer); @@ -464,16 +464,16 @@ public abstract class CairoGraphics2D extends Graphics2D */ protected native void cairoFill(long pointer, double alpha); - /** + /** * Clip current path */ protected native void cairoClip(long pointer); - /** + /** * Clear clip */ protected native void cairoResetClip(long pointer); - + /** * Set antialias. */ @@ -483,7 +483,7 @@ public abstract class CairoGraphics2D extends Graphics2D ///////////////////////// TRANSFORMS /////////////////////////////////// /** * Set the current transform - */ + */ public void setTransform(AffineTransform tx) { // Transform clip into target space using the old transform. @@ -588,7 +588,7 @@ public abstract class CairoGraphics2D extends Graphics2D setTransformImpl(transform); } - + public void translate(int x, int y) { translate((double) x, (double) y); @@ -670,13 +670,13 @@ public abstract class CairoGraphics2D extends Graphics2D setColor((Color) paint); customPaint = false; } - + else if (paint instanceof TexturePaint) { TexturePaint tp = (TexturePaint) paint; BufferedImage img = tp.getImage(); - // map the image to the anchor rectangle + // map the image to the anchor rectangle int width = (int) tp.getAnchorRect().getWidth(); int height = (int) tp.getAnchorRect().getHeight(); @@ -690,7 +690,7 @@ public abstract class CairoGraphics2D extends Graphics2D setPaintPixels(nativePointer, pixels, width, height, width, true, 0, 0); customPaint = false; } - + else if (paint instanceof GradientPaint) { GradientPaint gp = (GradientPaint) paint; @@ -707,12 +707,12 @@ public abstract class CairoGraphics2D extends Graphics2D else { customPaint = true; - } + } } - + /** * Sets a custom paint - * + * * @param bounds the bounding box, in user space */ protected void setCustomPaint(Rectangle bounds) @@ -720,12 +720,12 @@ public abstract class CairoGraphics2D extends Graphics2D if (paint instanceof Color || paint instanceof TexturePaint || paint instanceof GradientPaint) return; - + int userX = bounds.x; int userY = bounds.y; int userWidth = bounds.width; int userHeight = bounds.height; - + // Find bounds in device space Rectangle2D bounds2D = getTransformedBounds(bounds, transform); int deviceX = (int)bounds2D.getX(); @@ -740,14 +740,14 @@ public abstract class CairoGraphics2D extends Graphics2D deviceHeight), bounds, transform, hints); - + Raster raster = pc.getRaster(deviceX, deviceY, deviceWidth, deviceHeight); - + // Clear the transform matrix in Cairo, since the raster returned by the // PaintContext is already in device-space AffineTransform oldTx = new AffineTransform(transform); - setTransformImpl(new AffineTransform()); + setTransformImpl(new AffineTransform()); // Set pixels in cairo, aligning the top-left of the background image // to the top-left corner in device space @@ -762,7 +762,7 @@ public abstract class CairoGraphics2D extends Graphics2D deviceWidth, deviceHeight, deviceWidth, false, deviceX, deviceY); } - + else if (pc.getColorModel().equals(CairoSurface.cairoCM_opaque) && raster.getSampleModel().getTransferType() == DataBuffer.TYPE_INT) { @@ -770,36 +770,36 @@ public abstract class CairoGraphics2D extends Graphics2D // but without an alpha channel; we just add the alpha int[] pixels = (int[])raster.getDataElements(0, 0, deviceWidth, deviceHeight, null); - + for (int i = 0; i < pixels.length; i++) pixels[i] = 0xff000000 | (pixels[i] & 0x00ffffff); - + setPaintPixels(nativePointer, pixels, deviceWidth, deviceHeight, deviceWidth, false, deviceX, deviceY); } - + else { - // Fall back on wrapping the raster in a BufferedImage, and - // use BufferedImage.getRGB() to do color-model conversion + // Fall back on wrapping the raster in a BufferedImage, and + // use BufferedImage.getRGB() to do color-model conversion WritableRaster wr = Raster.createWritableRaster(raster.getSampleModel(), new Point(raster.getMinX(), raster.getMinY())); wr.setRect(raster); - + BufferedImage img2 = new BufferedImage(pc.getColorModel(), wr, pc.getColorModel().isAlphaPremultiplied(), null); - + setPaintPixels(nativePointer, img2.getRGB(0, 0, deviceWidth, deviceHeight, null, 0, deviceWidth), deviceWidth, deviceHeight, deviceWidth, false, deviceX, deviceY); } - + // Restore transform - setTransformImpl(oldTx); + setTransformImpl(oldTx); } public Stroke getStroke() @@ -813,7 +813,7 @@ public abstract class CairoGraphics2D extends Graphics2D if (stroke instanceof BasicStroke) { BasicStroke bs = (BasicStroke) stroke; - cairoSetLine(nativePointer, bs.getLineWidth(), bs.getEndCap(), + cairoSetLine(nativePointer, bs.getLineWidth(), bs.getEndCap(), bs.getLineJoin(), bs.getMiterLimit()); float[] dashes = bs.getDashArray(); @@ -822,7 +822,7 @@ public abstract class CairoGraphics2D extends Graphics2D double[] double_dashes = new double[dashes.length]; for (int i = 0; i < dashes.length; i++) double_dashes[i] = dashes[i]; - + cairoSetDash(nativePointer, double_dashes, double_dashes.length, (double) bs.getDashPhase()); } @@ -833,14 +833,14 @@ public abstract class CairoGraphics2D extends Graphics2D /** * Utility method to find the bounds of a shape, including the stroke width. - * + * * @param s the shape * @return the bounds of the shape, including stroke width */ protected Rectangle findStrokedBounds(Shape s) { Rectangle r = s.getBounds(); - + if (stroke instanceof BasicStroke) { int strokeWidth = (int)Math.ceil(((BasicStroke)stroke).getLineWidth()); @@ -854,7 +854,7 @@ public abstract class CairoGraphics2D extends Graphics2D Shape s2 = stroke.createStrokedShape(s); r = s2.getBounds(); } - + return r; } @@ -877,7 +877,7 @@ public abstract class CairoGraphics2D extends Graphics2D paint = c; updateColor(); } - + /** * Set the current fg value as the cairo color. */ @@ -885,7 +885,7 @@ public abstract class CairoGraphics2D extends Graphics2D { if (fg == null) fg = Color.BLACK; - + cairoSetRGBAColor(nativePointer, fg.getRed() / 255.0, fg.getGreen() / 255.0,fg.getBlue() / 255.0, fg.getAlpha() / 255.0); @@ -951,9 +951,9 @@ public abstract class CairoGraphics2D extends Graphics2D public void setClip(Shape s) { - // The first time the clip is set, save it as the original clip - // to reset to on s == null. We can rely on this being non-null - // because the constructor in subclasses is expected to set the + // The first time the clip is set, save it as the original clip + // to reset to on s == null. We can rely on this being non-null + // because the constructor in subclasses is expected to set the // initial clip properly. if( firstClip ) { @@ -975,7 +975,7 @@ public abstract class CairoGraphics2D extends Graphics2D } else walkPath(clip.getPathIterator(null), false); - + cairoClip(nativePointer); } } @@ -1010,7 +1010,7 @@ public abstract class CairoGraphics2D extends Graphics2D { if (this.comp == comp) return; - + this.comp = comp; if (compCtx != null) compCtx.dispose(); @@ -1021,11 +1021,11 @@ public abstract class CairoGraphics2D extends Graphics2D AlphaComposite a = (AlphaComposite) comp; cairoSetOperator(nativePointer, a.getRule()); } - + else { cairoSetOperator(nativePointer, AlphaComposite.SRC_OVER); - + if (comp != null) { // FIXME: this check is only required "if this Graphics2D @@ -1033,24 +1033,24 @@ public abstract class CairoGraphics2D extends Graphics2D SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(new AWTPermission("readDisplayPixels")); - + compCtx = comp.createContext(getBufferCM(), getNativeCM(), hints); } } } - + /** * Returns the Colour Model describing the native, raw image data for this * specific peer. - * + * * @return ColorModel the ColorModel of native data in this peer */ protected abstract ColorModel getNativeCM(); - + /** * Returns the Color Model describing the buffer that this peer uses * for custom composites. - * + * * @return ColorModel the ColorModel of the composite buffer in this peer. */ protected ColorModel getBufferCM() @@ -1107,7 +1107,7 @@ public abstract class CairoGraphics2D extends Graphics2D if (s instanceof Rectangle2D) { Rectangle2D r = (Rectangle2D) s; - + // Pixels need to be shifted in draw operations to ensure that they // light up entire pixels, but we also need to make sure the rectangle // does not get distorted by this shifting operation @@ -1117,7 +1117,7 @@ public abstract class CairoGraphics2D extends Graphics2D double h = Math.round(r.getHeight()); cairoRectangle(nativePointer, x, y, w, h); } - + // Lines are easy too else if (s instanceof Line2D) { @@ -1170,7 +1170,7 @@ public abstract class CairoGraphics2D extends Graphics2D /** * Note that the rest of the drawing methods go via fill() or draw() for the drawing, - * although subclasses may with to overload these methods where context-specific + * although subclasses may with to overload these methods where context-specific * optimizations are possible (e.g. bitmaps and fillRect(int, int, int, int) */ @@ -1274,17 +1274,17 @@ public abstract class CairoGraphics2D extends Graphics2D } /** - * CopyArea - performs clipping to the native surface as a convenience + * CopyArea - performs clipping to the native surface as a convenience * (requires getRealBounds). Then calls copyAreaImpl. */ - public void copyArea(int ox, int oy, int owidth, int oheight, - int odx, int ody) + public void copyArea(int ox, int oy, int owidth, int oheight, + int odx, int ody) { // FIXME: does this handle a rotation transform properly? // (the width/height might not be correct) Point2D pos = transform.transform(new Point2D.Double(ox, oy), (Point2D) null); - Point2D dim = transform.transform(new Point2D.Double(ox + owidth, + Point2D dim = transform.transform(new Point2D.Double(ox + owidth, oy + oheight), (Point2D) null); Point2D p2 = transform.transform(new Point2D.Double(ox + odx, oy + ody), @@ -1307,7 +1307,7 @@ public abstract class CairoGraphics2D extends Graphics2D if( x + dx + width < r.getX() || y + dy + height < r.getY() ) return; - // Clip edges if necessary + // Clip edges if necessary if( x + dx < r.getX() ) // left { width = x + dx + width; @@ -1348,10 +1348,10 @@ public abstract class CairoGraphics2D extends Graphics2D { this.hints = new RenderingHints(getDefaultHints()); this.hints.putAll(hints); - + shiftDrawCalls = hints.containsValue(RenderingHints.VALUE_STROKE_NORMALIZE) || hints.containsValue(RenderingHints.VALUE_STROKE_DEFAULT); - + if (compCtx != null) { compCtx.dispose(); @@ -1368,7 +1368,7 @@ public abstract class CairoGraphics2D extends Graphics2D { return hints; } - + private int getInterpolation() { if (this.hints.containsValue(RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR)) @@ -1392,18 +1392,18 @@ public abstract class CairoGraphics2D extends Graphics2D // Do bilinear interpolation as default return INTERPOLATION_BILINEAR; } - + /** * Set antialias if needed. If the ignoreAA flag is set, this method will * return without doing anything. - * + * * @param needAA RenderingHints.VALUE_ANTIALIAS_ON or RenderingHints.VALUE_ANTIALIAS_OFF */ private void setAntialias(boolean needAA) { if (ignoreAA) return; - + if (needAA != antialias) { antialias = !antialias; @@ -1425,8 +1425,8 @@ public abstract class CairoGraphics2D extends Graphics2D // In this case, xform is an AffineTransform that transforms bounding // box of the specified image from image space to user space. However // when we pass this transform to cairo, cairo will use this transform - // to map "user coordinates" to "pixel" coordinates, which is the - // other way around. Therefore to get the "user -> pixel" transform + // to map "user coordinates" to "pixel" coordinates, which is the + // other way around. Therefore to get the "user -> pixel" transform // that cairo wants from "image -> user" transform that we currently // have, we will need to invert the transformation matrix. AffineTransform invertedXform; @@ -1459,10 +1459,10 @@ public abstract class CairoGraphics2D extends Graphics2D double[] i2u = new double[6]; int width = b.getWidth(); int height = b.getHeight(); - - // If this BufferedImage has a BufferedImageGraphics object, + + // If this BufferedImage has a BufferedImageGraphics object, // use the cached CairoSurface that BIG is drawing onto - + if( BufferedImageGraphics.bufferedImages.get( b ) != null ) raster = BufferedImageGraphics.bufferedImages.get( b ); else @@ -1481,18 +1481,18 @@ public abstract class CairoGraphics2D extends Graphics2D updateColor(); return true; } - + if( bgcolor != null ) { Color oldColor = bg; setBackground(bgcolor); - + Rectangle2D bounds = new Rectangle2D.Double(0, 0, width, height); bounds = getTransformedBounds(bounds, xform); - + clearRect((int)bounds.getX(), (int)bounds.getY(), (int)bounds.getWidth(), (int)bounds.getHeight()); - + setBackground(oldColor); } @@ -1500,7 +1500,7 @@ public abstract class CairoGraphics2D extends Graphics2D // FIXME: The above method returns data in the standard ARGB colorspace, // meaning data should NOT be alpha pre-multiplied; however Cairo expects // data to be premultiplied. - + cairoSave(nativePointer); Rectangle2D bounds = new Rectangle2D.Double(0, 0, width, height); bounds = getTransformedBounds(bounds, xform); @@ -1510,7 +1510,7 @@ public abstract class CairoGraphics2D extends Graphics2D drawPixels(nativePointer, pixels, width, height, width, i2u, alpha, getInterpolation()); - + cairoRestore(nativePointer); // Cairo seems to lose the current color which must be restored. @@ -1585,7 +1585,7 @@ public abstract class CairoGraphics2D extends Graphics2D int destWidth = dx2 - dx1; int destHeight = dy2 - dy1; - if(destWidth == 0 || destHeight == 0 || sourceWidth == 0 || + if(destWidth == 0 || destHeight == 0 || sourceWidth == 0 || sourceHeight == 0) return true; @@ -1593,18 +1593,18 @@ public abstract class CairoGraphics2D extends Graphics2D double scaleY = destHeight / (double) sourceHeight; // FIXME: Avoid using an AT if possible here - it's at least twice as slow. - + Shape oldClip = getClip(); int cx, cy, cw, ch; - if( dx1 < dx2 ) + if( dx1 < dx2 ) { cx = dx1; cw = dx2 - dx1; } else { cx = dx2; cw = dx1 - dx2; } - if( dy1 < dy2 ) + if( dy1 < dy2 ) { cy = dy1; ch = dy2 - dy1; } else { cy = dy2; ch = dy1 - dy2; } - + clipRect( cx, cy, cw, ch ); AffineTransform tx = new AffineTransform(); @@ -1622,10 +1622,10 @@ public abstract class CairoGraphics2D extends Graphics2D { return drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null, observer); } - + /** * Optimized method for drawing a CairoSurface onto this graphics context. - * + * * @param surface The surface to draw. * @param tx The transformation matrix (cannot be null). * @param alpha The alpha value to paint with ( 0 <= alpha <= 1). @@ -1642,19 +1642,19 @@ public abstract class CairoGraphics2D extends Graphics2D Point2D origin = new Point2D.Double(0, 0); Point2D offset = new Point2D.Double(surface.getSampleModelTranslateX(), surface.getSampleModelTranslateY()); - + tx.transform(origin, origin); tx.transform(offset, offset); - + tx.translate(offset.getX() - origin.getX(), offset.getY() - origin.getY()); } - + // Find dimensions of this surface relative to the root parent surface Rectangle bounds = new Rectangle(-surface.getSampleModelTranslateX(), -surface.getSampleModelTranslateY(), surface.width, surface.height); - + // Clip to the translated image // We use direct cairo methods to avoid the overhead of maintaining a // java copy of the clip, since we will be reverting it immediately @@ -1663,7 +1663,7 @@ public abstract class CairoGraphics2D extends Graphics2D cairoSave(nativePointer); walkPath(newBounds.getPathIterator(null), false); cairoClip(nativePointer); - + // Draw the surface try { @@ -1677,7 +1677,7 @@ public abstract class CairoGraphics2D extends Graphics2D // This should never happen(?), so we don't need to do anything here. ; } - + // Restore clip cairoRestore(nativePointer); } @@ -1696,13 +1696,13 @@ public abstract class CairoGraphics2D extends Graphics2D tl = new TextLayout( str, getFont(), getFontRenderContext() ); fontPeer.textLayoutCache.put(str, tl); } - + // Set antialias to text_antialiasing, and set the ignoreAA flag so that // the setting doesn't get overridden in a draw() or fill() call. setAntialias(!hints.get(RenderingHints.KEY_TEXT_ANTIALIASING) .equals(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF)); ignoreAA = true; - + tl.draw(this, x, y); ignoreAA = false; } @@ -1726,14 +1726,14 @@ public abstract class CairoGraphics2D extends Graphics2D if (customPaint) setCustomPaint(gv.getOutline().getBounds()); - + if (comp instanceof AlphaComposite) alpha = ((AlphaComposite) comp).getAlpha(); - + setAntialias(!hints.get(RenderingHints.KEY_TEXT_ANTIALIASING) .equals(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF)); ignoreAA = true; - + if (gv instanceof FreetypeGlyphVector && alpha == 1.0 && !((FreetypeGlyphVector)gv).hasTransforms()) { @@ -1744,8 +1744,8 @@ public abstract class CairoGraphics2D extends Graphics2D setFont (gv.getFont ()); GdkFontPeer fontPeer = (GdkFontPeer) font.getPeer(); - synchronized (fontPeer) - { + synchronized (fontPeer) + { cairoDrawGlyphVector(nativePointer, fontPeer, x, y, n, codes, positions, fontset); } @@ -1756,7 +1756,7 @@ public abstract class CairoGraphics2D extends Graphics2D fill(gv.getOutline()); translate(-x, -y); } - + ignoreAA = false; } @@ -1767,7 +1767,7 @@ public abstract class CairoGraphics2D extends Graphics2D } /** - * Should perhaps be contexct dependent, but this is left for now as an + * Should perhaps be contexct dependent, but this is left for now as an * overloadable default implementation. */ public FontRenderContext getFontRenderContext() @@ -1799,10 +1799,10 @@ public abstract class CairoGraphics2D extends Graphics2D if (f.getPeer() instanceof GdkFontPeer) font = f; else - font = + font = ((ClasspathToolkit)(Toolkit.getDefaultToolkit())) - .getFont(f.getName(), f.getAttributes()); - + .getFont(f.getName(), f.getAttributes()); + GdkFontPeer fontpeer = (GdkFontPeer) getFont().getPeer(); synchronized (fontpeer) { @@ -1824,11 +1824,11 @@ public abstract class CairoGraphics2D extends Graphics2D if( onStroke ) { Shape stroked = stroke.createStrokedShape( s ); - return stroked.intersects( (double)rect.x, (double)rect.y, + return stroked.intersects( (double)rect.x, (double)rect.y, (double)rect.width, (double)rect.height ); } - return s.intersects( (double)rect.x, (double)rect.y, - (double)rect.width, (double)rect.height ); + return s.intersects( (double)rect.x, (double)rect.y, + (double)rect.width, (double)rect.height ); } public String toString() @@ -1836,7 +1836,7 @@ public abstract class CairoGraphics2D extends Graphics2D return (getClass().getName() + "[font=" + getFont().toString() + ",color=" + fg.toString() - + "]"); + + "]"); } ///////////////////////// PRIVATE METHODS /////////////////////////////////// @@ -1845,7 +1845,7 @@ public abstract class CairoGraphics2D extends Graphics2D * All the drawImage() methods eventually get delegated here if the image * is not a Cairo surface. * - * @param bgcolor - if non-null draws the background color before + * @param bgcolor - if non-null draws the background color before * drawing the image. */ private boolean drawRaster(ColorModel cm, Raster r, @@ -1881,7 +1881,7 @@ public abstract class CairoGraphics2D extends Graphics2D if (pixels == null) { // FIXME: I don't think this code will work correctly with a non-RGB - // MultiPixelPackedSampleModel. Although this entire method should + // MultiPixelPackedSampleModel. Although this entire method should // probably be rewritten to better utilize Cairo's different supported // data formats. if (sm instanceof MultiPixelPackedSampleModel) @@ -1917,13 +1917,13 @@ public abstract class CairoGraphics2D extends Graphics2D double alpha = 1.0; if (comp instanceof AlphaComposite) alpha = ((AlphaComposite) comp).getAlpha(); - + drawPixels(nativePointer, pixels, r.getWidth(), r.getHeight(), r.getWidth(), i2u, alpha, getInterpolation()); // Cairo seems to lose the current color which must be restored. updateColor(); - + return true; } @@ -2112,7 +2112,7 @@ public abstract class CairoGraphics2D extends Graphics2D { if (! (clip instanceof GeneralPath)) clip = new GeneralPath(clip); - + GeneralPath p = (GeneralPath) clip; p.transform(t); } @@ -2138,7 +2138,7 @@ public abstract class CairoGraphics2D extends Graphics2D return rect; } - + static Rectangle2D getTransformedBounds(Rectangle2D bounds, AffineTransform tx) { double x1 = bounds.getX(); @@ -2149,10 +2149,10 @@ public abstract class CairoGraphics2D extends Graphics2D double y2 = y1; double y3 = bounds.getY() + bounds.getHeight(); double y4 = y3; - + double[] points = new double[] {x1, y1, x2, y2, x3, y3, x4, y4}; tx.transform(points, 0, points, 0, 4); - + double minX = points[0]; double maxX = minX; double minY = points[1]; @@ -2164,13 +2164,13 @@ public abstract class CairoGraphics2D extends Graphics2D if (points[i] > maxX) maxX = points[i]; i++; - + if (points[i] < minY) minY = points[i]; if (points[i] > maxY) maxY = points[i]; } - + return new Rectangle2D.Double(minX, minY, (maxX - minX), (maxY - minY)); } } diff --git a/gnu/java/awt/peer/gtk/CairoSurface.java b/gnu/java/awt/peer/gtk/CairoSurface.java index 6c8a30d11..71f6638e4 100644 --- a/gnu/java/awt/peer/gtk/CairoSurface.java +++ b/gnu/java/awt/peer/gtk/CairoSurface.java @@ -68,7 +68,7 @@ public class CairoSurface extends WritableRaster int width = -1, height = -1; /** - * The native pointer to the Cairo surface. + * The native pointer to the Cairo surface. */ long surfacePointer; @@ -93,8 +93,8 @@ public class CairoSurface extends WritableRaster 0xFF000000, true, Buffers.smallestAppropriateTransferType(32)); - - // This CM corresponds to the CAIRO_FORMAT_RGB24 type in Cairo + + // This CM corresponds to the CAIRO_FORMAT_RGB24 type in Cairo static ColorModel cairoCM_opaque = new DirectColorModel(24, 0x00FF0000, 0x0000FF00, 0x000000FF); @@ -112,7 +112,7 @@ public class CairoSurface extends WritableRaster private native void destroy(long surfacePointer, int[] buf); /** - * Draws this image to a given CairoGraphics context, + * Draws this image to a given CairoGraphics context, * with an affine transform given by i2u. */ public native void nativeDrawSurface(long surfacePointer, long contextPointer, @@ -122,23 +122,23 @@ public class CairoSurface extends WritableRaster /** * Synchronizes the image's data buffers, copying any changes made in the * Java array into the native array. - * + * * This method should only be called if (sharedBuffers == false). */ native void syncNativeToJava(long surfacePointer, int[] buffer); - + /** * Synchronizes the image's data buffers, copying any changes made in the * native array into the Java array. - * + * * This method should only be called if (sharedBuffers == false). */ native void syncJavaToNative(long surfacePointer, int[] buffer); - + /** * Return the buffer, with the sample values of each pixel reversed - * (ie, in ABGR instead of ARGB). - * + * (ie, in ABGR instead of ARGB). + * * @return A pointer to a flipped buffer. The memory is allocated in native * code, and must be explicitly freed when it is no longer needed. */ @@ -146,21 +146,21 @@ public class CairoSurface extends WritableRaster /** * Create a cairo_surface_t with specified width and height. - * The format will be ARGB32 with premultiplied alpha and native bit + * The format will be ARGB32 with premultiplied alpha and native bit * and word ordering. */ public CairoSurface(int width, int height) { this(0, 0, width, height); } - + public CairoSurface(int x, int y, int width, int height) { super(createCairoSampleModel(width, height), null, new Point(x, y)); if(width <= 0 || height <= 0) throw new IllegalArgumentException("Image must be at least 1x1 pixels."); - + this.width = width; this.height = height; dataBuffer = new DataBufferInt(width * height); @@ -169,7 +169,7 @@ public class CairoSurface extends WritableRaster if(surfacePointer == 0) throw new Error("Could not allocate bitmap."); } - + /** * Create a Cairo Surface that is a subimage of another Cairo Surface */ @@ -177,7 +177,7 @@ public class CairoSurface extends WritableRaster Point origin) { super(sm, parent.dataBuffer, bounds, origin, parent); - + this.width = super.width; this.height = super.height; this.surfacePointer = parent.surfacePointer; @@ -258,10 +258,10 @@ public class CairoSurface extends WritableRaster { return new GtkImage(width, height, getFlippedBuffer(surfacePointer)); } - + /** * Convenience method to quickly grab the data array backing this Raster. - * + * * @return The array behind the databuffer. */ public int[] getData() @@ -271,16 +271,16 @@ public class CairoSurface extends WritableRaster /** * Returns a BufferedImage backed by a Cairo surface. - */ + */ public static BufferedImage getBufferedImage(int width, int height) { return getBufferedImage(new CairoSurface(width, height)); } /** - * Returns a BufferedImage backed by a Cairo surface, + * Returns a BufferedImage backed by a Cairo surface, * created from a GtkImage. - */ + */ public static BufferedImage getBufferedImage(GtkImage image) { return getBufferedImage(new CairoSurface(image)); @@ -288,7 +288,7 @@ public class CairoSurface extends WritableRaster /** * Returns a BufferedImage backed by a Cairo surface. - */ + */ public static BufferedImage getBufferedImage(CairoSurface surface) { return new BufferedImage(cairoColorModel, surface, @@ -302,7 +302,7 @@ public class CairoSurface extends WritableRaster public Graphics2D getGraphics() { return new CairoSurfaceGraphics(this); - } + } ///// Methods used by CairoSurfaceGraphics ///// /** @@ -319,7 +319,7 @@ public class CairoSurface extends WritableRaster /** * Copy a portion of this surface to another area on the surface. The given * parameters must be within bounds - count on a segfault otherwise. - * + * * @param x The x coordinate of the area to be copied from. * @param y The y coordinate of the area to be copied from. * @param width The width of the area to be copied. @@ -336,7 +336,7 @@ public class CairoSurface extends WritableRaster native void copyAreaNative2(long surfacePointer, int x, int y, int width, int height, int dx, int dy, int stride); - + /** * Creates a SampleModel that matches Cairo's native format */ @@ -344,12 +344,12 @@ public class CairoSurface extends WritableRaster { return new SinglePixelPackedSampleModel(DataBuffer.TYPE_INT, w, h, new int[]{0x00FF0000, 0x0000FF00, - 0x000000FF, 0xFF000000}); + 0x000000FF, 0xFF000000}); } - + /** * Returns whether this ColorModel is compatible with Cairo's native types. - * + * * @param cm The color model to check. * @return Whether it is compatible. */ @@ -358,10 +358,10 @@ public class CairoSurface extends WritableRaster return (cm.equals(cairoCM_pre) || cm.equals(cairoCM_opaque) || cm.equals(cairoColorModel)); } - + /** * Returns whether this SampleModel is compatible with Cairo's native types. - * + * * @param sm The sample model to check. * @return Whether it is compatible. */ @@ -381,23 +381,23 @@ public class CairoSurface extends WritableRaster return createWritableChild(parentX, parentY, width, height, childMinX, childMinY, bandList); } - + public WritableRaster createCompatibleWritableRaster() { return new CairoSurface(width, height); } - + public WritableRaster createCompatibleWritableRaster (int x, int y, int w, int h) { return new CairoSurface(x, y, w, h); } - + public Raster createTranslatedChild(int childMinX, int childMinY) { return createWritableTranslatedChild(childMinX, childMinY); } - + public WritableRaster createWritableChild(int parentX, int parentY, int w, int h, int childMinX, int childMinY, int[] bandList) @@ -405,7 +405,7 @@ public class CairoSurface extends WritableRaster if (parentX < minX || parentX + w > minX + width || parentY < minY || parentY + h > minY + height) throw new RasterFormatException("Child raster extends beyond parent"); - + SampleModel sm = (bandList == null) ? sampleModel : sampleModel.createSubsetSampleModel(bandList); @@ -415,12 +415,12 @@ public class CairoSurface extends WritableRaster new Point(sampleModelTranslateX + childMinX - parentX, sampleModelTranslateY + childMinY - parentY)); } - + public WritableRaster createWritableTranslatedChild(int x, int y) { int tcx = sampleModelTranslateX - minX + x; int tcy = sampleModelTranslateY - minY + y; - + return new CairoSurface(sampleModel, this, new Rectangle(x, y, width, height), new Point(tcx, tcy)); diff --git a/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java b/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java index 35b015f32..a0c6caa9a 100644 --- a/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java +++ b/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java @@ -67,7 +67,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D protected CairoSurface surface; private BufferedImage buffer; private long cairo_t; - + /** * Create a graphics context from a cairo surface */ @@ -82,24 +82,24 @@ public class CairoSurfaceGraphics extends CairoGraphics2D /** * Creates another context from a surface. * Used by create(). - */ + */ private CairoSurfaceGraphics(CairoSurfaceGraphics copyFrom) { surface = copyFrom.surface; cairo_t = surface.newCairoContext(); copy( copyFrom, cairo_t ); } - + public Graphics create() { return new CairoSurfaceGraphics(this); } - + public GraphicsConfiguration getDeviceConfiguration() { return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration(); } - + protected Rectangle2D getRealBounds() { return new Rectangle2D.Double(0.0, 0.0, surface.width, surface.height); @@ -109,7 +109,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D { surface.copyAreaNative(x, y, width, height, dx, dy, surface.width); } - + /** * Overloaded methods that do actual drawing need to account for custom * composites @@ -118,7 +118,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D { if (!surface.sharedBuffer) surface.syncJavaToNative(surface.surfacePointer, surface.getData()); - + // Find total bounds of shape Rectangle r = findStrokedBounds(s); if (shiftDrawCalls) @@ -126,24 +126,24 @@ public class CairoSurfaceGraphics extends CairoGraphics2D r.width++; r.height++; } - + // Do the drawing if (comp == null || comp instanceof AlphaComposite) super.draw(s); - + else { createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setStroke(this.getStroke()); g2d.setColor(this.getColor()); g2d.setTransform(transform); g2d.draw(s); - + drawComposite(r.getBounds2D(), null); } - + if (!surface.sharedBuffer) surface.syncNativeToJava(surface.surfacePointer, surface.getData()); } @@ -152,23 +152,23 @@ public class CairoSurfaceGraphics extends CairoGraphics2D { if (!surface.sharedBuffer) surface.syncJavaToNative(surface.surfacePointer, surface.getData()); - + if (comp == null || comp instanceof AlphaComposite) super.fill(s); - + else { createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setPaint(this.getPaint()); g2d.setColor(this.getColor()); g2d.setTransform(transform); g2d.fill(s); - + drawComposite(s.getBounds2D(), null); } - + if (!surface.sharedBuffer) surface.syncNativeToJava(surface.surfacePointer, surface.getData()); } @@ -177,10 +177,10 @@ public class CairoSurfaceGraphics extends CairoGraphics2D { if (!surface.sharedBuffer) surface.syncJavaToNative(surface.surfacePointer, surface.getData()); - + if (comp == null || comp instanceof AlphaComposite) super.drawRenderedImage(image, xform); - + else { createBuffer(); @@ -189,10 +189,10 @@ public class CairoSurfaceGraphics extends CairoGraphics2D g2d.setRenderingHints(this.getRenderingHints()); g2d.setTransform(transform); g2d.drawRenderedImage(image, xform); - + drawComposite(buffer.getRaster().getBounds(), null); } - + if (!surface.sharedBuffer) surface.syncNativeToJava(surface.surfacePointer, surface.getData()); } @@ -206,7 +206,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D boolean ret; if (comp == null || comp instanceof AlphaComposite) ret = super.drawImage(img, xform, bgcolor, obs); - + else { // Get buffered image of source @@ -218,16 +218,16 @@ public class CairoSurfaceGraphics extends CairoGraphics2D img = Toolkit.getDefaultToolkit().createImage(source); } BufferedImage bImg = (BufferedImage) img; - + // Find translated bounds Rectangle2D bounds = new Rectangle(bImg.getMinX(), bImg.getMinY(), bImg.getWidth(), bImg.getHeight()); if (xform != null) bounds = getTransformedBounds(bounds, xform); - + // Create buffer and draw image createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setRenderingHints(this.getRenderingHints()); g2d.drawImage(img, xform, obs); @@ -235,10 +235,10 @@ public class CairoSurfaceGraphics extends CairoGraphics2D // Perform compositing ret = drawComposite(bounds, obs); } - + if (!surface.sharedBuffer) surface.syncNativeToJava(surface.surfacePointer, surface.getData()); - + return ret; } @@ -246,10 +246,10 @@ public class CairoSurfaceGraphics extends CairoGraphics2D { if (!surface.sharedBuffer) surface.syncJavaToNative(surface.surfacePointer, surface.getData()); - + if (comp == null || comp instanceof AlphaComposite) super.drawGlyphVector(gv, x, y); - + else { createBuffer(); @@ -258,17 +258,17 @@ public class CairoSurfaceGraphics extends CairoGraphics2D g2d.setPaint(this.getPaint()); g2d.setStroke(this.getStroke()); g2d.drawGlyphVector(gv, x, y); - + Rectangle2D bounds = gv.getLogicalBounds(); bounds = new Rectangle2D.Double(x + bounds.getX(), y + bounds.getY(), bounds.getWidth(), bounds.getHeight()); drawComposite(bounds, null); } - + if (!surface.sharedBuffer) surface.syncNativeToJava(surface.surfacePointer, surface.getData()); } - + private boolean drawComposite(Rectangle2D bounds, ImageObserver observer) { // Find bounds in device space @@ -280,7 +280,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D devClip = new Rectangle(buffer.getMinX(), buffer.getMinY(), buffer.getWidth(), buffer.getHeight()); Rectangle2D.intersect(bounds, devClip, bounds); - + // Round bounds as needed, but be careful in our rounding // (otherwise it may leave unpainted stripes) double x = bounds.getX(); @@ -290,7 +290,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D x = Math.round(x); y = Math.round(y); bounds.setRect(x, y, Math.round(maxX - x), Math.round(maxY - y)); - + // Find subimage of internal buffer for updating BufferedImage buffer2 = buffer; if (!bounds.equals(buffer2.getRaster().getBounds())) @@ -307,12 +307,12 @@ public class CairoSurfaceGraphics extends CairoGraphics2D // Perform actual composite operation compCtx.compose(buffer2.getRaster(), current.getRaster(), buffer2.getRaster()); - + // Set cairo's composite to direct SRC, since we've already done our own - // compositing + // compositing Composite oldcomp = comp; setComposite(AlphaComposite.Src); - + // This MUST call directly into the "action" method in CairoGraphics2D, // not one of the wrappers, to ensure that the composite isn't processed // more than once! @@ -324,7 +324,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D updateColor(); return rv; } - + private void createBuffer() { if (buffer == null) @@ -337,17 +337,17 @@ public class CairoSurfaceGraphics extends CairoGraphics2D else { Graphics2D g2d = ((Graphics2D)buffer.getGraphics()); - + g2d.setBackground(new Color(0,0,0,0)); g2d.clearRect(0, 0, buffer.getWidth(), buffer.getHeight()); } } - + protected ColorModel getNativeCM() { return CairoSurface.cairoCM_pre; } - + protected ColorModel getBufferCM() { return CairoSurface.cairoColorModel; diff --git a/gnu/java/awt/peer/gtk/ComponentGraphics.java b/gnu/java/awt/peer/gtk/ComponentGraphics.java index bfa3bc96a..50161b2b7 100644 --- a/gnu/java/awt/peer/gtk/ComponentGraphics.java +++ b/gnu/java/awt/peer/gtk/ComponentGraphics.java @@ -83,7 +83,7 @@ public class ComponentGraphics extends CairoGraphics2D ComponentGraphics() { } - + private ComponentGraphics(GtkComponentPeer component) { this.component = component; @@ -114,7 +114,7 @@ public class ComponentGraphics extends CairoGraphics2D /** * Obtain and hold a GDK lock, which is required for all drawing operations * in this graphics context (since it is backed by an X surface). - * + * * This method causes the GDK locking behaviour to be re-entrant. No race * conditions are caused since a ThreadLocal is used and each thread has its * own lock counter. @@ -176,11 +176,11 @@ public class ComponentGraphics extends CairoGraphics2D */ private static native Pointer nativeGrab(GtkComponentPeer component); - private native void copyAreaNative(GtkComponentPeer component, int x, int y, + private native void copyAreaNative(GtkComponentPeer component, int x, int y, int width, int height, int dx, int dy); private native void drawVolatile(GtkComponentPeer component, - long vimg, int x, int y, + long vimg, int x, int y, int width, int height, int cx, int cy, int cw, int ch); @@ -193,7 +193,7 @@ public class ComponentGraphics extends CairoGraphics2D } /** - * Returns a Graphics2D object for a component, either an instance of this + * Returns a Graphics2D object for a component, either an instance of this * class (if xrender is supported), or a context which copies. */ public static Graphics2D getComponentGraphics(GtkComponentPeer component) @@ -214,7 +214,7 @@ public class ComponentGraphics extends CairoGraphics2D { return new ComponentGraphics(this); } - + protected Rectangle2D getRealBounds() { return component.awtComponent.getBounds(); @@ -226,23 +226,23 @@ public class ComponentGraphics extends CairoGraphics2D } /** - * Overloaded methods that do actual drawing need to enter the gdk threads + * Overloaded methods that do actual drawing need to enter the gdk threads * and also do certain things before and after. */ public void draw(Shape s) { if (comp == null || comp instanceof AlphaComposite) super.draw(s); - + else { createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setStroke(this.getStroke()); g2d.setColor(this.getColor()); g2d.draw(s); - + drawComposite(s.getBounds2D(), null); } } @@ -251,16 +251,16 @@ public class ComponentGraphics extends CairoGraphics2D { if (comp == null || comp instanceof AlphaComposite) super.fill(s); - + else { createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setPaint(this.getPaint()); g2d.setColor(this.getColor()); g2d.fill(s); - + drawComposite(s.getBounds2D(), null); } } @@ -269,7 +269,7 @@ public class ComponentGraphics extends CairoGraphics2D { if (comp == null || comp instanceof AlphaComposite) super.drawRenderedImage(image, xform); - + else { createBuffer(); @@ -277,18 +277,18 @@ public class ComponentGraphics extends CairoGraphics2D Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setRenderingHints(this.getRenderingHints()); g2d.drawRenderedImage(image, xform); - + drawComposite(buffer.getRaster().getBounds(), null); } } protected boolean drawImage(Image img, AffineTransform xform, - Color bgcolor, ImageObserver obs) + Color bgcolor, ImageObserver obs) { boolean rv; if (comp == null || comp instanceof AlphaComposite) rv = super.drawImage(img, xform, bgcolor, obs); - + else { // Get buffered image of source @@ -300,7 +300,7 @@ public class ComponentGraphics extends CairoGraphics2D img = Toolkit.getDefaultToolkit().createImage(source); } BufferedImage bImg = (BufferedImage) img; - + // Find translated bounds Point2D origin = new Point2D.Double(bImg.getMinX(), bImg.getMinY()); Point2D pt = new Point2D.Double(bImg.getWidth() + bImg.getMinX(), @@ -310,10 +310,10 @@ public class ComponentGraphics extends CairoGraphics2D origin = xform.transform(origin, origin); pt = xform.transform(pt, pt); } - + // Create buffer and draw image createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setRenderingHints(this.getRenderingHints()); g2d.drawImage(img, xform, obs); @@ -331,7 +331,7 @@ public class ComponentGraphics extends CairoGraphics2D { if (comp == null || comp instanceof AlphaComposite) super.drawGlyphVector(gv, x, y); - + else { createBuffer(); @@ -340,14 +340,14 @@ public class ComponentGraphics extends CairoGraphics2D g2d.setPaint(this.getPaint()); g2d.setStroke(this.getStroke()); g2d.drawGlyphVector(gv, x, y); - + Rectangle2D bounds = gv.getLogicalBounds(); bounds = new Rectangle2D.Double(x + bounds.getX(), y + bounds.getY(), bounds.getWidth(), bounds.getHeight()); drawComposite(bounds, null); } } - + public boolean drawImage(Image img, int x, int y, ImageObserver observer) { // If it is a GtkVolatileImage with an "easy" transform then @@ -390,7 +390,7 @@ public class ComponentGraphics extends CairoGraphics2D } return super.drawImage(bimg, x, y, observer); } - + public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) { @@ -446,41 +446,41 @@ public class ComponentGraphics extends CairoGraphics2D clip = new Rectangle(buffer.getMinX(), buffer.getMinY(), buffer.getWidth(), buffer.getHeight()); Rectangle2D.intersect(bounds, clip, bounds); - + BufferedImage buffer2 = buffer; if (!bounds.equals(buffer2.getRaster().getBounds())) buffer2 = buffer2.getSubimage((int)bounds.getX(), (int)bounds.getY(), (int)bounds.getWidth(), (int)bounds.getHeight()); - + // Get destination clip to bounds double[] points = new double[] {bounds.getX(), bounds.getY(), bounds.getMaxX(), bounds.getMaxY()}; transform.transform(points, 0, points, 0, 2); - + Rectangle2D deviceBounds = new Rectangle2D.Double(points[0], points[1], points[2] - points[0], points[3] - points[1]); - + Rectangle2D.intersect(deviceBounds, this.getClipInDevSpace(), deviceBounds); - + // Get current image on the component GtkImage img = grab(component); Graphics gr = componentBuffer.createGraphics(); gr.drawImage(img, 0, 0, null); gr.dispose(); - + BufferedImage cBuffer = componentBuffer; if (!deviceBounds.equals(cBuffer.getRaster().getBounds())) cBuffer = cBuffer.getSubimage((int)deviceBounds.getX(), (int)deviceBounds.getY(), (int)deviceBounds.getWidth(), (int)deviceBounds.getHeight()); - + // Perform actual composite operation compCtx.compose(buffer2.getRaster(), cBuffer.getRaster(), cBuffer.getRaster()); - + // This MUST call directly into the "action" method in CairoGraphics2D, // not one of the wrappers, to ensure that the composite isn't processed // more than once! @@ -490,7 +490,7 @@ public class ComponentGraphics extends CairoGraphics2D null, null); return rv; } - + private void createBuffer() { if (buffer == null) @@ -499,7 +499,7 @@ public class ComponentGraphics extends CairoGraphics2D rst = Raster.createWritableRaster(GtkVolatileImage.createGdkSampleModel(component.awtComponent.getWidth(), component.awtComponent.getHeight()), new Point(0,0)); - + buffer = new BufferedImage(GtkVolatileImage.gdkColorModel, rst, GtkVolatileImage.gdkColorModel.isAlphaPremultiplied(), new Hashtable()); @@ -507,60 +507,60 @@ public class ComponentGraphics extends CairoGraphics2D else { Graphics2D g2d = ((Graphics2D)buffer.getGraphics()); - + g2d.setBackground(new Color(0,0,0,0)); g2d.clearRect(0, 0, buffer.getWidth(), buffer.getHeight()); } - + if (componentBuffer == null) { WritableRaster rst; rst = Raster.createWritableRaster(GtkVolatileImage.createGdkSampleModel(component.awtComponent.getWidth(), component.awtComponent.getHeight()), new Point(0,0)); - + componentBuffer = new BufferedImage(GtkVolatileImage.gdkColorModel, rst, GtkVolatileImage.gdkColorModel.isAlphaPremultiplied(), new Hashtable()); } } - + protected ColorModel getNativeCM() { return GtkVolatileImage.gdkColorModel; } - + /* --- START OVERRIDDEN NATIVE METHODS ---- * All native methods in CairoGraphics2D should be overridden here and * enclosed in locks, since the cairo surface is backed by an X surface * in this graphics context and the X surface requires external locking. - * + * * We lock everything "just in case", since it's difficult to know which * calls are and aren't thread-safe. Overriding and locking the native - * methods allows superclass code in CairoGraphics2D to execute properly, + * methods allows superclass code in CairoGraphics2D to execute properly, * without the need to override every single method. - * + * * CAVEAT: if native code obtains a lock (using gdk_threads_enter(), not the * lock() method provided here) and then calls back into Java and one of these * methods ends up being called, we will deadlock. The lock is only reentrant - * when called via our lock() method. + * when called via our lock() method. */ - + /* These methods are already locked in the superclass CairoGraphics2D * so they do not need to be overridden: - * + * * public void disposeNative * * protected void cairoDrawGlyphVector - * + * * protected void cairoSetFont */ - + @Override protected long init(long pointer) { long ret; - + try { lock(); @@ -570,10 +570,10 @@ public class ComponentGraphics extends CairoGraphics2D { unlock(); } - + return ret; } - + @Override protected void drawPixels(long pointer, int[] pixels, int w, int h, int stride, double[] i2u, double alpha, @@ -590,10 +590,10 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override - protected void setGradient(long pointer, double x1, double y1, - double x2, double y2, + protected void setGradient(long pointer, double x1, double y1, + double x2, double y2, int r1, int g1, int b1, int a1, int r2, int g2, int b2, int a2, boolean cyclic) { @@ -608,7 +608,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void setPaintPixels(long pointer, int[] pixels, int w, int h, int stride, boolean repeat, int x, int y) @@ -623,7 +623,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoSetMatrix(long pointer, double[] m) { @@ -637,7 +637,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoScale(long pointer, double x, double y) { @@ -651,7 +651,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoSetOperator(long pointer, int cairoOperator) { @@ -665,7 +665,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoSetRGBAColor(long pointer, double red, double green, double blue, double alpha) @@ -680,7 +680,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoSetFillRule(long pointer, int cairoFillRule) { @@ -694,7 +694,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoSetLine(long pointer, double width, int cap, int join, double miterLimit) @@ -709,9 +709,9 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override - protected void cairoSetDash(long pointer, double[] dashes, int ndash, + protected void cairoSetDash(long pointer, double[] dashes, int ndash, double offset) { try @@ -739,9 +739,9 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override - protected void cairoArc(long pointer, double x, double y, + protected void cairoArc(long pointer, double x, double y, double radius, double angle1, double angle2) { try @@ -754,7 +754,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoSave(long pointer) { @@ -768,7 +768,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoRestore(long pointer) { @@ -782,7 +782,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoNewPath(long pointer) { @@ -796,7 +796,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoClosePath(long pointer) { @@ -810,7 +810,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoMoveTo(long pointer, double x, double y) { @@ -824,7 +824,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoLineTo(long pointer, double x, double y) { @@ -838,7 +838,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoCurveTo(long pointer, double x1, double y1, double x2, double y2, double x3, double y3) @@ -853,7 +853,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoStroke(long pointer) { @@ -867,7 +867,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoFill(long pointer, double alpha) { @@ -881,7 +881,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoClip(long pointer) { @@ -895,7 +895,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoResetClip(long pointer) { @@ -909,7 +909,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoSetAntialias(long pointer, boolean aa) { @@ -923,7 +923,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void drawCairoSurface(CairoSurface surface, AffineTransform tx, double alpha, int interpolation) diff --git a/gnu/java/awt/peer/gtk/ComponentGraphicsCopy.java b/gnu/java/awt/peer/gtk/ComponentGraphicsCopy.java index 2216d459a..a73012d9f 100644 --- a/gnu/java/awt/peer/gtk/ComponentGraphicsCopy.java +++ b/gnu/java/awt/peer/gtk/ComponentGraphicsCopy.java @@ -48,7 +48,7 @@ import java.awt.image.RenderedImage; import java.awt.image.ImageObserver; /** - * Implementation of Graphics2D for Components for servers which + * Implementation of Graphics2D for Components for servers which * do not have xrender. * * A mirrored GtkImage of the component is stored in memory @@ -62,17 +62,17 @@ public class ComponentGraphicsCopy extends CairoSurfaceGraphics * GtkImage sharing its data buffer with this Cairo surface. */ private GtkImage gtkimage; - + private int width, height; native void getPixbuf( GtkComponentPeer component, GtkImage image ); - native void copyPixbuf( GtkComponentPeer component, GtkImage image, - int x, int y, int w, int h ); + native void copyPixbuf( GtkComponentPeer component, GtkImage image, + int x, int y, int w, int h ); - public ComponentGraphicsCopy(int width, int height, - GtkComponentPeer component) - { + public ComponentGraphicsCopy(int width, int height, + GtkComponentPeer component) + { super( new CairoSurface( width, height ) ); this.component = component; this.width = width; @@ -82,7 +82,7 @@ public class ComponentGraphicsCopy extends CairoSurfaceGraphics } /** - * Overloaded methods that do actual drawing need to enter the gdk threads + * Overloaded methods that do actual drawing need to enter the gdk threads * and also do certain things before and after. */ public void draw(Shape s) @@ -106,7 +106,7 @@ public class ComponentGraphicsCopy extends CairoSurfaceGraphics } protected boolean drawImage(Image img, AffineTransform xform, - Color bgcolor, ImageObserver obs) + Color bgcolor, ImageObserver obs) { boolean rv = super.drawImage(img, xform, bgcolor, obs); copyPixbuf(component, gtkimage, 0, 0, width, height); @@ -120,4 +120,3 @@ public class ComponentGraphicsCopy extends CairoSurfaceGraphics copyPixbuf(component, gtkimage, r.x, r.y, r.width, r.height); } } - diff --git a/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java b/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java index af975f394..8fd734799 100644 --- a/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java +++ b/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java @@ -81,7 +81,7 @@ public class FreetypeGlyphVector extends GlyphVector * The glyph codes */ private int[] glyphCodes; - + /** * The set of fonts used in this glyph vector. */ @@ -89,22 +89,22 @@ public class FreetypeGlyphVector extends GlyphVector /** * Glyph transforms. Supports all transform operations. - * + * * The identity transform should not be stored in this array; use a null * instead (will result in performance improvements). */ private AffineTransform[] glyphTransforms; private GlyphMetrics[] metricsCache; - + private native void dispose(long[] fonts); - + /** * Returns a pointer to the native PangoFcFont object. - * + * * The object will be referenced with g_object_ref n times before being * returned, and must be unreferenced a corresponding number of times. - * + * * @param n Number of times to reference the object. * @return Pointer to the native default font. */ @@ -158,19 +158,19 @@ public class FreetypeGlyphVector extends GlyphVector glyphCodes = new int[ codes.length ]; System.arraycopy(codes, 0, glyphCodes, 0, codes.length); nGlyphs = glyphCodes.length; - + if (fontSet == null) { fontSet = new long[nGlyphs]; Arrays.fill(fontSet, getNativeFontPointer(nGlyphs)); } - + performDefaultLayout(); } /** * Cloning constructor - */ + */ private FreetypeGlyphVector( FreetypeGlyphVector gv ) { font = gv.font; @@ -191,7 +191,7 @@ public class FreetypeGlyphVector extends GlyphVector glyphPositions = new float[(nGlyphs + 1) * 2]; glyphTransforms = new AffineTransform[ nGlyphs ]; Arrays.fill(glyphTransforms, null); - + for(int i = 0; i < nGlyphs; i++ ) { if (gv.glyphTransforms[i] != null) @@ -203,7 +203,7 @@ public class FreetypeGlyphVector extends GlyphVector System.arraycopy(gv.glyphCodes, 0, glyphCodes, 0, nGlyphs); System.arraycopy(gv.fontSet, 0, fontSet, 0, nGlyphs); } - + public void finalize() { dispose(fontSet); @@ -247,8 +247,8 @@ public class FreetypeGlyphVector extends GlyphVector /** * Returns the kerning of a glyph pair */ - private native void getKerning(int leftGlyph, int rightGlyph, long font, - float[] p); + private native void getKerning(int leftGlyph, int rightGlyph, long font, + float[] p); private native double[] getMetricsNative(int glyphCode, long font); @@ -268,9 +268,9 @@ public class FreetypeGlyphVector extends GlyphVector if( ! (gv instanceof FreetypeGlyphVector) ) return false; - return (((FreetypeGlyphVector)gv).font.equals(font) && - ((FreetypeGlyphVector)gv).frc.equals(frc) - && ((FreetypeGlyphVector)gv).s.equals(s)); + return (((FreetypeGlyphVector)gv).font.equals(font) && + ((FreetypeGlyphVector)gv).frc.equals(frc) + && ((FreetypeGlyphVector)gv).s.equals(s)); } /** @@ -323,19 +323,19 @@ public class FreetypeGlyphVector extends GlyphVector } glyphPositions[nGlyphs * 2] = x; glyphPositions[nGlyphs * 2 + 1] = y; - + // Apply any transform that may be in the font's attributes TransformAttribute ta; ta = (TransformAttribute)font.getAttributes().get(TextAttribute.TRANSFORM); if (ta != null) { AffineTransform tx = ta.getTransform(); - + // Transform glyph positions tx.transform(glyphPositions, 0, glyphPositions, 0, glyphPositions.length / 2); - - // Also store per-glyph scale/shear/rotate (but not translation) + + // Also store per-glyph scale/shear/rotate (but not translation) double[] matrix = new double[4]; tx.getMatrix(matrix); AffineTransform deltaTx = new AffineTransform(matrix); @@ -355,7 +355,7 @@ public class FreetypeGlyphVector extends GlyphVector /** * Returns multiple glyphcodes. */ - public int[] getGlyphCodes(int beginGlyphIndex, int numEntries, + public int[] getGlyphCodes(int beginGlyphIndex, int numEntries, int[] codeReturn) { int[] rval; @@ -364,7 +364,7 @@ public class FreetypeGlyphVector extends GlyphVector rval = new int[ numEntries ]; else rval = codeReturn; - + System.arraycopy(glyphCodes, beginGlyphIndex, rval, 0, numEntries); return rval; @@ -372,10 +372,10 @@ public class FreetypeGlyphVector extends GlyphVector /** * Returns pointers to the fonts used in this glyph vector. - * + * * The array index matches that of the glyph vector itself. */ - protected long[] getGlyphFonts(int beginGlyphIndex, int numEntries, + protected long[] getGlyphFonts(int beginGlyphIndex, int numEntries, long[] codeReturn) { long[] rval; @@ -384,7 +384,7 @@ public class FreetypeGlyphVector extends GlyphVector rval = new long[ numEntries ]; else rval = codeReturn; - + System.arraycopy(fontSet, beginGlyphIndex, rval, 0, numEntries); return rval; @@ -394,18 +394,18 @@ public class FreetypeGlyphVector extends GlyphVector { GlyphMetrics gm = getGlyphMetrics( glyphIndex ); if( gm == null ) - return null; + return null; Rectangle2D r = gm.getBounds2D(); Point2D p = getGlyphPosition( glyphIndex ); - + double[] bounds = new double[] {p.getX() + r.getX() - gm.getLSB(), p.getY() + r.getY(), p.getX() + r.getX() - gm.getLSB() + gm.getAdvanceX(), p.getY() + r.getY() + r.getHeight()}; - + if (glyphTransforms[glyphIndex] != null) glyphTransforms[glyphIndex].transform(bounds, 0, bounds, 0, 2); - + return new Rectangle2D.Double(bounds[0], bounds[1], bounds[2] - bounds[0], bounds[3] - bounds[1]); } @@ -428,10 +428,10 @@ public class FreetypeGlyphVector extends GlyphVector gm = null; else { - gm = new GlyphMetrics(true, - (float)val[1], - (float)val[2], - new Rectangle2D.Double(val[3], val[4], + gm = new GlyphMetrics(true, + (float)val[1], + (float)val[2], + new Rectangle2D.Double(val[3], val[4], val[5], val[6] ), GlyphMetrics.STANDARD ); peer.putGlyphMetrics( glyphCodes[ i ], gm ); @@ -454,7 +454,7 @@ public class FreetypeGlyphVector extends GlyphVector /** * Returns the outline of a single glyph. - * + * * Despite what the Sun API says, this method returns the glyph relative to * the origin of the *entire string*, not each individual glyph. */ @@ -462,7 +462,7 @@ public class FreetypeGlyphVector extends GlyphVector { GeneralPath gp = getGlyphOutlineNative(glyphCodes[glyphIndex], fontSet[glyphIndex]); - + AffineTransform tx = AffineTransform.getTranslateInstance(glyphPositions[glyphIndex*2], glyphPositions[glyphIndex*2+1]); if (glyphTransforms[glyphIndex] != null) @@ -484,12 +484,12 @@ public class FreetypeGlyphVector extends GlyphVector /** * Returns the positions of multiple glyphs. */ - public float[] getGlyphPositions(int beginGlyphIndex, int numEntries, - float[] positionReturn) + public float[] getGlyphPositions(int beginGlyphIndex, int numEntries, + float[] positionReturn) { if (positionReturn == null || positionReturn.length < (numEntries * 2)) positionReturn = new float[numEntries*2]; - + System.arraycopy(glyphPositions, beginGlyphIndex*2, positionReturn, 0, numEntries*2); return positionReturn; @@ -502,7 +502,7 @@ public class FreetypeGlyphVector extends GlyphVector { return glyphTransforms[glyphIndex]; } - + /** * Checks whether any transform has been set on any glyphs. */ @@ -511,10 +511,10 @@ public class FreetypeGlyphVector extends GlyphVector for (int i = 0; i < glyphTransforms.length; i++) if (glyphTransforms[i] != null) return true; - + return false; } - + /** * Returns the visual bounds of a glyph * May be off by a pixel or two due to hinting/rasterization. @@ -538,7 +538,7 @@ public class FreetypeGlyphVector extends GlyphVector for( int i = 1; i < nGlyphs; i++ ) { Rectangle2D r2 = (Rectangle2D)getGlyphLogicalBounds( i ); - + rect = rect.createUnion( r2 ); } @@ -566,9 +566,9 @@ public class FreetypeGlyphVector extends GlyphVector } /** - * TODO: - * FreeType does not currently have an API for the JSTF table. We should - * probably get the table ourselves from FT and pass it to some parser + * TODO: + * FreeType does not currently have an API for the JSTF table. We should + * probably get the table ourselves from FT and pass it to some parser * which the native font peers will need. */ public GlyphJustificationInfo getGlyphJustificationInfo(int glyphIndex) @@ -615,14 +615,14 @@ public class FreetypeGlyphVector extends GlyphVector // using and checking for nulls can be much faster. if (newTX != null && newTX.isIdentity()) newTX = null; - + // If the old and new transforms are identical, bail if (glyphTransforms[glyphIndex] == null && newTX == null) return; - + if (newTX != null && newTX.equals(glyphTransforms[glyphIndex])) return; - + // Invalidate bounds cache and set new transform logicalBounds = null; glyphTransforms[glyphIndex] = newTX; diff --git a/gnu/java/awt/peer/gtk/GdkFontPeer.java b/gnu/java/awt/peer/gtk/GdkFontPeer.java index 078255e68..0041cd265 100644 --- a/gnu/java/awt/peer/gtk/GdkFontPeer.java +++ b/gnu/java/awt/peer/gtk/GdkFontPeer.java @@ -78,7 +78,7 @@ public class GdkFontPeer extends ClasspathFontPeer { public GdkFontMetrics (Font font) - { + { super(initFont(font)); } @@ -167,7 +167,7 @@ public class GdkFontPeer extends ClasspathFontPeer GdkFontMetrics metrics; - static + static { if (Configuration.INIT_LOAD_LIBRARY) { @@ -204,7 +204,7 @@ public class GdkFontPeer extends ClasspathFontPeer dispose (); } - /* + /* * Helpers for the 3-way overloading that this class seems to suffer * from. Remove them if you feel like they're a performance bottleneck, * for the time being I prefer my code not be written and debugged in @@ -214,7 +214,7 @@ public class GdkFontPeer extends ClasspathFontPeer private String buildString(CharacterIterator iter) { CPStringBuilder sb = new CPStringBuilder(); - for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) + for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) sb.append(c); return sb.toString(); } @@ -223,7 +223,7 @@ public class GdkFontPeer extends ClasspathFontPeer { CPStringBuilder sb = new CPStringBuilder(); int i = 0; - for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next(), i++) + for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next(), i++) { if (begin <= i) sb.append(c); @@ -232,7 +232,7 @@ public class GdkFontPeer extends ClasspathFontPeer } return sb.toString(); } - + private String buildString(char[] chars, int begin, int limit) { return new String(chars, begin, limit - begin); @@ -247,8 +247,8 @@ public class GdkFontPeer extends ClasspathFontPeer } public GdkFontPeer (String name, int style, int size) - { - super(name, style, size); + { + super(name, style, size); initState (); setFont (this.familyName, this.style, (int)this.size); metricsCache = new HashMap<Integer,GlyphMetrics>(); @@ -299,14 +299,14 @@ public class GdkFontPeer extends ClasspathFontPeer /** * Unneeded, but implemented anyway. - */ + */ public String getSubFamilyName(Font font, Locale locale) { String name; - + if (locale == null) locale = Locale.getDefault(); - + name = getName(NameDecoder.NAME_SUBFAMILY, locale); if (name == null) { @@ -322,20 +322,20 @@ public class GdkFontPeer extends ClasspathFontPeer * Returns the bytes belonging to a TrueType/OpenType table, * Parameters n,a,m,e identify the 4-byte ASCII tag of the table. * - * Returns null if the font is not TT, the table is nonexistant, + * Returns null if the font is not TT, the table is nonexistant, * or if some other unexpected error occured. * */ private native byte[] getTrueTypeTable(byte n, byte a, byte m, byte e); /** - * Returns the PostScript name of the font, defaults to the familyName if + * Returns the PostScript name of the font, defaults to the familyName if * a PS name could not be retrieved. */ public String getPostScriptName(Font font) { - String name = getName(NameDecoder.NAME_POSTSCRIPT, - /* any language */ null); + String name = getName(NameDecoder.NAME_POSTSCRIPT, + /* any language */ null); if( name == null ) return this.familyName; @@ -356,7 +356,7 @@ public class GdkFontPeer extends ClasspathFontPeer { if (nameTable == null) { - byte[] data = getTrueTypeTable((byte)'n', (byte) 'a', + byte[] data = getTrueTypeTable((byte)'n', (byte) 'a', (byte) 'm', (byte) 'e'); if( data == null ) return null; @@ -378,16 +378,16 @@ public class GdkFontPeer extends ClasspathFontPeer // FIXME: inquire with pango return -1; } - - public GlyphVector createGlyphVector (Font font, - FontRenderContext ctx, + + public GlyphVector createGlyphVector (Font font, + FontRenderContext ctx, CharacterIterator i) { return new FreetypeGlyphVector(font, buildString (i), ctx); } - public GlyphVector createGlyphVector (Font font, - FontRenderContext ctx, + public GlyphVector createGlyphVector (Font font, + FontRenderContext ctx, int[] glyphCodes) { return new FreetypeGlyphVector(font, glyphCodes, ctx); @@ -411,32 +411,32 @@ public class GdkFontPeer extends ClasspathFontPeer { return ascent; } - + public int getBaselineIndex() - { + { // FIXME return Font.ROMAN_BASELINE; } - + public float[] getBaselineOffsets() { return new float[3]; } - + public float getDescent() { return descent; } - + public float getHeight() { return height; } - + public float getLeading() { return height - (ascent + descent); - } + } public int getNumChars() { @@ -447,13 +447,13 @@ public class GdkFontPeer extends ClasspathFontPeer { // FreeType doesn't seem to provide a value here. return ascent / 2; - } + } public float getStrikethroughThickness() { // FreeType doesn't seem to provide a value here. return 1.f; - } + } public float getUnderlineOffset() { @@ -467,7 +467,7 @@ public class GdkFontPeer extends ClasspathFontPeer } - public LineMetrics getLineMetrics (Font font, CharacterIterator ci, + public LineMetrics getLineMetrics (Font font, CharacterIterator ci, int begin, int limit, FontRenderContext rc) { return new GdkFontLineMetrics (this, limit - begin); @@ -490,12 +490,12 @@ public class GdkFontPeer extends ClasspathFontPeer public int getNumGlyphs (Font font) { - byte[] data = getTrueTypeTable((byte)'m', (byte) 'a', - (byte)'x', (byte) 'p'); + byte[] data = getTrueTypeTable((byte)'m', (byte) 'a', + (byte)'x', (byte) 'p'); if( data == null ) return -1; - ByteBuffer buf = ByteBuffer.wrap( data ); + ByteBuffer buf = ByteBuffer.wrap( data ); return buf.getShort(4); } @@ -504,15 +504,15 @@ public class GdkFontPeer extends ClasspathFontPeer return true; } - public GlyphVector layoutGlyphVector (Font font, FontRenderContext frc, - char[] chars, int start, int limit, + public GlyphVector layoutGlyphVector (Font font, FontRenderContext frc, + char[] chars, int start, int limit, int flags) { return new FreetypeGlyphVector(font, chars, start, limit - start, frc, flags); } - public LineMetrics getLineMetrics (Font font, String str, + public LineMetrics getLineMetrics (Font font, String str, FontRenderContext frc) { return new GdkFontLineMetrics (this, str.length ()); @@ -536,7 +536,7 @@ public class GdkFontPeer extends ClasspathFontPeer /** * Put a GlyphMetrics object in the cache. - */ + */ void putGlyphMetrics( int glyphCode, GlyphMetrics metrics ) { metricsCache.put( new Integer( glyphCode ), metrics ); diff --git a/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java b/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java index 147f8f3e6..40474ff3b 100644 --- a/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java +++ b/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java @@ -51,21 +51,21 @@ import java.awt.image.ColorModel; import java.awt.image.DirectColorModel; import java.awt.image.VolatileImage; -public class GdkGraphicsConfiguration +public class GdkGraphicsConfiguration extends GraphicsConfiguration { GdkScreenGraphicsDevice gdkScreenGraphicsDevice; - + ColorModel opaqueColorModel; ColorModel bitmaskColorModel; ColorModel translucentColorModel; - + public GdkGraphicsConfiguration(GdkScreenGraphicsDevice dev) { gdkScreenGraphicsDevice = dev; - + opaqueColorModel = new DirectColorModel(32, 0xFF0000, 0xFF00, 0xFF, 0); bitmaskColorModel = new DirectColorModel(32, 0xFF0000, 0xFF00, 0xFF, 0x1000000); translucentColorModel = new DirectColorModel(32, 0xFF0000, 0xFF00, 0xFF, 0xFF000000); @@ -81,7 +81,7 @@ public class GdkGraphicsConfiguration return new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); } - public BufferedImage createCompatibleImage(int w, int h, + public BufferedImage createCompatibleImage(int w, int h, int transparency) { return createCompatibleImage(w, h); @@ -137,7 +137,7 @@ public class GdkGraphicsConfiguration public BufferCapabilities getBufferCapabilities() { - return new BufferCapabilities(getImageCapabilities(), + return new BufferCapabilities(getImageCapabilities(), getImageCapabilities(), BufferCapabilities.FlipContents.UNDEFINED); } diff --git a/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java b/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java index 980866c4b..f9695e43d 100644 --- a/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java +++ b/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java @@ -58,9 +58,9 @@ import gnu.classpath.Pointer; public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment { private final int native_state = GtkGenericPeer.getUniqueInteger (); - + private GdkScreenGraphicsDevice defaultDevice; - + private GdkScreenGraphicsDevice[] devices; /** @@ -81,14 +81,14 @@ public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment GtkToolkit.initializeGlobalIDs(); initIDs(); } - + private static native void initIDs(); - + public GdkGraphicsEnvironment () { nativeInitState(); } - + native void nativeInitState(); public GraphicsDevice[] getScreenDevices () @@ -97,17 +97,17 @@ public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment { devices = nativeGetScreenDevices(); } - + return (GraphicsDevice[]) devices.clone(); } - + private native GdkScreenGraphicsDevice[] nativeGetScreenDevices(); public GraphicsDevice getDefaultScreenDevice () { if (GraphicsEnvironment.isHeadless ()) throw new HeadlessException (); - + synchronized (GdkGraphicsEnvironment.class) { if (defaultDevice == null) @@ -115,10 +115,10 @@ public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment defaultDevice = nativeGetDefaultScreenDevice(); } } - + return defaultDevice; } - + private native GdkScreenGraphicsDevice nativeGetDefaultScreenDevice(); public Graphics2D createGraphics (BufferedImage image) @@ -129,7 +129,7 @@ public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment return new BufferedImageGraphics( image ); } - + private native int nativeGetNumFontFamilies(); private native void nativeGetFontFamilies(String[] family_names); @@ -157,10 +157,10 @@ public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment /** * Used by GtkMouseInfoPeer. - */ + */ native int[] getMouseCoordinates(); native boolean isWindowUnderMouse(GtkWindowPeer windowPeer); - + public WritableRaster createRaster(ColorModel cm, SampleModel sm) { if (CairoSurface.isCompatibleSampleModel(sm) diff --git a/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java b/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java index dbf4a2018..3dd597bca 100644 --- a/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java +++ b/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java @@ -73,7 +73,7 @@ import gnu.classpath.Pointer; public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder { - static + static { if (Configuration.INIT_LOAD_LIBRARY) { @@ -82,7 +82,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder initStaticState (); } - + /** * Lock that should be held for all gdkpixbuf operations. We don't use * the global gdk_threads_enter/leave functions since gdkpixbuf @@ -124,9 +124,9 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder boolean hasAlpha, GdkPixbufWriter writer); // gdk-pixbuf provids data in RGBA format - static final ColorModel cm = new DirectColorModel (32, 0xff000000, - 0x00ff0000, - 0x0000ff00, + static final ColorModel cm = new DirectColorModel (32, 0xff000000, + 0x00ff0000, + 0x0000ff00, 0x000000ff); public GdkPixbufDecoder (DataInput datainput) { @@ -142,7 +142,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder { super (filename); } - + public GdkPixbufDecoder (URL url) { super (url); @@ -168,21 +168,21 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder ic.setHints (ImageConsumer.RANDOMPIXELORDER); } } - + // called back by native side: area_updated_cb - void areaUpdated (int x, int y, int width, int height, + void areaUpdated (int x, int y, int width, int height, int pixels[], int scansize) { if (curr == null) return; - + for (int i = 0; i < curr.size (); i++) { ImageConsumer ic = (ImageConsumer) curr.elementAt (i); ic.setPixels (x, y, width, height, cm, pixels, 0, scansize); } } - + // called from an async image loader of one sort or another, this method // repeatedly reads bytes from the input stream and passes them through a // GdkPixbufLoader using the native method pumpBytes. pumpBytes in turn @@ -217,7 +217,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder } needsClose = false; - + for (int i = 0; i < curr.size (); i++) { ImageConsumer ic = (ImageConsumer) curr.elementAt (i); @@ -239,7 +239,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder public static class ImageFormatSpec { public String name; - public boolean writable = false; + public boolean writable = false; public ArrayList<String> mimeTypes = new ArrayList<String>(); public ArrayList<String> extensions = new ArrayList<String>(); @@ -257,12 +257,12 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder public synchronized void addExtension(String e) { extensions.add(e); - } + } } static ArrayList<ImageFormatSpec> imageFormatSpecs; - public static ImageFormatSpec registerFormat(String name, boolean writable) + public static ImageFormatSpec registerFormat(String name, boolean writable) { ImageFormatSpec ifs = new ImageFormatSpec(name, writable); synchronized(GdkPixbufDecoder.class) @@ -277,7 +277,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder static String[] getFormatNames(boolean writable) { ArrayList<String> names = new ArrayList<String>(); - synchronized (imageFormatSpecs) + synchronized (imageFormatSpecs) { Iterator<ImageFormatSpec> i = imageFormatSpecs.iterator(); while (i.hasNext()) @@ -287,10 +287,10 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder continue; names.add(ifs.name); - /* + /* * In order to make the filtering code work, we need to register * this type under every "format name" likely to be used as a synonym. - * This generally means "all the extensions people might use". + * This generally means "all the extensions people might use". */ Iterator<String> j = ifs.extensions.iterator(); @@ -304,7 +304,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder static String[] getFormatExtensions(boolean writable) { ArrayList<String> extensions = new ArrayList<String>(); - synchronized (imageFormatSpecs) + synchronized (imageFormatSpecs) { Iterator<ImageFormatSpec> i = imageFormatSpecs.iterator(); while (i.hasNext()) @@ -323,7 +323,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder static String[] getFormatMimeTypes(boolean writable) { ArrayList<String> mimeTypes = new ArrayList<String>(); - synchronized (imageFormatSpecs) + synchronized (imageFormatSpecs) { Iterator<ImageFormatSpec> i = imageFormatSpecs.iterator(); while (i.hasNext()) @@ -339,7 +339,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder return mimeTypes.toArray(new String[mimeTypes.size()]); } - + static String findFormatName(Object ext, boolean needWritable) { if (ext == null) @@ -361,7 +361,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder if (ifs.name.equals(str)) return str; - Iterator<String> j = ifs.extensions.iterator(); + Iterator<String> j = ifs.extensions.iterator(); while (j.hasNext()) { String extension = j.next(); @@ -369,14 +369,14 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder return ifs.name; } - j = ifs.mimeTypes.iterator(); + j = ifs.mimeTypes.iterator(); while (j.hasNext()) { String mimeType = j.next(); if (mimeType.equals(str)) return ifs.name; } - } + } throw new IllegalArgumentException("unknown extension '" + str + "'"); } @@ -397,7 +397,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder return writerSpi; } - public static void registerSpis(IIORegistry reg) + public static void registerSpis(IIORegistry reg) { reg.registerServiceProvider(getReaderSpi(), ImageReaderSpi.class); reg.registerServiceProvider(getWriterSpi(), ImageWriterSpi.class); @@ -405,11 +405,11 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder public static class GdkPixbufWriterSpi extends ImageWriterSpi { - public GdkPixbufWriterSpi() - { + public GdkPixbufWriterSpi() + { super("GdkPixbuf", "2.x", - GdkPixbufDecoder.getFormatNames(true), - GdkPixbufDecoder.getFormatExtensions(true), + GdkPixbufDecoder.getFormatNames(true), + GdkPixbufDecoder.getFormatExtensions(true), GdkPixbufDecoder.getFormatMimeTypes(true), "gnu.java.awt.peer.gtk.GdkPixbufDecoder$GdkPixbufWriter", new Class[] { ImageOutputStream.class }, @@ -437,11 +437,11 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder public static class GdkPixbufReaderSpi extends ImageReaderSpi { - public GdkPixbufReaderSpi() - { + public GdkPixbufReaderSpi() + { super("GdkPixbuf", "2.x", - GdkPixbufDecoder.getFormatNames(false), - GdkPixbufDecoder.getFormatExtensions(false), + GdkPixbufDecoder.getFormatNames(false), + GdkPixbufDecoder.getFormatExtensions(false), GdkPixbufDecoder.getFormatMimeTypes(false), "gnu.java.awt.peer.gtk.GdkPixbufDecoder$GdkPixbufReader", new Class[] { ImageInputStream.class }, @@ -450,9 +450,9 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder false, null, null, null, null); } - public boolean canDecodeInput(Object obj) - { - return true; + public boolean canDecodeInput(Object obj) + { + return true; } public ImageReader createReaderInstance(Object ext) @@ -489,7 +489,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder return null; } - public IIOMetadata getDefaultImageMetadata (ImageTypeSpecifier imageType, + public IIOMetadata getDefaultImageMetadata (ImageTypeSpecifier imageType, ImageWriteParam param) { return null; @@ -509,7 +509,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder int height = ras.getHeight(); ColorModel model = image.getColorModel(); int[] pixels = CairoGraphics2D.findSimpleIntegerArray (image.getColorModel(), ras); - + if (pixels == null) { BufferedImage img; @@ -520,7 +520,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder for (int y = 0; y < height; ++y) for (int x = 0; x < width; ++x) img.setRGB(x, y, model.getRGB(ras.getPixel(x, y, pix))); - pixels = CairoGraphics2D.findSimpleIntegerArray (img.getColorModel(), + pixels = CairoGraphics2D.findSimpleIntegerArray (img.getColorModel(), img.getRaster()); model = img.getColorModel(); } @@ -530,7 +530,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder processImageStarted(1); synchronized(pixbufLock) { - streamImage(pixels, this.ext, width, height, model.hasAlpha(), + streamImage(pixels, this.ext, width, height, model.hasAlpha(), this); } synchronized(data) @@ -555,7 +555,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder throw exception; processImageComplete(); - } + } /** * Object marking end of data from native streamImage code. @@ -627,7 +627,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder } } - private static class GdkPixbufReader + private static class GdkPixbufReader extends ImageReader implements ImageConsumer { @@ -638,7 +638,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder int width; int height; String ext; - + public GdkPixbufReader(GdkPixbufReaderSpi ownerSpi, Object ext) { super(ownerSpi); @@ -658,29 +658,29 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder width = w; height = h; } - + public void setProperties(Hashtable props) {} - public void setColorModel(ColorModel model) + public void setColorModel(ColorModel model) { defaultModel = model; } public void setHints(int flags) {} - public void setPixels(int x, int y, int w, int h, - ColorModel model, byte[] pixels, + public void setPixels(int x, int y, int w, int h, + ColorModel model, byte[] pixels, int offset, int scansize) { - } + } - public void setPixels(int x, int y, int w, int h, - ColorModel model, int[] pixels, + public void setPixels(int x, int y, int w, int h, + ColorModel model, int[] pixels, int offset, int scansize) { if (model == null) model = defaultModel; - + if (bufferedImage == null) { if(model != null && model.hasAlpha()) @@ -709,7 +709,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder processImageProgress(y / (height == 0 ? 1 : height)); } - public void imageComplete(int status) + public void imageComplete(int status) { processImageComplete(); } @@ -729,7 +729,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder return 1; } - public IIOMetadata getImageMetadata(int i) + public IIOMetadata getImageMetadata(int i) { return null; } @@ -748,7 +748,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder vec.add(new ImageTypeSpecifier(img)); return vec.iterator(); } - + public int getHeight(int imageIndex) throws IOException { diff --git a/gnu/java/awt/peer/gtk/GdkRobotPeer.java b/gnu/java/awt/peer/gtk/GdkRobotPeer.java index d3e9774da..2609bad09 100644 --- a/gnu/java/awt/peer/gtk/GdkRobotPeer.java +++ b/gnu/java/awt/peer/gtk/GdkRobotPeer.java @@ -53,9 +53,9 @@ public class GdkRobotPeer implements RobotPeer { // gdk-pixbuf provides data in RGBA format static final ColorModel cm = new DirectColorModel (32, 0xff000000, - 0x00ff0000, - 0x0000ff00, - 0x000000ff); + 0x00ff0000, + 0x0000ff00, + 0x000000ff); public GdkRobotPeer (GraphicsDevice screen) throws AWTException { diff --git a/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java b/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java index 9ce0b96da..b8bce4247 100644 --- a/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java +++ b/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java @@ -52,28 +52,28 @@ import gnu.classpath.Pointer; class GdkScreenGraphicsDevice extends GraphicsDevice { private final int native_state = GtkGenericPeer.getUniqueInteger (); - + private Window fullscreenWindow; - + private boolean oldWindowDecorationState; - + private Rectangle oldWindowBounds; - + private Rectangle bounds; - + private GdkGraphicsConfiguration[] configurations; - + /** The <code>GdkGraphicsEnvironment</code> instance that created this * <code>GdkScreenGraphicsDevice</code>. This is only needed for native * methods which need to access the 'native_state' field storing a pointer * to a GdkDisplay object. - */ + */ GdkGraphicsEnvironment env; - + /** An identifier that is created by Gdk */ String idString; - + /** The display modes supported by this <code>GdkScreenGraphicsDevice</code>. * If the array is <code>null</code> <code>nativeGetDisplayModes</code> has * to be called. @@ -85,7 +85,7 @@ class GdkScreenGraphicsDevice extends GraphicsDevice * is still <code>null</code> afterwards, the XRandR extension is available * and display mode changes are possible. If it is non-null XRandR is not * available, no display mode changes are possible and no other native - * method must be called. + * method must be called. */ DisplayMode fixedDisplayMode; @@ -107,14 +107,14 @@ class GdkScreenGraphicsDevice extends GraphicsDevice GtkToolkit.initializeGlobalIDs(); initIDs(); } - + static native void initIDs(); - + GdkScreenGraphicsDevice (GdkGraphicsEnvironment e) { super(); env = e; - + configurations = new GdkGraphicsConfiguration[1]; configurations[0] = new GdkGraphicsConfiguration(this); } @@ -126,13 +126,13 @@ class GdkScreenGraphicsDevice extends GraphicsDevice { fixedDisplayMode = nativeGetFixedDisplayMode(env); } - + /** Depending on the availability of the XRandR extension the method returns * the screens' non-changeable display mode or null, meaning that XRandR can * handle display mode changes. */ native DisplayMode nativeGetFixedDisplayMode(GdkGraphicsEnvironment env); - + public int getType () { // Gdk manages only raster screens. @@ -143,17 +143,17 @@ class GdkScreenGraphicsDevice extends GraphicsDevice { if (idString == null) idString = nativeGetIDString(); - + return idString; } - - private native String nativeGetIDString(); + + private native String nativeGetIDString(); public GraphicsConfiguration[] getConfigurations () { return (GraphicsConfiguration[]) configurations.clone(); } - + public GraphicsConfiguration getDefaultConfiguration () { return configurations[0]; @@ -172,7 +172,7 @@ class GdkScreenGraphicsDevice extends GraphicsDevice { if (fixedDisplayMode != null) return fixedDisplayMode; - + synchronized (this) { if (displayModes == null) @@ -181,28 +181,28 @@ class GdkScreenGraphicsDevice extends GraphicsDevice int index = nativeGetDisplayModeIndex(env); int rate = nativeGetDisplayModeRate(env); - + return new DisplayMode(displayModes[index].width, displayModes[index].height, DisplayMode.BIT_DEPTH_MULTI, rate); } - + native int nativeGetDisplayModeIndex(GdkGraphicsEnvironment env); - + native int nativeGetDisplayModeRate(GdkGraphicsEnvironment env); - + public DisplayMode[] getDisplayModes() { if (fixedDisplayMode != null) return new DisplayMode[] { fixedDisplayMode }; - + synchronized (this) { if (displayModes == null) displayModes = nativeGetDisplayModes(env); } - + ArrayList<DisplayMode> list = new ArrayList<DisplayMode>(); for(int i=0;i<displayModes.length;i++) for(int j=0;j<displayModes[i].rates.length;j++) @@ -210,10 +210,10 @@ class GdkScreenGraphicsDevice extends GraphicsDevice displayModes[i].height, DisplayMode.BIT_DEPTH_MULTI, displayModes[i].rates[j])); - + return list.toArray(new DisplayMode[list.size()]); } - + native X11DisplayMode[] nativeGetDisplayModes(GdkGraphicsEnvironment env); /** @@ -226,7 +226,7 @@ class GdkScreenGraphicsDevice extends GraphicsDevice { return true; } - + public boolean isDisplayChangeSupported() { return fixedDisplayMode == null; @@ -236,16 +236,16 @@ class GdkScreenGraphicsDevice extends GraphicsDevice { if (fixedDisplayMode != null) throw new UnsupportedOperationException("Cannnot change display mode."); - + if (dm == null) throw new IllegalArgumentException("DisplayMode must not be null."); - + synchronized (this) { if (displayModes == null) displayModes = nativeGetDisplayModes(env); } - + for (int i=0; i<displayModes.length; i++) if (displayModes[i].width == dm.getWidth() && displayModes[i].height == dm.getHeight()) @@ -255,19 +255,19 @@ class GdkScreenGraphicsDevice extends GraphicsDevice nativeSetDisplayMode(env, i, (short) dm.getRefreshRate()); - + bounds = null; } - + return; } - + throw new IllegalArgumentException("Mode not supported by this device."); } - + native void nativeSetDisplayMode(GdkGraphicsEnvironment env, int index, short rate); - + /** A class that simply encapsulates the X11 display mode data. */ static class X11DisplayMode @@ -275,16 +275,16 @@ class GdkScreenGraphicsDevice extends GraphicsDevice short[] rates; int width; int height; - + X11DisplayMode(int width, int height, short[] rates) { this.width = width; this.height = height; this.rates = rates; } - + } - + public void setFullScreenWindow(Window w) { // Bring old fullscreen window back into its original state. @@ -293,7 +293,7 @@ class GdkScreenGraphicsDevice extends GraphicsDevice if (fullscreenWindow instanceof Frame) { // Decoration state can only be switched when the peer is - // non-existent. That means we have to dispose the + // non-existent. That means we have to dispose the // Frame. Frame f = (Frame) fullscreenWindow; if (oldWindowDecorationState != f.isUndecorated()) @@ -302,13 +302,13 @@ class GdkScreenGraphicsDevice extends GraphicsDevice f.setUndecorated(oldWindowDecorationState); } } - + fullscreenWindow.setBounds(oldWindowBounds); if (!fullscreenWindow.isVisible()) fullscreenWindow.setVisible(true); } - + // If applicable remove decoration, then maximize the window and // bring it to the foreground. if (w != null) @@ -323,27 +323,27 @@ class GdkScreenGraphicsDevice extends GraphicsDevice f.setUndecorated(true); } } - + oldWindowBounds = w.getBounds(); - + DisplayMode dm = getDisplayMode(); - + w.setBounds(0, 0, dm.getWidth(), dm.getHeight()); - + if (!w.isVisible()) w.setVisible(true); - + w.requestFocus(); w.toFront(); - + } - + fullscreenWindow = w; } - + public Window getFullScreenWindow() { - return fullscreenWindow; + return fullscreenWindow; } Rectangle getBounds() @@ -353,10 +353,10 @@ class GdkScreenGraphicsDevice extends GraphicsDevice if (bounds == null) bounds = nativeGetBounds(); } - + return bounds; } - + native Rectangle nativeGetBounds(); } diff --git a/gnu/java/awt/peer/gtk/GtkButtonPeer.java b/gnu/java/awt/peer/gtk/GtkButtonPeer.java index f18db7af9..6ff56c0f2 100644 --- a/gnu/java/awt/peer/gtk/GtkButtonPeer.java +++ b/gnu/java/awt/peer/gtk/GtkButtonPeer.java @@ -78,7 +78,7 @@ public class GtkButtonPeer extends GtkComponentPeer create (((Button) awtComponent).getLabel ()); } - public void setLabel (String label) + public void setLabel (String label) { gtkSetLabel(label); } @@ -86,8 +86,8 @@ public class GtkButtonPeer extends GtkComponentPeer void postActionEvent (int mods) { q().postEvent (new ActionEvent (awtWidget, - ActionEvent.ACTION_PERFORMED, - ((Button) awtComponent).getActionCommand (), - mods)); + ActionEvent.ACTION_PERFORMED, + ((Button) awtComponent).getActionCommand (), + mods)); } } diff --git a/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java b/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java index 4a41d0696..6321bc64d 100644 --- a/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java +++ b/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java @@ -66,7 +66,7 @@ public class GtkCheckboxPeer extends GtkComponentPeer public native void addToGroup (long groupPointer); public native void removeFromGroup (); public native void switchToGroup (long groupPointer); - + public native void connectSignals (); /** @@ -101,7 +101,7 @@ public class GtkCheckboxPeer extends GtkComponentPeer { groupPointer = groupMap.get(current_group); } - + if (groupPointer == null) { // We don't know about this group. Create a new native @@ -118,7 +118,7 @@ public class GtkCheckboxPeer extends GtkComponentPeer } currentState = checkbox.getState(); gtkToggleButtonSetActive(currentState); - + String label = checkbox.getLabel(); if (label != null) gtkButtonSetLabel(label); @@ -161,7 +161,7 @@ public class GtkCheckboxPeer extends GtkComponentPeer { groupPointer = groupMap.get(current_group); } - + if (groupPointer == null) { // We don't know about this group. Create a new native @@ -199,14 +199,14 @@ public class GtkCheckboxPeer extends GtkComponentPeer // to the other group. current_group = group; - + // See if the new group is already stored in our map. Long groupPointer = null; synchronized (groupMap) { groupPointer = groupMap.get(current_group); } - + if (groupPointer == null) { // We don't know about this group. Create a new native @@ -236,7 +236,7 @@ public class GtkCheckboxPeer extends GtkComponentPeer state ? ItemEvent.SELECTED : ItemEvent.DESELECTED); } } - + public void addToGroupMap(long groupPointer) { synchronized (groupMap) diff --git a/gnu/java/awt/peer/gtk/GtkChoicePeer.java b/gnu/java/awt/peer/gtk/GtkChoicePeer.java index ff061d35c..59cacf0b6 100644 --- a/gnu/java/awt/peer/gtk/GtkChoicePeer.java +++ b/gnu/java/awt/peer/gtk/GtkChoicePeer.java @@ -47,7 +47,7 @@ public class GtkChoicePeer extends GtkComponentPeer implements ChoicePeer { private int selected; - + public GtkChoicePeer (Choice c) { super (c); @@ -95,7 +95,7 @@ public class GtkChoicePeer extends GtkComponentPeer // Ensure the triggering of an event when removing item zero if zero is the // selected item, even though the selected index doesn't change. if( index == 0 && selected == 0 ) - selected = -1; + selected = -1; nativeRemove( index ); } @@ -104,14 +104,14 @@ public class GtkChoicePeer extends GtkComponentPeer selected = -1; // we do not want to trigger a select event here. nativeRemoveAll(); } - + public void addItem (String item, int position) { add (item, position); } /** - * Callback from the native side on an item-select event, + * Callback from the native side on an item-select event, * which posts an event. The event is only posted if it represents an actual * change. Selected is set to the peer's state initially, so that the * first call to select(int) from the constructor will not trigger an event. @@ -122,7 +122,7 @@ public class GtkChoicePeer extends GtkComponentPeer if( selected != index ) { selected = index; - postItemEvent (((Choice) awtComponent).getItem( selected ), + postItemEvent (((Choice) awtComponent).getItem( selected ), ItemEvent.SELECTED); } } @@ -140,4 +140,3 @@ public class GtkChoicePeer extends GtkComponentPeer ((Choice)awtComponent).select( selected ); } } - diff --git a/gnu/java/awt/peer/gtk/GtkClipboard.java b/gnu/java/awt/peer/gtk/GtkClipboard.java index e248b6daf..4250cabaa 100644 --- a/gnu/java/awt/peer/gtk/GtkClipboard.java +++ b/gnu/java/awt/peer/gtk/GtkClipboard.java @@ -149,7 +149,7 @@ public class GtkClipboard extends Clipboard * gtk+ clipboard. */ public synchronized void setContents(Transferable contents, - ClipboardOwner owner) + ClipboardOwner owner) { super.setContents(contents, owner); @@ -224,7 +224,7 @@ public class GtkClipboard extends Clipboard boolean text, boolean images, boolean files); - + /** * Called by the gtk+ clipboard when an application has requested * text. Return a string representing the current clipboard diff --git a/gnu/java/awt/peer/gtk/GtkComponentPeer.java b/gnu/java/awt/peer/gtk/GtkComponentPeer.java index 76fefaaa5..04643c2c8 100644 --- a/gnu/java/awt/peer/gtk/GtkComponentPeer.java +++ b/gnu/java/awt/peer/gtk/GtkComponentPeer.java @@ -96,7 +96,7 @@ public class GtkComponentPeer extends GtkGenericPeer private Rectangle currentPaintArea; /* this isEnabled differs from Component.isEnabled, in that it - knows if a parent is disabled. In that case Component.isEnabled + knows if a parent is disabled. In that case Component.isEnabled may return true, but our isEnabled will always return false */ native boolean isEnabled (); static native boolean modalHasGrab(); @@ -207,13 +207,13 @@ public class GtkComponentPeer extends GtkGenericPeer setEnabled (awtComponent.isEnabled ()); } - public int checkImage (Image image, int width, int height, - ImageObserver observer) + public int checkImage (Image image, int width, int height, + ImageObserver observer) { return getToolkit().checkImage(image, width, height, observer); } - public Image createImage (ImageProducer producer) + public Image createImage (ImageProducer producer) { return new GtkImage (producer); } @@ -223,17 +223,17 @@ public class GtkComponentPeer extends GtkGenericPeer return CairoSurface.getBufferedImage(width, height); } - public void disable () + public void disable () { setEnabled (false); } - public void enable () + public void enable () { setEnabled (true); } - public ColorModel getColorModel () + public ColorModel getColorModel () { return ColorModel.getRGBdefault (); } @@ -250,8 +250,8 @@ public class GtkComponentPeer extends GtkGenericPeer return ComponentGraphics.getComponentGraphics(this); } - public Point getLocationOnScreen () - { + public Point getLocationOnScreen () + { int point[] = new int[2]; if (Thread.currentThread() == GtkMainThread.mainThread) gtkWidgetGetLocationOnScreenUnlocked (point); @@ -260,7 +260,7 @@ public class GtkComponentPeer extends GtkGenericPeer return new Point (point[0], point[1]); } - public Dimension getMinimumSize () + public Dimension getMinimumSize () { return minimumSize (); } @@ -274,7 +274,7 @@ public class GtkComponentPeer extends GtkGenericPeer { return Toolkit.getDefaultToolkit(); } - + public void handleEvent (AWTEvent event) { int id = event.getID(); @@ -376,12 +376,12 @@ public class GtkComponentPeer extends GtkGenericPeer } } - public boolean isFocusTraversable () + public boolean isFocusTraversable () { return true; } - public Dimension minimumSize () + public Dimension minimumSize () { int dim[] = new int[2]; @@ -404,12 +404,12 @@ public class GtkComponentPeer extends GtkGenericPeer } public boolean prepareImage (Image image, int width, int height, - ImageObserver observer) + ImageObserver observer) { return getToolkit().prepareImage(image, width, height, observer); } - public void print (Graphics g) + public void print (Graphics g) { g.drawImage( ComponentGraphics.grab( this ), 0, 0, null ); } @@ -421,7 +421,7 @@ public class GtkComponentPeer extends GtkGenericPeer if (tm <= 0) q().postEvent(new PaintEvent(awtComponent, PaintEvent.UPDATE, - new Rectangle(x, y, width, height))); + new Rectangle(x, y, width, height))); else RepaintTimerTask.schedule(tm, x, y, width, height, awtComponent); } @@ -452,7 +452,7 @@ public class GtkComponentPeer extends GtkGenericPeer } static void schedule(long tm, int x, int y, int width, int height, - Component c) + Component c) { repaintTimer.schedule(new RepaintTimerTask(c, x, y, width, height), tm); } @@ -463,12 +463,12 @@ public class GtkComponentPeer extends GtkGenericPeer assert false: "Call new requestFocus() method instead"; } - public void reshape (int x, int y, int width, int height) + public void reshape (int x, int y, int width, int height) { setBounds (x, y, width, height); } - public void setBackground (Color c) + public void setBackground (Color c) { gtkWidgetSetBackground (c.getRed(), c.getGreen(), c.getBlue()); } @@ -481,7 +481,7 @@ public class GtkComponentPeer extends GtkGenericPeer int new_y = y; Component parent = awtComponent.getParent (); - + // Heavyweight components that are children of one or more // lightweight containers have to be handled specially. Because // calls to GLightweightPeer.setBounds do nothing, GTK has no @@ -492,14 +492,14 @@ public class GtkComponentPeer extends GtkGenericPeer // so we need to continue adding offsets until we reach a // container whose position GTK knows -- that is, the first // non-lightweight. - Insets i; + Insets i; while (parent.isLightweight()) { i = ((Container) parent).getInsets(); - + new_x += parent.getX() + i.left; new_y += parent.getY() + i.top; - + parent = parent.getParent(); } // We only need to convert from Java to GTK coordinates if we're @@ -516,7 +516,7 @@ public class GtkComponentPeer extends GtkGenericPeer int menuBarHeight = 0; if (peer instanceof GtkFramePeer) menuBarHeight = ((GtkFramePeer) peer).getMenuBarHeight (); - + new_x -= insets.left; new_y -= insets.top; new_y += menuBarHeight; @@ -534,7 +534,7 @@ public class GtkComponentPeer extends GtkGenericPeer setCursor (awtComponent.getCursor ()); } - public void setCursor (Cursor cursor) + public void setCursor (Cursor cursor) { int x, y; GtkImage image; @@ -573,7 +573,7 @@ public class GtkComponentPeer extends GtkGenericPeer gtkWidgetModifyFont(f.getName(), f.getStyle(), f.getSize()); } - public void setForeground (Color c) + public void setForeground (Color c) { gtkWidgetSetForeground (c.getRed(), c.getGreen(), c.getBlue()); } @@ -619,7 +619,7 @@ public class GtkComponentPeer extends GtkGenericPeer } protected void postMouseEvent(int id, long when, int mods, int x, int y, - int clickCount, boolean popupTrigger) + int clickCount, boolean popupTrigger) { // It is important to do the getLocationOnScreen() here, instead // of using the old MouseEvent constructors, because @@ -638,7 +638,7 @@ public class GtkComponentPeer extends GtkGenericPeer protected void postMouseWheelEvent(int id, long when, int mods, int x, int y, int clickCount, boolean popupTrigger, - int type, int amount, int rotation) + int type, int amount, int rotation) { q().postEvent(new MouseWheelEvent(awtComponent, id, when, mods, x, y, clickCount, popupTrigger, @@ -693,7 +693,7 @@ public class GtkComponentPeer extends GtkGenericPeer protected void postItemEvent (Object item, int stateChange) { - q().postEvent (new ItemEvent ((ItemSelectable)awtComponent, + q().postEvent (new ItemEvent ((ItemSelectable)awtComponent, ItemEvent.ITEM_STATE_CHANGED, item, stateChange)); } @@ -721,7 +721,7 @@ public class GtkComponentPeer extends GtkGenericPeer return false; } - public boolean requestFocus (Component request, boolean temporary, + public boolean requestFocus (Component request, boolean temporary, boolean allowWindowFocus, long time) { assert request == awtComponent || isLightweightDescendant(request); @@ -841,7 +841,7 @@ public class GtkComponentPeer extends GtkGenericPeer caps.getBackBufferCapabilities()); else throw new AWTException("GtkComponentPeer.createBuffers:" - + " multi-buffering not supported"); + + " multi-buffering not supported"); this.caps = caps; } @@ -861,13 +861,13 @@ public class GtkComponentPeer extends GtkGenericPeer // create new back buffer and clear it to the background color. if (contents == BufferCapabilities.FlipContents.BACKGROUND) - { - backBuffer = createVolatileImage(awtComponent.getWidth(), - awtComponent.getHeight()); - backBuffer.getGraphics().clearRect(0, 0, - awtComponent.getWidth(), - awtComponent.getHeight()); - } + { + backBuffer = createVolatileImage(awtComponent.getWidth(), + awtComponent.getHeight()); + backBuffer.getGraphics().clearRect(0, 0, + awtComponent.getWidth(), + awtComponent.getHeight()); + } // FIXME: support BufferCapabilities.FlipContents.PRIOR } @@ -876,7 +876,7 @@ public class GtkComponentPeer extends GtkGenericPeer { backBuffer.flush(); } - + public String toString () { return "peer of " + awtComponent.toString(); @@ -889,13 +889,13 @@ public class GtkComponentPeer extends GtkGenericPeer public void reparent(ContainerPeer parent) { // FIXME: implement - + } public void setBounds(int x, int y, int width, int height, int z) { // FIXME: implement setBounds (x, y, width, height); - + } public boolean isReparentSupported() { @@ -906,7 +906,7 @@ public class GtkComponentPeer extends GtkGenericPeer public void layout() { // FIXME: implement - + } public boolean requestFocus(Component lightweightChild, boolean temporary, diff --git a/gnu/java/awt/peer/gtk/GtkContainerPeer.java b/gnu/java/awt/peer/gtk/GtkContainerPeer.java index 541de3d82..b7eacb9f6 100644 --- a/gnu/java/awt/peer/gtk/GtkContainerPeer.java +++ b/gnu/java/awt/peer/gtk/GtkContainerPeer.java @@ -64,12 +64,12 @@ public class GtkContainerPeer extends GtkComponentPeer { } - public Insets getInsets() + public Insets getInsets() { return insets; } - public Insets insets() + public Insets insets() { return getInsets (); } @@ -103,7 +103,7 @@ public class GtkContainerPeer extends GtkComponentPeer public void setBackground (Color c) { super.setBackground(c); - + Object components[] = ((Container) awtComponent).getComponents(); for (int i = 0; i < components.length; i++) { @@ -133,6 +133,6 @@ public class GtkContainerPeer extends GtkComponentPeer public void restack() { //FIXME: implement - + } } diff --git a/gnu/java/awt/peer/gtk/GtkCursor.java b/gnu/java/awt/peer/gtk/GtkCursor.java index eb9e713d0..e382d6331 100644 --- a/gnu/java/awt/peer/gtk/GtkCursor.java +++ b/gnu/java/awt/peer/gtk/GtkCursor.java @@ -64,7 +64,7 @@ public class GtkCursor extends Cursor { return image; } - + Point getHotspot() { return hotspot; diff --git a/gnu/java/awt/peer/gtk/GtkDialogPeer.java b/gnu/java/awt/peer/gtk/GtkDialogPeer.java index 13906544d..3393eb9d0 100644 --- a/gnu/java/awt/peer/gtk/GtkDialogPeer.java +++ b/gnu/java/awt/peer/gtk/GtkDialogPeer.java @@ -52,7 +52,7 @@ public class GtkDialogPeer extends GtkWindowPeer void create () { Dialog dialog = (Dialog) awtComponent; - + // Create a decorated dialog window. create (GDK_WINDOW_TYPE_HINT_DIALOG, !((Dialog) awtComponent).isUndecorated ()); diff --git a/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java b/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java index 7d5ef91de..cddc530fd 100644 --- a/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java +++ b/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java @@ -48,7 +48,7 @@ import java.io.FilenameFilter; public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer { static final String FS = System.getProperty("file.separator"); - + private String currentFile = null; private String currentDirectory = null; private FilenameFilter filter; @@ -66,7 +66,7 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer ((FileDialog) awtComponent).getMode()); FileDialog fd = (FileDialog) awtComponent; - + nativeSetDirectory(System.getProperty("user.dir")); setDirectory(fd.getDirectory()); setFile(fd.getFile()); @@ -136,7 +136,7 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer nativeSetDirectory(FS); return; } - + // GtkFileChooser requires absolute directory names. If the given directory // name is not absolute, construct it based on current directory if it is not // null. Otherwise, use FS. @@ -175,15 +175,15 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer // called back by native side: handle_response_cb // only called from the GTK thread - void gtkHideFileDialog () + void gtkHideFileDialog () { // hide calls back the peer's setVisible method, so locking is a // problem. ((Dialog) awtComponent).hide(); } - + // called back by native side: handle_response_cb - void gtkDisposeFileDialog () + void gtkDisposeFileDialog () { ((Dialog) awtComponent).dispose(); } diff --git a/gnu/java/awt/peer/gtk/GtkFramePeer.java b/gnu/java/awt/peer/gtk/GtkFramePeer.java index 87dbd5e0f..a36854ce0 100644 --- a/gnu/java/awt/peer/gtk/GtkFramePeer.java +++ b/gnu/java/awt/peer/gtk/GtkFramePeer.java @@ -130,8 +130,8 @@ public class GtkFramePeer extends GtkWindowPeer setMenuBarWidth (menuBar, menuBarWidth); super.setBounds(x, y, width, height + menuBarHeight); - } - + } + public void setResizable (boolean resizable) { // Call setSize; otherwise when resizable is changed from true to @@ -144,7 +144,7 @@ public class GtkFramePeer extends GtkWindowPeer } protected void postInsetsChangedEvent (int top, int left, - int bottom, int right) + int bottom, int right) { insets.top = top + menuBarHeight; insets.left = left; @@ -174,15 +174,15 @@ public class GtkFramePeer extends GtkWindowPeer native void nativeSetIconImage (GtkImage image); - public void setIconImage (Image image) + public void setIconImage (Image image) { if (image != null) { GtkImage gtkImage; if (image instanceof GtkImage) gtkImage = (GtkImage) image; - else - gtkImage = new GtkImage(image.getSource()); + else + gtkImage = new GtkImage(image.getSource()); if (gtkImage.isLoaded && ! gtkImage.errorLoading) nativeSetIconImage(gtkImage); @@ -236,7 +236,7 @@ public class GtkFramePeer extends GtkWindowPeer public void setBoundsPrivate(int x, int y, int width, int height) { // TODO Auto-generated method stub - + } public boolean requestWindowFocus() @@ -252,5 +252,3 @@ public class GtkFramePeer extends GtkWindowPeer } } - - diff --git a/gnu/java/awt/peer/gtk/GtkGenericPeer.java b/gnu/java/awt/peer/gtk/GtkGenericPeer.java index 8d63699ea..1b2c07b5d 100644 --- a/gnu/java/awt/peer/gtk/GtkGenericPeer.java +++ b/gnu/java/awt/peer/gtk/GtkGenericPeer.java @@ -109,10 +109,10 @@ public class GtkGenericPeer this.awtWidget = awtWidget; } - protected void postActionEvent (String command, int mods) + protected void postActionEvent (String command, int mods) { - q().postEvent (new ActionEvent (awtWidget, ActionEvent.ACTION_PERFORMED, - command, mods)); + q().postEvent (new ActionEvent (awtWidget, ActionEvent.ACTION_PERFORMED, + command, mods)); } // Return a unique integer for use in the native state mapping @@ -123,7 +123,7 @@ public class GtkGenericPeer // Let's assume this will never wrap. return next_native_state++; } - + /** * Helper method to set Font for Gtk Widget. */ diff --git a/gnu/java/awt/peer/gtk/GtkImage.java b/gnu/java/awt/peer/gtk/GtkImage.java index 719669eae..b0a5aa0b1 100644 --- a/gnu/java/awt/peer/gtk/GtkImage.java +++ b/gnu/java/awt/peer/gtk/GtkImage.java @@ -60,7 +60,7 @@ import gnu.classpath.Pointer; * A GdkPixbuf is 'on-screen' and the gdk cannot draw to it, * this is used for the other constructors (and other createImage methods), and * corresponds to the Image implementations returned by the Toolkit.createImage - * methods, and is basically immutable. + * methods, and is basically immutable. * * @author Sven de Marothy */ @@ -79,7 +79,7 @@ public class GtkImage extends Image boolean isLoaded; /** - * Pointer to the GdkPixbuf - + * Pointer to the GdkPixbuf - * don't change the name without changing the native code. */ Pointer pixbuf; @@ -102,7 +102,7 @@ public class GtkImage extends Image /* * The 32-bit AABBGGRR format the GDK uses. */ - static ColorModel nativeModel = new DirectColorModel(32, + static ColorModel nativeModel = new DirectColorModel(32, 0x000000FF, 0x0000FF00, 0x00FF0000, @@ -116,7 +116,7 @@ public class GtkImage extends Image /** * Lock that should be held for all gdkpixbuf operations. We don't use * the global gdk_threads_enter/leave functions in most places since - * most gdkpixbuf operations can be done in parallel to drawing and + * most gdkpixbuf operations can be done in parallel to drawing and * manipulating gtk widgets. */ static Object pixbufLock = new Object(); @@ -170,8 +170,8 @@ public class GtkImage extends Image /** * Constructs a GtkImage from an ImageProducer. Asynchronity is handled in - * the following manner: - * A GtkImageConsumer gets the image data, and calls setImage() when + * the following manner: + * A GtkImageConsumer gets the image data, and calls setImage() when * completely finished. The GtkImage is not considered loaded until the * GtkImageConsumer is completely finished. We go for all "all or nothing". */ @@ -215,7 +215,7 @@ public class GtkImage extends Image throw new IllegalArgumentException("Couldn't load image: " + filename); } - } + } catch(IOException e) { IllegalArgumentException iae; @@ -269,7 +269,7 @@ public class GtkImage extends Image int n = 0; while ((n = bis.read(buf)) != -1) - baos.write(buf, 0, n); + baos.write(buf, 0, n); bis.close(); } catch(IOException e) @@ -361,8 +361,8 @@ public class GtkImage extends Image /** * Callback from the image consumer. */ - public void setImage(int width, int height, - int[] pixels, Hashtable<?,?> properties) + public void setImage(int width, int height, + int[] pixels, Hashtable<?,?> properties) { this.width = width; this.height = height; @@ -392,12 +392,12 @@ public class GtkImage extends Image return width; } - + public synchronized int getHeight (ImageObserver observer) { if (addObserver(observer)) return -1; - + return height; } @@ -405,7 +405,7 @@ public class GtkImage extends Image { if (addObserver(observer)) return UndefinedProperty; - + Object value = props.get (name); return (value == null) ? UndefinedProperty : value; } @@ -426,7 +426,7 @@ public class GtkImage extends Image else return null; } - return new MemoryImageSource(width, height, nativeModel, pixels, + return new MemoryImageSource(width, height, nativeModel, pixels, 0, width); } @@ -438,7 +438,7 @@ public class GtkImage extends Image throw new IllegalAccessError("This method only works for off-screen" +" Images."); } - + /** * Returns a scaled instance of this pixbuf. */ @@ -454,7 +454,7 @@ public class GtkImage extends Image } /** - * If the image is loaded and comes from an ImageProducer, + * If the image is loaded and comes from an ImageProducer, * regenerate the image from there. * * I have no idea if this is ever actually used. Since GtkImage can't be @@ -468,9 +468,9 @@ public class GtkImage extends Image observers = new Vector<ImageObserver>(); isLoaded = false; synchronized(pixbufLock) - { - freePixbuf(); - } + { + freePixbuf(); + } source.startProduction(new GtkImageConsumer(this, source)); } } @@ -510,7 +510,7 @@ public class GtkImage extends Image */ private void deliver() { - int flags = ImageObserver.HEIGHT | + int flags = ImageObserver.HEIGHT | ImageObserver.WIDTH | ImageObserver.PROPERTIES | ImageObserver.ALLBITS; @@ -522,7 +522,7 @@ public class GtkImage extends Image observers = null; } - + /** * Adds an observer, if we need to. * @return true if an observer was added. diff --git a/gnu/java/awt/peer/gtk/GtkImageConsumer.java b/gnu/java/awt/peer/gtk/GtkImageConsumer.java index 44cfaf926..65cae7a89 100644 --- a/gnu/java/awt/peer/gtk/GtkImageConsumer.java +++ b/gnu/java/awt/peer/gtk/GtkImageConsumer.java @@ -92,11 +92,11 @@ public class GtkImageConsumer implements ImageConsumer public synchronized void setHints (int flags) { // This method informs us in which order the pixels are - // delivered, for progressive-loading support, etc. + // delivered, for progressive-loading support, etc. // Since we wait until it's all loaded, we can ignore the hints. } - public synchronized void setPixels (int x, int y, int width, int height, + public synchronized void setPixels (int x, int y, int width, int height, ColorModel cm, byte[] pixels, int offset, int scansize) { @@ -158,7 +158,7 @@ public class GtkImageConsumer implements ImageConsumer for (int i = 0; i < pixels.length; i++) ret[i] = pixels[i] & 0xFF; - + return ret; } @@ -167,5 +167,3 @@ public class GtkImageConsumer implements ImageConsumer this.properties = props; } } - - diff --git a/gnu/java/awt/peer/gtk/GtkLabelPeer.java b/gnu/java/awt/peer/gtk/GtkLabelPeer.java index 76f8e5fe3..0bdacbf33 100644 --- a/gnu/java/awt/peer/gtk/GtkLabelPeer.java +++ b/gnu/java/awt/peer/gtk/GtkLabelPeer.java @@ -74,7 +74,7 @@ public class GtkLabelPeer extends GtkComponentPeer if (text != null) setNativeText(text); } - + public GtkLabelPeer (Label l) { super (l); diff --git a/gnu/java/awt/peer/gtk/GtkListPeer.java b/gnu/java/awt/peer/gtk/GtkListPeer.java index f943a75d1..b1cc6e522 100644 --- a/gnu/java/awt/peer/gtk/GtkListPeer.java +++ b/gnu/java/awt/peer/gtk/GtkListPeer.java @@ -73,7 +73,7 @@ public class GtkListPeer extends GtkComponentPeer public GtkListPeer (List list) { super (list); - + setMultipleMode (list.isMultipleMode ()); if (list.getItemCount () > 0) @@ -83,20 +83,20 @@ public class GtkListPeer extends GtkComponentPeer native void append (String items[]); public native void add (String item, int index); - + public void addItem (String item, int index) { add (item, index); } - + public void clear () { removeAll (); } - + public native void delItems (int start, int end); public native void deselect (int index); - + public Dimension getMinimumSize (int rows) { return minimumSize (rows); @@ -106,7 +106,7 @@ public class GtkListPeer extends GtkComponentPeer { return preferredSize (rows); } - + public native int[] getSelectedIndexes (); public native void makeVisible (int index); @@ -158,7 +158,7 @@ public class GtkListPeer extends GtkComponentPeer // Double-click only generates an Action event if // something is selected. if (selectedItem != null) - postActionEvent (((List) awtComponent).getSelectedItem (), + postActionEvent (((List) awtComponent).getSelectedItem (), me.getModifiersEx ()); } } diff --git a/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java b/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java index 1e37cefc1..78f640361 100644 --- a/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java +++ b/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java @@ -60,7 +60,7 @@ public abstract class GtkMenuComponentPeer extends GtkGenericPeer { MenuComponent mc = ((MenuComponent) awtWidget); Font f = mc.getFont(); - + if (f == null) { MenuContainer parent = mc.getParent (); diff --git a/gnu/java/awt/peer/gtk/GtkMenuPeer.java b/gnu/java/awt/peer/gtk/GtkMenuPeer.java index ff6bdca9f..c55347393 100644 --- a/gnu/java/awt/peer/gtk/GtkMenuPeer.java +++ b/gnu/java/awt/peer/gtk/GtkMenuPeer.java @@ -57,7 +57,7 @@ public class GtkMenuPeer extends GtkMenuItemPeer protected native void create (String label); private native void addItem(MenuItemPeer item, int key, - boolean shiftModifier); + boolean shiftModifier); /** XXX - Document this and the override in GtkPopupMenuPeer. */ native void setupAccelGroup (GtkGenericPeer container); @@ -75,7 +75,7 @@ public class GtkMenuPeer extends GtkMenuItemPeer public GtkMenuPeer (Menu menu) { super (menu); - + if (menu.isTearOff()) addTearOff(); diff --git a/gnu/java/awt/peer/gtk/GtkMouseInfoPeer.java b/gnu/java/awt/peer/gtk/GtkMouseInfoPeer.java index 7407744af..55c9146c4 100644 --- a/gnu/java/awt/peer/gtk/GtkMouseInfoPeer.java +++ b/gnu/java/awt/peer/gtk/GtkMouseInfoPeer.java @@ -49,18 +49,17 @@ import java.awt.peer.MouseInfoPeer; public class GtkMouseInfoPeer implements MouseInfoPeer { private static GdkGraphicsEnvironment gde = new GdkGraphicsEnvironment(); - + public int fillPointWithCoords(Point p) { int[] coords = gde.getMouseCoordinates(); - p.x = coords[1]; + p.x = coords[1]; p.y = coords[2]; return coords[0]; } - + public boolean isWindowUnderMouse(Window w) { return gde.isWindowUnderMouse((GtkWindowPeer) w.getPeer()); } } - diff --git a/gnu/java/awt/peer/gtk/GtkPanelPeer.java b/gnu/java/awt/peer/gtk/GtkPanelPeer.java index e0053f763..00b506c10 100644 --- a/gnu/java/awt/peer/gtk/GtkPanelPeer.java +++ b/gnu/java/awt/peer/gtk/GtkPanelPeer.java @@ -59,7 +59,7 @@ public class GtkPanelPeer extends GtkContainerPeer if (id == MouseEvent.MOUSE_PRESSED) awtComponent.requestFocusInWindow(); - + super.handleEvent(event); } diff --git a/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java b/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java index 4d66a3f50..1b0ec8e63 100644 --- a/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java +++ b/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java @@ -60,7 +60,7 @@ public class GtkPopupMenuPeer extends GtkMenuPeer Point abs = origin.getLocationOnScreen (); show (abs.x + x, abs.y + y, 0); } - + public void show (Event e) { diff --git a/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java b/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java index c29706f40..d3f160c83 100644 --- a/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java +++ b/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java @@ -50,7 +50,7 @@ public class GtkScrollbarPeer extends GtkComponentPeer Scrollbar sb = (Scrollbar) awtComponent; create (sb.getOrientation (), sb.getValue (), - sb.getMinimum (), sb.getMaximum (), + sb.getMinimum (), sb.getMaximum (), sb.getUnitIncrement (), sb.getBlockIncrement (), sb.getVisibleAmount ()); } @@ -85,7 +85,7 @@ public class GtkScrollbarPeer extends GtkComponentPeer protected void postAdjustmentEvent (int type, int value) { Scrollbar bar = (Scrollbar) awtComponent; - q().postEvent(new AdjustmentEvent(bar, + q().postEvent(new AdjustmentEvent(bar, AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, type, value, true)); } diff --git a/gnu/java/awt/peer/gtk/GtkSelection.java b/gnu/java/awt/peer/gtk/GtkSelection.java index 967a2edb4..78ed69676 100644 --- a/gnu/java/awt/peer/gtk/GtkSelection.java +++ b/gnu/java/awt/peer/gtk/GtkSelection.java @@ -87,7 +87,7 @@ public class GtkSelection implements Transferable * mimeTypesDelivered is true. */ private DataFlavor[] dataFlavors; - + /** * Indicates a requestText() call was made and the corresponding * textAvailable() callback was triggered. @@ -100,7 +100,7 @@ public class GtkSelection implements Transferable * is true. */ private String text; - + /** * Indicates a requestImage() call was made and the corresponding * imageAvailable() callback was triggered. @@ -228,7 +228,7 @@ public class GtkSelection implements Transferable // extra element. ArrayList<DataFlavor> flavorsList = new ArrayList<DataFlavor>(mimeTypes.length + 1); - + for (int i = 0; i < mimeTypes.length; i++) { try @@ -262,7 +262,7 @@ public class GtkSelection implements Transferable npe.printStackTrace(); } } - + dataFlavors = new DataFlavor[flavorsList.size()]; flavorsList.toArray(dataFlavors); } @@ -406,10 +406,10 @@ public class GtkSelection implements Transferable } requestInProgress = false; } - + if (imagePointer != null) image = new GtkImage(imagePointer); - + imagePointer = null; result = image; if (! GtkClipboard.canCache) @@ -572,7 +572,7 @@ public class GtkSelection implements Transferable bytes = null; bytesDelivered = false; requestInProgress = false; - + requestLock.notifyAll(); } return result; diff --git a/gnu/java/awt/peer/gtk/GtkToolkit.java b/gnu/java/awt/peer/gtk/GtkToolkit.java index 486304ef0..3c470589e 100644 --- a/gnu/java/awt/peer/gtk/GtkToolkit.java +++ b/gnu/java/awt/peer/gtk/GtkToolkit.java @@ -182,10 +182,10 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit */ initializeGlobalIDs(); - int portableNativeSync; - String portNatSyncProp = + int portableNativeSync; + String portNatSyncProp = System.getProperty("gnu.classpath.awt.gtk.portable.native.sync"); - + if (portNatSyncProp == null) portableNativeSync = -1; // unset else if (Boolean.valueOf(portNatSyncProp).booleanValue()) @@ -204,12 +204,12 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit public native void beep(); private native void getScreenSizeDimensions(int[] xy); - - public int checkImage (Image image, int width, int height, - ImageObserver observer) + + public int checkImage (Image image, int width, int height, + ImageObserver observer) { - int status = ImageObserver.ALLBITS - | ImageObserver.WIDTH + int status = ImageObserver.ALLBITS + | ImageObserver.WIDTH | ImageObserver.HEIGHT; if (image instanceof GtkImage) @@ -223,17 +223,17 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit -1, -1, image.getWidth (observer), image.getHeight (observer)); - + return status; } - /** + /** * Helper to return either a Image -- the argument -- or a * GtkImage with the errorLoading flag set if the argument is null. */ static Image imageOrError(Image b) { - if (b == null) + if (b == null) return GtkImage.getErrorImage(); else return b; @@ -243,7 +243,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit { if (filename.length() == 0) return new GtkImage (); - + Image image; try { @@ -261,11 +261,11 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit return new AsyncImage(url); } - public Image createImage (ImageProducer producer) + public Image createImage (ImageProducer producer) { if (producer == null) return null; - + Image image; try { @@ -279,7 +279,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit } public Image createImage (byte[] imagedata, int imageoffset, - int imagelength) + int imagelength) { Image image; try @@ -294,13 +294,13 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit } return imageOrError(image); } - + /** * Creates an ImageProducer from the specified URL. The image is assumed - * to be in a recognised format. + * to be in a recognised format. * * @param url URL to read image data from. - */ + */ public ImageProducer createImageProducer(URL url) { return createImage( url ).getSource(); @@ -308,29 +308,29 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit /** * Returns the native color model (which isn't the same as the default - * ARGB color model, but doesn't have to be). + * ARGB color model, but doesn't have to be). */ - public ColorModel getColorModel () + public ColorModel getColorModel () { /* Return the GDK-native ABGR format */ - return new DirectColorModel(32, + return new DirectColorModel(32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); } - public String[] getFontList () + public String[] getFontList () { - return (new String[] { "Dialog", - "DialogInput", - "Monospaced", + return (new String[] { "Dialog", + "DialogInput", + "Monospaced", "Serif", "SansSerif" }); } static class LRUCache<K,V> extends LinkedHashMap<K,V> - { + { int max_entries; public LRUCache(int max) { @@ -347,12 +347,12 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit new LRUCache<Map,ClasspathFontPeer>(50); private LRUCache<Object,Image> imageCache = new LRUCache<Object,Image>(50); - public FontMetrics getFontMetrics (Font font) + public FontMetrics getFontMetrics (Font font) { return ((GdkFontPeer) font.getPeer()).getFontMetrics(font); } - public Image getImage (String filename) + public Image getImage (String filename) { if (imageCache.containsKey(filename)) return imageCache.get(filename); @@ -364,7 +364,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit } } - public Image getImage (URL url) + public Image getImage (URL url) { if (imageCache.containsKey(url)) return imageCache.get(url); @@ -376,7 +376,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit } } - public PrintJob getPrintJob (Frame frame, String jobtitle, Properties props) + public PrintJob getPrintJob (Frame frame, String jobtitle, Properties props) { SecurityManager sm; sm = System.getSecurityManager(); @@ -395,7 +395,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit return new Dimension(dim[0], dim[1]); } - public Clipboard getSystemClipboard() + public Clipboard getSystemClipboard() { SecurityManager secman = System.getSecurityManager(); if (secman != null) @@ -409,7 +409,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit SecurityManager secman = System.getSecurityManager(); if (secman != null) secman.checkSystemClipboardAccess(); - + return GtkClipboard.getSelectionInstance(); } @@ -417,8 +417,8 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit * Prepares a GtkImage. For every other kind of Image it just * assumes the image is already prepared for rendering. */ - public boolean prepareImage (Image image, int width, int height, - ImageObserver observer) + public boolean prepareImage (Image image, int width, int height, + ImageObserver observer) { /* GtkImages are always prepared, as long as they're loaded. */ if (image instanceof GtkImage) @@ -446,13 +446,13 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit if (c.getBackground () == null) c.setBackground (cp.getBackground ()); // if (c.getFont () == null) - // c.setFont (cp.getFont ()); - + // c.setFont (cp.getFont ()); + /* Make the Peer reflect the state of the Component */ if (! (c instanceof Window)) { cp.setCursor (c.getCursor ()); - + Rectangle bounds = c.getBounds (); cp.setBounds (bounds.x, bounds.y, bounds.width, bounds.height); cp.setVisible (c.isVisible ()); @@ -465,13 +465,13 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit return new GtkButtonPeer (b); } - protected CanvasPeer createCanvas (Canvas c) + protected CanvasPeer createCanvas (Canvas c) { checkHeadless(); return new GtkCanvasPeer (c); } - protected CheckboxPeer createCheckbox (Checkbox cb) + protected CheckboxPeer createCheckbox (Checkbox cb) { checkHeadless(); return new GtkCheckboxPeer (cb); @@ -483,7 +483,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit return new GtkCheckboxMenuItemPeer (cmi); } - protected ChoicePeer createChoice (Choice c) + protected ChoicePeer createChoice (Choice c) { checkHeadless(); return new GtkChoicePeer (c); @@ -509,7 +509,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit return new GtkFramePeer (f); } - protected LabelPeer createLabel (Label label) + protected LabelPeer createLabel (Label label) { checkHeadless(); return new GtkLabelPeer (label); @@ -521,55 +521,55 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit return new GtkListPeer (list); } - protected MenuPeer createMenu (Menu m) + protected MenuPeer createMenu (Menu m) { checkHeadless(); return new GtkMenuPeer (m); } - protected MenuBarPeer createMenuBar (MenuBar mb) + protected MenuBarPeer createMenuBar (MenuBar mb) { checkHeadless(); return new GtkMenuBarPeer (mb); } - protected MenuItemPeer createMenuItem (MenuItem mi) + protected MenuItemPeer createMenuItem (MenuItem mi) { checkHeadless(); return new GtkMenuItemPeer (mi); } - protected PanelPeer createPanel (Panel p) + protected PanelPeer createPanel (Panel p) { checkHeadless(); return new GtkPanelPeer (p); } - protected PopupMenuPeer createPopupMenu (PopupMenu target) + protected PopupMenuPeer createPopupMenu (PopupMenu target) { checkHeadless(); return new GtkPopupMenuPeer (target); } - protected ScrollPanePeer createScrollPane (ScrollPane sp) + protected ScrollPanePeer createScrollPane (ScrollPane sp) { checkHeadless(); return new GtkScrollPanePeer (sp); } - protected ScrollbarPeer createScrollbar (Scrollbar sb) + protected ScrollbarPeer createScrollbar (Scrollbar sb) { checkHeadless(); return new GtkScrollbarPeer (sb); } - protected TextAreaPeer createTextArea (TextArea ta) + protected TextAreaPeer createTextArea (TextArea ta) { checkHeadless(); return new GtkTextAreaPeer (ta); } - protected TextFieldPeer createTextField (TextField tf) + protected TextFieldPeer createTextField (TextField tf) { checkHeadless(); return new GtkTextFieldPeer (tf); @@ -589,7 +589,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit return new GtkEmbeddedWindowPeer (w); } - /** + /** * @deprecated part of the older "logical font" system in earlier AWT * implementations. Our newer Font class uses getClasspathFontPeer. */ @@ -601,7 +601,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit /** * Private method that allows size to be set at initialization time. */ - private FontPeer getFontPeer (String name, int style, int size) + private FontPeer getFontPeer (String name, int style, int size) { Map<TextAttribute,Object> attrs = new HashMap<TextAttribute,Object>(); ClasspathFontPeer.copyStyleToAttrs (style, attrs); @@ -612,7 +612,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit /** * Newer method to produce a peer for a Font object, even though Sun's * design claims Font should now be peerless, we do not agree with this - * model, hence "ClasspathFontPeer". + * model, hence "ClasspathFontPeer". */ public ClasspathFontPeer getClasspathFontPeer (String name, @@ -634,7 +634,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit } } - protected EventQueue getSystemEventQueueImpl() + protected EventQueue getSystemEventQueueImpl() { synchronized (GtkToolkit.class) { @@ -642,7 +642,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit { q = new EventQueue(); } - } + } return q; } @@ -659,9 +659,9 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit throw new InvalidDnDOperationException(); return new GtkDragSourceContextPeer(e); } - + public <T extends DragGestureRecognizer> T - createDragGestureRecognizer(Class<T> recognizer, DragSource ds, + createDragGestureRecognizer(Class<T> recognizer, DragSource ds, Component comp, int actions, DragGestureListener l) { @@ -690,7 +690,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit getScreenSizeDimensions(dims); return new Rectangle(0, 0, dims[0], dims[1]); } - + // ClasspathToolkit methods public GraphicsEnvironment getLocalGraphicsEnvironment() @@ -711,14 +711,14 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit public boolean getLockingKeyState(int keyCode) { int state = getLockState(keyCode); - + if (state != -1) return state == 1; - + if (AWTUtilities.isValidKey(keyCode)) throw new UnsupportedOperationException ("cannot get locking state of key code " + keyCode); - + throw new IllegalArgumentException("invalid key code " + keyCode); } diff --git a/gnu/java/awt/peer/gtk/GtkVolatileImage.java b/gnu/java/awt/peer/gtk/GtkVolatileImage.java index 8660ced8e..663839f23 100644 --- a/gnu/java/awt/peer/gtk/GtkVolatileImage.java +++ b/gnu/java/awt/peer/gtk/GtkVolatileImage.java @@ -65,7 +65,7 @@ public class GtkVolatileImage extends VolatileImage 0x0000FF00, 0x00FF0000, 0xFF000000); - + /** * Don't touch, accessed from native code. */ @@ -76,15 +76,15 @@ public class GtkVolatileImage extends VolatileImage native void destroy(long pointer); native int[] nativeGetPixels(long pointer); - + /** * Gets the pixels in the current image from GDK. - * + * * Note that pixels are in 32-bit RGBA, non-premultiplied, which is different * from Cairo's premultiplied ARGB, which is different from Java's standard * non-premultiplied ARGB. Caution is advised when using this method, to * ensure that the data format remains consistent with what you expect. - * + * * @return the current pixels, as reported by GDK. */ public int[] getPixels() @@ -106,8 +106,8 @@ public class GtkVolatileImage extends VolatileImage nativeDrawVolatile(nativePointer, srcPtr, x, y, w, h); } - public GtkVolatileImage(GtkComponentPeer component, - int width, int height, ImageCapabilities caps) + public GtkVolatileImage(GtkComponentPeer component, + int width, int height, ImageCapabilities caps) { this.width = width; this.height = height; @@ -184,7 +184,7 @@ public class GtkVolatileImage extends VolatileImage { return width; } - + public int getHeight(java.awt.image.ImageObserver observer) { return height; @@ -194,7 +194,7 @@ public class GtkVolatileImage extends VolatileImage { return null; } - + /** * Creates a SampleModel that matches GDK's native format */ diff --git a/gnu/java/awt/peer/gtk/GtkWindowPeer.java b/gnu/java/awt/peer/gtk/GtkWindowPeer.java index 9744c3a53..c8e1bceb7 100644 --- a/gnu/java/awt/peer/gtk/GtkWindowPeer.java +++ b/gnu/java/awt/peer/gtk/GtkWindowPeer.java @@ -119,13 +119,13 @@ public class GtkWindowPeer extends GtkContainerPeer y = awtComponent.getY(); height = awtComponent.getHeight(); width = awtComponent.getWidth(); - + if (!window.isFocusableWindow()) type = GDK_WINDOW_TYPE_HINT_MENU; - + if (parent != null) parent_peer = (GtkWindowPeer) awtComponent.getParent().getPeer(); - + create (type, decorated, parent_peer); } @@ -173,14 +173,14 @@ public class GtkWindowPeer extends GtkContainerPeer public void setBounds (int x, int y, int width, int height) { - if (x != getX() || y != getY() || width != getWidth() + if (x != getX() || y != getY() || width != getWidth() || height != getHeight()) { this.x = x; this.y = y; this.width = width; this.height = height; - + nativeSetBounds (x, y, width - insets.left - insets.right, height - insets.top - insets.bottom); @@ -194,7 +194,7 @@ public class GtkWindowPeer extends GtkContainerPeer // Called from setResizable protected native void setSize (int width, int height); - + /** * Needed by both GtkFramePeer and GtkDialogPeer subclasses, so * implemented here. But never actually called on a GtkWindowPeer @@ -215,7 +215,7 @@ public class GtkWindowPeer extends GtkContainerPeer } protected void postInsetsChangedEvent (int top, int left, - int bottom, int right) + int bottom, int right) { insets.top = top; insets.left = left; @@ -324,8 +324,8 @@ public class GtkWindowPeer extends GtkContainerPeer // insets but GtkFramePeer and GtkDialogPeer insets will be // non-zero. q().postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT, - new Rectangle (x + insets.left, - y + insets.top, + new Rectangle (x + insets.left, + y + insets.top, width, height))); } @@ -335,7 +335,7 @@ public class GtkWindowPeer extends GtkContainerPeer return false; } - public boolean requestFocus (Component request, boolean temporary, + public boolean requestFocus (Component request, boolean temporary, boolean allowWindowFocus, long time) { assert request == awtComponent || isLightweightDescendant(request); @@ -380,7 +380,7 @@ public class GtkWindowPeer extends GtkContainerPeer return g; } - protected void postMouseEvent(int id, long when, int mods, int x, int y, + protected void postMouseEvent(int id, long when, int mods, int x, int y, int clickCount, boolean popupTrigger) { // Translate AWT co-ordinates, which include a window frame's @@ -388,8 +388,8 @@ public class GtkWindowPeer extends GtkContainerPeer // frame's insets. GtkWindowPeer should always have all-zero // insets but GtkFramePeer and GtkDialogPeer insets will be // non-zero. - super.postMouseEvent (id, when, mods, - x + insets.left, y + insets.top, + super.postMouseEvent (id, when, mods, + x + insets.left, y + insets.top, clickCount, popupTrigger); } diff --git a/gnu/java/awt/peer/gtk/VolatileImageGraphics.java b/gnu/java/awt/peer/gtk/VolatileImageGraphics.java index b5858f905..2dfcdbdec 100644 --- a/gnu/java/awt/peer/gtk/VolatileImageGraphics.java +++ b/gnu/java/awt/peer/gtk/VolatileImageGraphics.java @@ -108,7 +108,7 @@ public class VolatileImageGraphics extends ComponentGraphics { if (comp == null || comp instanceof AlphaComposite) super.draw(s); - + // Custom composite else { @@ -119,11 +119,11 @@ public class VolatileImageGraphics extends ComponentGraphics g2d.setColor(this.getColor()); g2d.setStroke(this.getStroke()); g2d.draw(s); - + drawComposite(s.getBounds2D(), null); } } - + public void fill(Shape s) { if (comp == null || comp instanceof AlphaComposite) @@ -139,16 +139,16 @@ public class VolatileImageGraphics extends ComponentGraphics g2d.setPaint(this.getPaint()); g2d.setColor(this.getColor()); g2d.fill(s); - + drawComposite(s.getBounds2D(), null); } } - + public void drawGlyphVector(GlyphVector gv, float x, float y) { if (comp == null || comp instanceof AlphaComposite) super.drawGlyphVector(gv, x, y); - + // Custom composite else { @@ -156,11 +156,11 @@ public class VolatileImageGraphics extends ComponentGraphics createBuffer(); Graphics2D g2d = (Graphics2D)buffer.getGraphics(); - + g2d.setPaint(this.getPaint()); g2d.setColor(this.getColor()); g2d.drawGlyphVector(gv, x, y); - + Rectangle2D bounds = gv.getLogicalBounds(); bounds = new Rectangle2D.Double(x + bounds.getX(), y + bounds.getY(), bounds.getWidth(), bounds.getHeight()); @@ -173,7 +173,7 @@ public class VolatileImageGraphics extends ComponentGraphics { if (comp == null || comp instanceof AlphaComposite) return super.drawImage(img, xform, bgcolor, obs); - + // Custom composite else { @@ -186,7 +186,7 @@ public class VolatileImageGraphics extends ComponentGraphics img = Toolkit.getDefaultToolkit().createImage(source); } BufferedImage bImg = (BufferedImage) img; - + // Find dimensions of translation Point2D origin = new Point2D.Double(bImg.getMinX(), bImg.getMinY()); Point2D pt = new Point2D.Double(bImg.getWidth(), bImg.getHeight()); @@ -195,10 +195,10 @@ public class VolatileImageGraphics extends ComponentGraphics origin = xform.transform(origin, origin); pt = xform.transform(pt, pt); } - + // Create buffer and draw image createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setRenderingHints(this.getRenderingHints()); g2d.drawImage(img, xform, obs); @@ -211,31 +211,31 @@ public class VolatileImageGraphics extends ComponentGraphics obs); } } - + public boolean drawImage(Image img, int x, int y, ImageObserver observer) { if (img instanceof GtkVolatileImage && (comp == null || comp instanceof AlphaComposite)) { - owner.drawVolatile( ((GtkVolatileImage)img).nativePointer, + owner.drawVolatile( ((GtkVolatileImage)img).nativePointer, x, y, - ((GtkVolatileImage)img).width, + ((GtkVolatileImage)img).width, ((GtkVolatileImage)img).height ); return true; - } + } return super.drawImage( img, x, y, observer ); } - + public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) { if ((img instanceof GtkVolatileImage) && (comp == null || comp instanceof AlphaComposite)) { - owner.drawVolatile( ((GtkVolatileImage)img).nativePointer, + owner.drawVolatile( ((GtkVolatileImage)img).nativePointer, x, y, width, height ); return true; - } + } return super.drawImage( img, x, y, width, height, observer ); } @@ -243,31 +243,31 @@ public class VolatileImageGraphics extends ComponentGraphics { return new Rectangle2D.Double(0, 0, owner.width, owner.height); } - + private boolean drawComposite(Rectangle2D bounds, ImageObserver observer) { // Clip source to visible areas that need updating Rectangle2D clip = this.getClipBounds(); Rectangle2D.intersect(bounds, clip, bounds); - + BufferedImage buffer2 = buffer; if (!bounds.equals(buffer2.getRaster().getBounds())) buffer2 = buffer2.getSubimage((int)bounds.getX(), (int)bounds.getY(), (int)bounds.getWidth(), (int)bounds.getHeight()); - + // Get current on-screen pixels (destination) and clip to bounds BufferedImage current = owner.getSnapshot(); double[] points = new double[] {bounds.getX(), bounds.getY(), bounds.getMaxX(), bounds.getMaxY()}; transform.transform(points, 0, points, 0, 2); - + Rectangle2D deviceBounds = new Rectangle2D.Double(points[0], points[1], points[2] - points[0], points[3] - points[1]); Rectangle2D.intersect(deviceBounds, this.getClipInDevSpace(), deviceBounds); - + current = current.getSubimage((int)deviceBounds.getX(), (int)deviceBounds.getY(), (int)deviceBounds.getWidth(), @@ -276,7 +276,7 @@ public class VolatileImageGraphics extends ComponentGraphics // Perform actual composite operation compCtx.compose(buffer2.getRaster(), current.getRaster(), buffer2.getRaster()); - + // This MUST call directly into the "action" method in CairoGraphics2D, // not one of the wrappers, to ensure that the composite isn't processed // more than once! @@ -290,7 +290,7 @@ public class VolatileImageGraphics extends ComponentGraphics return rv; } - + private void createBuffer() { if (buffer == null) @@ -299,7 +299,7 @@ public class VolatileImageGraphics extends ComponentGraphics rst = Raster.createWritableRaster(GtkVolatileImage.createGdkSampleModel(owner.width, owner.height), new Point(0,0)); - + buffer = new BufferedImage(GtkVolatileImage.gdkColorModel, rst, GtkVolatileImage.gdkColorModel.isAlphaPremultiplied(), new Hashtable()); @@ -307,12 +307,12 @@ public class VolatileImageGraphics extends ComponentGraphics else { Graphics2D g2d = ((Graphics2D)buffer.getGraphics()); - + g2d.setBackground(new Color(0,0,0,0)); g2d.clearRect(0, 0, buffer.getWidth(), buffer.getHeight()); } } - + protected ColorModel getNativeCM() { // We should really return GtkVolatileImage.gdkColorModel , @@ -323,4 +323,3 @@ public class VolatileImageGraphics extends ComponentGraphics return CairoSurface.cairoCM_pre; } } - diff --git a/gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java b/gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java index b3eeb1baa..401b895b8 100644 --- a/gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java +++ b/gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java @@ -1,4 +1,4 @@ -/* HeadlessGraphicsEnvironment.java -- A graphics environment for headless mode +/* HeadlessGraphicsEnvironment.java -- A graphics environment for headless mode Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/awt/peer/qt/MainQtThread.java b/gnu/java/awt/peer/qt/MainQtThread.java index fdd6da0a6..bee979ac7 100644 --- a/gnu/java/awt/peer/qt/MainQtThread.java +++ b/gnu/java/awt/peer/qt/MainQtThread.java @@ -81,6 +81,4 @@ public class MainQtThread extends Thread exec(QApplicationPointer); } -} - - +} diff --git a/gnu/java/awt/peer/qt/QMatrix.java b/gnu/java/awt/peer/qt/QMatrix.java index 428cda173..ca4d55b59 100644 --- a/gnu/java/awt/peer/qt/QMatrix.java +++ b/gnu/java/awt/peer/qt/QMatrix.java @@ -53,8 +53,8 @@ public class QMatrix extends NativeWrapper init( matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5] ); } - private native void init(double m00, double m10, double m01, double m11, - double m02, double m12 ); + private native void init(double m00, double m10, double m01, double m11, + double m02, double m12 ); private native double[] getMatrix(); @@ -64,10 +64,9 @@ public class QMatrix extends NativeWrapper } public native void dispose(); - + public void finalize() { dispose(); } } - diff --git a/gnu/java/awt/peer/qt/QPainterPath.java b/gnu/java/awt/peer/qt/QPainterPath.java index 8d176a156..848b10497 100644 --- a/gnu/java/awt/peer/qt/QPainterPath.java +++ b/gnu/java/awt/peer/qt/QPainterPath.java @@ -61,31 +61,31 @@ public class QPainterPath extends NativeWrapper while( !pi.isDone() ) { - switch( pi.currentSegment(coords) ) - { - case PathIterator.SEG_MOVETO: - moveTo( coords[0], coords[1] ); - break; - - case PathIterator.SEG_CLOSE: - close(); - break; - - case PathIterator.SEG_LINETO: - lineTo( coords[0], coords[1] ); - break; - - case PathIterator.SEG_QUADTO: - quadTo( coords[0], coords[1], coords[2], coords[3] ); - break; - - case PathIterator.SEG_CUBICTO: - cubicTo( coords[0], coords[1], - coords[2], coords[3], - coords[4], coords[5] ); - break; - } - pi.next(); + switch( pi.currentSegment(coords) ) + { + case PathIterator.SEG_MOVETO: + moveTo( coords[0], coords[1] ); + break; + + case PathIterator.SEG_CLOSE: + close(); + break; + + case PathIterator.SEG_LINETO: + lineTo( coords[0], coords[1] ); + break; + + case PathIterator.SEG_QUADTO: + quadTo( coords[0], coords[1], coords[2], coords[3] ); + break; + + case PathIterator.SEG_CUBICTO: + cubicTo( coords[0], coords[1], + coords[2], coords[3], + coords[4], coords[5] ); + break; + } + pi.next(); } } @@ -129,13 +129,12 @@ public class QPainterPath extends NativeWrapper private native void quadTo(double x1, double y1, double x2, double y2); private native void cubicTo(double x1, double y1, double x2, double y2, - double x3, double y3); + double x3, double y3); public native void dispose(); - + public void finalize() { dispose(); } } - diff --git a/gnu/java/awt/peer/qt/QPen.java b/gnu/java/awt/peer/qt/QPen.java index ec41015ed..aee308c26 100644 --- a/gnu/java/awt/peer/qt/QPen.java +++ b/gnu/java/awt/peer/qt/QPen.java @@ -62,10 +62,9 @@ public class QPen extends NativeWrapper private native void init(double width, int cap, int join, double miterlimit); public native void dispose(); - + public void finalize() { dispose(); } } - diff --git a/gnu/java/awt/peer/qt/QtAudioClip.java b/gnu/java/awt/peer/qt/QtAudioClip.java index 43387acf6..ae2e350eb 100644 --- a/gnu/java/awt/peer/qt/QtAudioClip.java +++ b/gnu/java/awt/peer/qt/QtAudioClip.java @@ -57,9 +57,9 @@ public class QtAudioClip extends NativeWrapper implements AudioClip File f = new File(filename); try { - String fn = f.getCanonicalPath(); - loadClip( fn ); - } + String fn = f.getCanonicalPath(); + loadClip( fn ); + } catch(IOException e) { } @@ -67,7 +67,7 @@ public class QtAudioClip extends NativeWrapper implements AudioClip public QtAudioClip(URL url) { - + } private native void loadClip(String filename); @@ -78,7 +78,7 @@ public class QtAudioClip extends NativeWrapper implements AudioClip /** * Checks that Qt and sound is available. - */ + */ private void checkForQt() { if( t == null ) diff --git a/gnu/java/awt/peer/qt/QtButtonPeer.java b/gnu/java/awt/peer/qt/QtButtonPeer.java index 629f45911..6722eb285 100644 --- a/gnu/java/awt/peer/qt/QtButtonPeer.java +++ b/gnu/java/awt/peer/qt/QtButtonPeer.java @@ -62,18 +62,14 @@ public class QtButtonPeer extends QtComponentPeer implements ButtonPeer void fireClick(int modifiers) { ActionEvent e = new ActionEvent(owner, - ActionEvent.ACTION_PERFORMED, - ((Button)owner).getActionCommand(), - System.currentTimeMillis(), - modifiers); + ActionEvent.ACTION_PERFORMED, + ((Button)owner).getActionCommand(), + System.currentTimeMillis(), + modifiers); QtToolkit.eventQueue.postEvent(e); } // ************ Public methods ********************* - + public native void setLabel( String label ); } - - - - diff --git a/gnu/java/awt/peer/qt/QtCheckboxPeer.java b/gnu/java/awt/peer/qt/QtCheckboxPeer.java index acac5e460..37fb51c48 100644 --- a/gnu/java/awt/peer/qt/QtCheckboxPeer.java +++ b/gnu/java/awt/peer/qt/QtCheckboxPeer.java @@ -50,18 +50,18 @@ public class QtCheckboxPeer extends QtComponentPeer implements CheckboxPeer // Map QButtonGroup<->CheckboxGroup private static WeakHashMap groupMap; - static + static { groupMap = new WeakHashMap(); } - + public QtCheckboxPeer( QtToolkit kit, Checkbox owner ) { super( kit, owner ); } - + protected native void init(); - + protected void setup() { super.setup(); @@ -73,32 +73,32 @@ public class QtCheckboxPeer extends QtComponentPeer implements CheckboxPeer private void fireToggle(boolean checked) { if (group == null) - ((Checkbox)owner).setState( checked ); + ((Checkbox)owner).setState( checked ); else if ( checked ) - group.setSelectedCheckbox((Checkbox)owner); + group.setSelectedCheckbox((Checkbox)owner); int sel = checked ? ItemEvent.SELECTED : ItemEvent.DESELECTED; - ItemEvent e = new ItemEvent((Checkbox)owner, - ItemEvent.ITEM_STATE_CHANGED, - ((Checkbox)owner).getLabel(), - sel); + ItemEvent e = new ItemEvent((Checkbox)owner, + ItemEvent.ITEM_STATE_CHANGED, + ((Checkbox)owner).getLabel(), + sel); QtToolkit.eventQueue.postEvent(e); } - + // ************ Public methods ********************* - + public void setCheckboxGroup( CheckboxGroup group ) - { - if(this.group == group) + { + if(this.group == group) return; // if we change from a checkbox to a radio button or vice versa if((this.group == null) != (group == null)) { - this.group = group; - callInit(); - setup(); + this.group = group; + callInit(); + setup(); } this.group = group; @@ -109,5 +109,3 @@ public class QtCheckboxPeer extends QtComponentPeer implements CheckboxPeer public native void setState( boolean state ); } - - diff --git a/gnu/java/awt/peer/qt/QtChoicePeer.java b/gnu/java/awt/peer/qt/QtChoicePeer.java index 30674b36e..d279468cd 100644 --- a/gnu/java/awt/peer/qt/QtChoicePeer.java +++ b/gnu/java/awt/peer/qt/QtChoicePeer.java @@ -47,16 +47,16 @@ public class QtChoicePeer extends QtComponentPeer implements ChoicePeer { super( kit, owner ); } - + protected native void init(); protected void setup() { super.setup(); - + Choice c = (Choice) owner; int n = c.getItemCount(); - for ( int i = 0; i < n ; i++ ) + for ( int i = 0; i < n ; i++ ) add( c.getItem( i ), i ); select( c.getSelectedIndex() ); } @@ -64,10 +64,10 @@ public class QtChoicePeer extends QtComponentPeer implements ChoicePeer private void fireChoice( int index ) { ((Choice)owner).select( index ); - ItemEvent e = new ItemEvent((Choice)owner, - ItemEvent.ITEM_STATE_CHANGED, - ((Choice)owner).getItem(index), - ItemEvent.SELECTED); + ItemEvent e = new ItemEvent((Choice)owner, + ItemEvent.ITEM_STATE_CHANGED, + ((Choice)owner).getItem(index), + ItemEvent.SELECTED); QtToolkit.eventQueue.postEvent(e); } @@ -91,5 +91,3 @@ public class QtChoicePeer extends QtComponentPeer implements ChoicePeer public native void select( int index ); } - - diff --git a/gnu/java/awt/peer/qt/QtComponentGraphics.java b/gnu/java/awt/peer/qt/QtComponentGraphics.java index c5c839e32..27e12e659 100644 --- a/gnu/java/awt/peer/qt/QtComponentGraphics.java +++ b/gnu/java/awt/peer/qt/QtComponentGraphics.java @@ -43,8 +43,8 @@ import java.awt.Graphics; import java.awt.Rectangle; /** - * QtComponentPainter is a Graphics2D context for painting directly to AWT - * components. They require an existing QPainter object (the one passed into + * QtComponentPainter is a Graphics2D context for painting directly to AWT + * components. They require an existing QPainter object (the one passed into * the native paint method), and are created there (ONLY). * * Since this context does direct on-screen drawing it is NOT thread-safe, @@ -63,15 +63,15 @@ public class QtComponentGraphics extends QtGraphics * * @param ptr the pointer to the QPainter object. */ - public QtComponentGraphics(long ptr, QtComponentPeer component, - int x, int y, int w, int h) + public QtComponentGraphics(long ptr, QtComponentPeer component, + int x, int y, int w, int h) { nativeObject = ptr; peer = component; Rectangle r = new Rectangle(x, y, w, h); initialClip = r; - + setAlpha( 1.0 ); Color c = component.owner.getBackground(); if(c == null) @@ -103,11 +103,11 @@ public class QtComponentGraphics extends QtGraphics /** * This is a tricky one - */ - public void copyArea(int x, int y, int width, int height, - int dx, int dy) + */ + public void copyArea(int x, int y, int width, int height, + int dx, int dy) { - // FIXME + // FIXME } /** @@ -117,6 +117,4 @@ public class QtComponentGraphics extends QtGraphics { return peer.getGraphicsConfiguration(); } -} - - +} diff --git a/gnu/java/awt/peer/qt/QtComponentPeer.java b/gnu/java/awt/peer/qt/QtComponentPeer.java index 334f59088..16149b2e6 100644 --- a/gnu/java/awt/peer/qt/QtComponentPeer.java +++ b/gnu/java/awt/peer/qt/QtComponentPeer.java @@ -66,7 +66,7 @@ import java.awt.event.ComponentEvent; // 100% import java.awt.event.FocusEvent; // 100% import java.awt.event.InputEvent; // (abstract) import java.awt.event.KeyEvent; // 2/3 -import java.awt.event.MouseEvent; // 70%? +import java.awt.event.MouseEvent; // 70%? import java.awt.event.PaintEvent; // Yup. import java.awt.event.WindowEvent; // 2/ 12 import java.util.Timer; @@ -117,16 +117,16 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer this.toolkit = kit; qtApp = QtToolkit.guiThread.QApplicationPointer; nativeObject = 0; - synchronized(this) + synchronized(this) { - callInit(); // Calls the init method FROM THE MAIN THREAD. - try - { - wait(); // Wait for the thing to be created. - } - catch(InterruptedException e) - { - } + callInit(); // Calls the init method FROM THE MAIN THREAD. + try + { + wait(); // Wait for the thing to be created. + } + catch(InterruptedException e) + { + } } setup(); hasMotionListeners = false; @@ -147,30 +147,30 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer settingUp = true; if (owner != null) { - if (owner instanceof javax.swing.JComponent) - setBackground(owner.getBackground()); - else - owner.setBackground(getNativeBackground()); - - if (owner.getForeground() != null) - setForeground(owner.getForeground()); - else - setForeground( Color.black ); - - if (owner.getCursor() != null) - if (owner.getCursor().getType() != Cursor.DEFAULT_CURSOR) - setCursor(owner.getCursor()); - - if (owner.getFont() != null) - setFont(owner.getFont()); - - setEnabled( owner.isEnabled() ); - - backBuffer = null; - updateBounds(); - - setVisible( owner.isVisible() ); - QtToolkit.repaintThread.queueComponent(this); + if (owner instanceof javax.swing.JComponent) + setBackground(owner.getBackground()); + else + owner.setBackground(getNativeBackground()); + + if (owner.getForeground() != null) + setForeground(owner.getForeground()); + else + setForeground( Color.black ); + + if (owner.getCursor() != null) + if (owner.getCursor().getType() != Cursor.DEFAULT_CURSOR) + setCursor(owner.getCursor()); + + if (owner.getFont() != null) + setFont(owner.getFont()); + + setEnabled( owner.isEnabled() ); + + backBuffer = null; + updateBounds(); + + setVisible( owner.isVisible() ); + QtToolkit.repaintThread.queueComponent(this); } settingUp = false; } @@ -189,9 +189,9 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer private boolean drawableComponent() { - return ((this instanceof QtContainerPeer && - !(this instanceof QtScrollPanePeer)) || - (this instanceof QtCanvasPeer)); + return ((this instanceof QtContainerPeer && + !(this instanceof QtScrollPanePeer)) || + (this instanceof QtCanvasPeer)); } void updateBounds() @@ -204,19 +204,19 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer { if(width <= 0 || height <= 0) return; - + if( !drawableComponent() && backBuffer == null) return; if( backBuffer != null ) { - if( width < backBuffer.width && height < backBuffer.height ) - return; - backBuffer.dispose(); + if( width < backBuffer.width && height < backBuffer.height ) + return; + backBuffer.dispose(); } backBuffer = new QtImage(width, height); } - + // ************ Event methods ********************* @@ -227,18 +227,18 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer { if (owner instanceof Window) { - WindowEvent e = new WindowEvent((Window)owner, - WindowEvent.WINDOW_CLOSING); - QtToolkit.eventQueue.postEvent(e); + WindowEvent e = new WindowEvent((Window)owner, + WindowEvent.WINDOW_CLOSING); + QtToolkit.eventQueue.postEvent(e); } } protected void enterEvent(int modifiers, int x, int y, int dummy) { - MouseEvent e = new MouseEvent(owner, - MouseEvent.MOUSE_ENTERED, - System.currentTimeMillis(), - (modifiers & 0x2FF), x, y, 0, false); + MouseEvent e = new MouseEvent(owner, + MouseEvent.MOUSE_ENTERED, + System.currentTimeMillis(), + (modifiers & 0x2FF), x, y, 0, false); QtToolkit.eventQueue.postEvent(e); } @@ -257,31 +257,31 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer protected void keyPressEvent(int modifiers, int code, int unicode, int dummy) { KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager (); - KeyEvent e = new KeyEvent(owner, - KeyEvent.KEY_PRESSED, - System.currentTimeMillis(), - modifiers, code, (char)(unicode & 0xFFFF), - KeyEvent.KEY_LOCATION_UNKNOWN); + KeyEvent e = new KeyEvent(owner, + KeyEvent.KEY_PRESSED, + System.currentTimeMillis(), + modifiers, code, (char)(unicode & 0xFFFF), + KeyEvent.KEY_LOCATION_UNKNOWN); if (!manager.dispatchEvent (e)) QtToolkit.eventQueue.postEvent(e); } protected void keyReleaseEvent(int modifiers, int code, int unicode, int dummy) { - KeyEvent e = new KeyEvent(owner, - KeyEvent.KEY_RELEASED, - System.currentTimeMillis(), - modifiers, code, (char)(unicode & 0xFFFF), - KeyEvent.KEY_LOCATION_UNKNOWN); + KeyEvent e = new KeyEvent(owner, + KeyEvent.KEY_RELEASED, + System.currentTimeMillis(), + modifiers, code, (char)(unicode & 0xFFFF), + KeyEvent.KEY_LOCATION_UNKNOWN); QtToolkit.eventQueue.postEvent(e); } protected void leaveEvent(int modifiers, int x, int y, int dummy) { - MouseEvent e = new MouseEvent(owner, - MouseEvent.MOUSE_EXITED, - System.currentTimeMillis(), - (modifiers & 0x2FF), x, y, 0, false); + MouseEvent e = new MouseEvent(owner, + MouseEvent.MOUSE_EXITED, + System.currentTimeMillis(), + (modifiers & 0x2FF), x, y, 0, false); QtToolkit.eventQueue.postEvent(e); } @@ -291,17 +291,17 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer if( (eventMask & AWTEvent.MOUSE_EVENT_MASK) == 0 ) return; int button = 0; - if((modifiers & InputEvent.BUTTON1_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON1_DOWN_MASK) == InputEvent.BUTTON1_DOWN_MASK) button = 1; - if((modifiers & InputEvent.BUTTON2_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON2_DOWN_MASK) == InputEvent.BUTTON2_DOWN_MASK) button = 2; - if((modifiers & InputEvent.BUTTON3_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON3_DOWN_MASK) == InputEvent.BUTTON3_DOWN_MASK) button = 3; - MouseEvent e = new MouseEvent(owner, - MouseEvent.MOUSE_CLICKED, - System.currentTimeMillis(), - (modifiers & 0x2FF), x, y, clickCount, - false, button); + MouseEvent e = new MouseEvent(owner, + MouseEvent.MOUSE_CLICKED, + System.currentTimeMillis(), + (modifiers & 0x2FF), x, y, clickCount, + false, button); QtToolkit.eventQueue.postEvent(e); } @@ -311,21 +311,21 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer return; int button = 0; - if((modifiers & InputEvent.BUTTON1_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON1_DOWN_MASK) == InputEvent.BUTTON1_DOWN_MASK) button = 1; - if((modifiers & InputEvent.BUTTON2_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON2_DOWN_MASK) == InputEvent.BUTTON2_DOWN_MASK) button = 2; - if((modifiers & InputEvent.BUTTON3_DOWN_MASK) == - InputEvent.BUTTON3_DOWN_MASK) button = 3; + if((modifiers & InputEvent.BUTTON3_DOWN_MASK) == + InputEvent.BUTTON3_DOWN_MASK) button = 3; - int type = (button != 0) ? + int type = (button != 0) ? MouseEvent.MOUSE_DRAGGED :MouseEvent.MOUSE_MOVED; - - MouseEvent e = new MouseEvent(owner, - type, - System.currentTimeMillis(), - (modifiers & 0x2FF), x, y, clickCount, - false, button); + + MouseEvent e = new MouseEvent(owner, + type, + System.currentTimeMillis(), + (modifiers & 0x2FF), x, y, clickCount, + false, button); QtToolkit.eventQueue.postEvent(e); } @@ -334,18 +334,18 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer if( (eventMask & AWTEvent.MOUSE_EVENT_MASK) == 0 ) return; int button = 0; - if((modifiers & InputEvent.BUTTON1_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON1_DOWN_MASK) == InputEvent.BUTTON1_DOWN_MASK) button = 1; - if((modifiers & InputEvent.BUTTON2_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON2_DOWN_MASK) == InputEvent.BUTTON2_DOWN_MASK) button = 2; - if((modifiers & InputEvent.BUTTON3_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON3_DOWN_MASK) == InputEvent.BUTTON3_DOWN_MASK) button = 3; - MouseEvent e = new MouseEvent(owner, - MouseEvent.MOUSE_PRESSED, - System.currentTimeMillis(), - (modifiers & 0x2FF), x, y, clickCount, - ( button == POPUP_TRIGGER ), - button); + MouseEvent e = new MouseEvent(owner, + MouseEvent.MOUSE_PRESSED, + System.currentTimeMillis(), + (modifiers & 0x2FF), x, y, clickCount, + ( button == POPUP_TRIGGER ), + button); QtToolkit.eventQueue.postEvent(e); } @@ -354,18 +354,18 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer if( (eventMask & AWTEvent.MOUSE_EVENT_MASK) == 0 ) return; int button = 0; - if((modifiers & InputEvent.BUTTON1_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON1_DOWN_MASK) == InputEvent.BUTTON1_DOWN_MASK) button = 1; - if((modifiers & InputEvent.BUTTON2_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON2_DOWN_MASK) == InputEvent.BUTTON2_DOWN_MASK) button = 2; - if((modifiers & InputEvent.BUTTON3_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON3_DOWN_MASK) == InputEvent.BUTTON3_DOWN_MASK) button = 3; - MouseEvent e = new MouseEvent(owner, - MouseEvent.MOUSE_RELEASED, - System.currentTimeMillis(), - (modifiers & 0x2FF), x, y, clickCount, - false, button); + MouseEvent e = new MouseEvent(owner, + MouseEvent.MOUSE_RELEASED, + System.currentTimeMillis(), + (modifiers & 0x2FF), x, y, clickCount, + false, button); QtToolkit.eventQueue.postEvent(e); } @@ -373,16 +373,16 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer { if( !ignoreResize ) { - // Since Component.setLocation calls back to setBounds, - // we need to ignore that. - ignoreResize = true; - owner.setLocation( x, y ); - ignoreResize = false; + // Since Component.setLocation calls back to setBounds, + // we need to ignore that. + ignoreResize = true; + owner.setLocation( x, y ); + ignoreResize = false; } } - protected void resizeEvent(int oldWidth, int oldHeight, - int width, int height) + protected void resizeEvent(int oldWidth, int oldHeight, + int width, int height) { if(!(owner instanceof Window)) return; @@ -390,8 +390,8 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer ignoreResize = true; owner.setSize(width, height); ignoreResize = false; - ComponentEvent e = new ComponentEvent(owner, - ComponentEvent.COMPONENT_RESIZED); + ComponentEvent e = new ComponentEvent(owner, + ComponentEvent.COMPONENT_RESIZED); QtToolkit.eventQueue.postEvent(e); QtToolkit.repaintThread.queueComponent(this); } @@ -400,22 +400,22 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer { if (owner instanceof Window) { - WindowEvent e = new WindowEvent((Window)owner, - WindowEvent.WINDOW_OPENED); - QtToolkit.eventQueue.postEvent(e); + WindowEvent e = new WindowEvent((Window)owner, + WindowEvent.WINDOW_OPENED); + QtToolkit.eventQueue.postEvent(e); } - else + else { - ComponentEvent e = new ComponentEvent(owner, - ComponentEvent.COMPONENT_SHOWN); - QtToolkit.eventQueue.postEvent(e); + ComponentEvent e = new ComponentEvent(owner, + ComponentEvent.COMPONENT_SHOWN); + QtToolkit.eventQueue.postEvent(e); } } protected void hideEvent() { - ComponentEvent e = new ComponentEvent(owner, - ComponentEvent.COMPONENT_HIDDEN); + ComponentEvent e = new ComponentEvent(owner, + ComponentEvent.COMPONENT_HIDDEN); QtToolkit.eventQueue.postEvent(e); } @@ -431,18 +431,18 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer public boolean canDetermineObscurity() { return true; - } + } public int checkImage(Image img, - int w, - int h, - ImageObserver o) + int w, + int h, + ImageObserver o) { return toolkit.checkImage(img, w, h, o); } public void createBuffers(int numBuffers, BufferCapabilities caps) - throws AWTException + throws AWTException { // FIXME } @@ -516,9 +516,9 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer public Graphics getGraphics() { if( backBuffer == null ) - { - Rectangle r = owner.getBounds(); - backBuffer = new QtImage( r.width, r.height ); + { + Rectangle r = owner.getBounds(); + backBuffer = new QtImage( r.width, r.height ); } return backBuffer.getDirectGraphics( this ); } @@ -533,16 +533,16 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer public Point getLocationOnScreen() { Point p = new Point(); - synchronized( p ) + synchronized( p ) { - getLocationOnScreenNative( p ); - try - { - p.wait(); // Wait for the thing to be created. - } - catch(InterruptedException e) - { - } + getLocationOnScreenNative( p ); + try + { + p.wait(); // Wait for the thing to be created. + } + catch(InterruptedException e) + { + } } return p; } @@ -552,16 +552,16 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer private Dimension getSize(boolean preferred) { Dimension d = new Dimension(); - synchronized( d ) + synchronized( d ) { - getSizeNative(d, preferred); - try - { - d.wait(); // Wait for the thing to be created. - } - catch(InterruptedException e) - { - } + getSizeNative(d, preferred); + try + { + d.wait(); // Wait for the thing to be created. + } + catch(InterruptedException e) + { + } } return d; } @@ -570,7 +570,7 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer { return getSize( false ); } - + public Dimension getPreferredSize() { return getSize( true ); @@ -582,7 +582,7 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer } public native boolean handlesWheelScrolling(); - + public void hide() { setVisible(false); @@ -610,17 +610,17 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer public native void requestFocus(); - public boolean requestFocus (Component source, boolean bool1, - boolean bool2, long x) + public boolean requestFocus (Component source, boolean bool1, + boolean bool2, long x) { // FIXME return true; } public void reshape(int x, - int y, - int width, - int height) + int y, + int width, + int height) { setBounds( x, y, width, height ); } @@ -662,7 +662,7 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer return; setGround(c.getRed(), c.getGreen(), c.getBlue(), true); } - + public native void setVisible(boolean b); public void show() @@ -678,71 +678,71 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer switch (eventID) { case ComponentEvent.COMPONENT_SHOWN: - QtToolkit.repaintThread.queueComponent(this); + QtToolkit.repaintThread.queueComponent(this); break; case PaintEvent.PAINT: - case PaintEvent.UPDATE: - r = ((PaintEvent)e).getUpdateRect(); - QtToolkit.repaintThread.queueComponent(this, r.x, r.y, - r.width, r.height); + case PaintEvent.UPDATE: + r = ((PaintEvent)e).getUpdateRect(); + QtToolkit.repaintThread.queueComponent(this, r.x, r.y, + r.width, r.height); break; case KeyEvent.KEY_PRESSED: - break; + break; case KeyEvent.KEY_RELEASED: - break; + break; } } /** * paint() is called back from the native side in response to a native * repaint event. - */ + */ public void paint(Graphics g) { Rectangle r = g.getClipBounds(); if (backBuffer != null) - backBuffer.drawPixelsScaledFlipped ((QtGraphics) g, - 0, 0, 0, /* bg colors */ - false, false, /* no flipping */ - r.x, r.y, r.width, r.height, - r.x, r.y, r.width, r.height, - false ); /* no compositing */ + backBuffer.drawPixelsScaledFlipped ((QtGraphics) g, + 0, 0, 0, /* bg colors */ + false, false, /* no flipping */ + r.x, r.y, r.width, r.height, + r.x, r.y, r.width, r.height, + false ); /* no compositing */ } public void paintBackBuffer() throws InterruptedException { if( backBuffer != null ) { - backBuffer.clear(); - Graphics2D bbg = (Graphics2D)backBuffer.getGraphics(); - owner.paint(bbg); - bbg.dispose(); + backBuffer.clear(); + Graphics2D bbg = (Graphics2D)backBuffer.getGraphics(); + owner.paint(bbg); + bbg.dispose(); } } - public void paintBackBuffer(int x, int y, int w, int h) + public void paintBackBuffer(int x, int y, int w, int h) throws InterruptedException { if( backBuffer != null ) { - Graphics2D bbg = (Graphics2D)backBuffer.getGraphics(); - bbg.setBackground( getNativeBackground() ); - bbg.clearRect(x, y, w, h); - bbg.setClip(x, y, w, h); - owner.paint(bbg); - bbg.dispose(); + Graphics2D bbg = (Graphics2D)backBuffer.getGraphics(); + bbg.setBackground( getNativeBackground() ); + bbg.clearRect(x, y, w, h); + bbg.setClip(x, y, w, h); + owner.paint(bbg); + bbg.dispose(); } } public boolean prepareImage(Image img, - int w, - int h, - ImageObserver o) + int w, + int h, + ImageObserver o) { return toolkit.prepareImage(img, w, h, o); } - + public void print(Graphics g) { // FIXME @@ -752,16 +752,16 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer * Schedules a timed repaint. */ public void repaint(long tm, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { if( tm <= 0 ) { - QtToolkit.repaintThread.queueComponent(this, x, y, w, h); - return; - } + QtToolkit.repaintThread.queueComponent(this, x, y, w, h); + return; + } Timer t = new Timer(); t.schedule(new RepaintTimerTask(this, x, y, w, h), tm); } @@ -778,20 +778,20 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer /** * Timed repainter */ - private class RepaintTimerTask extends TimerTask - { + private class RepaintTimerTask extends TimerTask + { private int x, y, w, h; private QtComponentPeer peer; RepaintTimerTask(QtComponentPeer peer, int x, int y, int w, int h) - { + { this.x=x; this.y=y; this.w=w; - this.h=h; + this.h=h; this.peer=peer; } public void run() - { + { QtToolkit.repaintThread.queueComponent(peer, x, y, w, h); } } @@ -808,7 +808,7 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer public void setBounds(int x, int y, int width, int height, int z) { // TODO Auto-generated method stub - + } public boolean isReparentSupported() diff --git a/gnu/java/awt/peer/qt/QtContainerPeer.java b/gnu/java/awt/peer/qt/QtContainerPeer.java index ec04b0567..ee2873730 100644 --- a/gnu/java/awt/peer/qt/QtContainerPeer.java +++ b/gnu/java/awt/peer/qt/QtContainerPeer.java @@ -60,13 +60,13 @@ public class QtContainerPeer extends QtComponentPeer implements ContainerPeer // ************ Public methods ********************* public void beginLayout() { - // FIXME + // FIXME } public void beginValidate() { } - + public void endLayout() { QtUpdate(); @@ -75,7 +75,7 @@ public class QtContainerPeer extends QtComponentPeer implements ContainerPeer public void endValidate() { } - + public Insets getInsets() { return new Insets(0, 0, 0, 0); @@ -101,15 +101,12 @@ public class QtContainerPeer extends QtComponentPeer implements ContainerPeer public void cancelPendingPaint(int x, int y, int width, int height) { // TODO Auto-generated method stub - + } public void restack() { // TODO Auto-generated method stub - + } } - - - diff --git a/gnu/java/awt/peer/qt/QtDialogPeer.java b/gnu/java/awt/peer/qt/QtDialogPeer.java index 23e5c0653..2f2c25550 100644 --- a/gnu/java/awt/peer/qt/QtDialogPeer.java +++ b/gnu/java/awt/peer/qt/QtDialogPeer.java @@ -68,6 +68,6 @@ public class QtDialogPeer extends QtWindowPeer implements DialogPeer public void setBounds(int x, int y, int width, int height) { setBoundsNative(x, y, width, height, - !((Dialog)owner).isResizable()); + !((Dialog)owner).isResizable()); } } diff --git a/gnu/java/awt/peer/qt/QtEmbeddedWindowPeer.java b/gnu/java/awt/peer/qt/QtEmbeddedWindowPeer.java index 0f859b78e..de76cd17f 100644 --- a/gnu/java/awt/peer/qt/QtEmbeddedWindowPeer.java +++ b/gnu/java/awt/peer/qt/QtEmbeddedWindowPeer.java @@ -40,7 +40,7 @@ package gnu.java.awt.peer.qt; import java.awt.Component; import gnu.java.awt.peer.EmbeddedWindowPeer; -/** +/** * Embedded window peer for applets. * FIXME: EmbeddedWindowPeer and this class should extend Window, NOT Frame. */ @@ -50,7 +50,7 @@ public class QtEmbeddedWindowPeer extends QtFramePeer implements EmbeddedWindowP { super( kit, owner ); } - + protected native void init(); protected void setup() diff --git a/gnu/java/awt/peer/qt/QtFileDialogPeer.java b/gnu/java/awt/peer/qt/QtFileDialogPeer.java index 4937031aa..06943d955 100644 --- a/gnu/java/awt/peer/qt/QtFileDialogPeer.java +++ b/gnu/java/awt/peer/qt/QtFileDialogPeer.java @@ -81,4 +81,3 @@ public class QtFileDialogPeer extends QtDialogPeer implements FileDialogPeer // FIXME } } - diff --git a/gnu/java/awt/peer/qt/QtFontMetrics.java b/gnu/java/awt/peer/qt/QtFontMetrics.java index 3b182b5ea..1998339dc 100644 --- a/gnu/java/awt/peer/qt/QtFontMetrics.java +++ b/gnu/java/awt/peer/qt/QtFontMetrics.java @@ -93,7 +93,7 @@ public class QtFontMetrics extends FontMetrics native Rectangle2D getStringBounds(String s); // ****************** Package private *************************** - + native boolean canDisplay( int c ); // ****************** Public methods **************************** diff --git a/gnu/java/awt/peer/qt/QtFontPeer.java b/gnu/java/awt/peer/qt/QtFontPeer.java index bd16daf28..03ed1d2df 100644 --- a/gnu/java/awt/peer/qt/QtFontPeer.java +++ b/gnu/java/awt/peer/qt/QtFontPeer.java @@ -103,17 +103,17 @@ public class QtFontPeer extends ClasspathFontPeer return metrics.canDisplay( c ); } - public int canDisplayUpTo (Font font, CharacterIterator i, - int start, int limit) + public int canDisplayUpTo (Font font, CharacterIterator i, + int start, int limit) { int index = start; char c = i.setIndex( index ); while( index <= limit ) { - if(!canDisplay(font, c)) - return index; - index++; - c = i.next(); + if(!canDisplay(font, c)) + return index; + index++; + c = i.next(); } return -1; } @@ -149,23 +149,23 @@ public class QtFontPeer extends ClasspathFontPeer } public GlyphVector createGlyphVector (Font font, - FontRenderContext frc, - CharacterIterator ci) + FontRenderContext frc, + CharacterIterator ci) { throw new UnsupportedOperationException(); } - public GlyphVector createGlyphVector (Font font, - FontRenderContext ctx, - int[] glyphCodes) + public GlyphVector createGlyphVector (Font font, + FontRenderContext ctx, + int[] glyphCodes) { throw new UnsupportedOperationException(); } - public GlyphVector layoutGlyphVector (Font font, - FontRenderContext frc, - char[] chars, int start, - int limit, int flags) + public GlyphVector layoutGlyphVector (Font font, + FontRenderContext frc, + char[] chars, int start, + int limit, int flags) { throw new UnsupportedOperationException(); } @@ -180,16 +180,16 @@ public class QtFontPeer extends ClasspathFontPeer throw new UnsupportedOperationException(); } - public LineMetrics getLineMetrics (Font font, - CharacterIterator ci, - int begin, int limit, - FontRenderContext rc) + public LineMetrics getLineMetrics (Font font, + CharacterIterator ci, + int begin, int limit, + FontRenderContext rc) { throw new UnsupportedOperationException(); } - public Rectangle2D getMaxCharBounds (Font font, - FontRenderContext rc) + public Rectangle2D getMaxCharBounds (Font font, + FontRenderContext rc) { throw new UnsupportedOperationException(); } diff --git a/gnu/java/awt/peer/qt/QtFramePeer.java b/gnu/java/awt/peer/qt/QtFramePeer.java index e3b578933..d5162106f 100644 --- a/gnu/java/awt/peer/qt/QtFramePeer.java +++ b/gnu/java/awt/peer/qt/QtFramePeer.java @@ -75,7 +75,7 @@ public class QtFramePeer extends QtWindowPeer implements FramePeer private native int menuBarHeight(); // ************ Public methods ********************* - + public void destroy() { dispose(); @@ -83,13 +83,13 @@ public class QtFramePeer extends QtWindowPeer implements FramePeer public int getState() { - // FIXME + // FIXME return theState; } public Insets getInsets() { - int mbHeight = ( ((Frame)owner).getMenuBar() != null ) ? + int mbHeight = ( ((Frame)owner).getMenuBar() != null ) ? menuBarHeight() : 0; return new Insets(mbHeight, 0, 0, 0); } @@ -98,30 +98,30 @@ public class QtFramePeer extends QtWindowPeer implements FramePeer { if (im instanceof QtImage) setIcon( (QtImage)im ); - else + else setIcon( new QtImage( im.getSource() ) ); } public void setMaximizedBounds(Rectangle rect) { // FIXME - } + } public void setMenuBar(MenuBar mb) { if( mb != null ) { - QtMenuBarPeer mbpeer = (QtMenuBarPeer)mb.getPeer(); - if( mbpeer == null ) - { - mb.addNotify(); - mbpeer = (QtMenuBarPeer)mb.getPeer(); - if( mbpeer == null ) - throw new IllegalStateException("No menu bar peer."); - } - mbpeer.addMenus(); - setMenu( mbpeer ); - } + QtMenuBarPeer mbpeer = (QtMenuBarPeer)mb.getPeer(); + if( mbpeer == null ) + { + mb.addNotify(); + mbpeer = (QtMenuBarPeer)mb.getPeer(); + if( mbpeer == null ) + throw new IllegalStateException("No menu bar peer."); + } + mbpeer.addMenus(); + setMenu( mbpeer ); + } else setMenu( null ); } @@ -140,13 +140,13 @@ public class QtFramePeer extends QtWindowPeer implements FramePeer public void setBoundsPrivate(int x, int y, int width, int height) { // TODO Auto-generated method stub - + } public void updateAlwaysOnTop() { // TODO Auto-generated method stub - + } public boolean requestWindowFocus() diff --git a/gnu/java/awt/peer/qt/QtGraphics.java b/gnu/java/awt/peer/qt/QtGraphics.java index 5694e8d20..f68cc0dbd 100644 --- a/gnu/java/awt/peer/qt/QtGraphics.java +++ b/gnu/java/awt/peer/qt/QtGraphics.java @@ -75,7 +75,7 @@ import java.util.Map; /** * QtGraphics is an abstract implementation of Graphics2D over a QPainter - * object. This is to be subclassed for different drawing contexts, + * object. This is to be subclassed for different drawing contexts, * which may have different requirements. */ public abstract class QtGraphics extends Graphics2D @@ -100,9 +100,9 @@ public abstract class QtGraphics extends Graphics2D protected Paint currentPaint; // current paint protected RenderingHints renderingHints; // the rendering hints. - /** + /** * Owner Graphics, used by subcontext created by create() - * to avoid GC of the original context. + * to avoid GC of the original context. */ Graphics parent; @@ -154,12 +154,12 @@ public abstract class QtGraphics extends Graphics2D { AffineTransform current = getTransform(); setTransform( identity ); - setClip( initialClip ); + setClip( initialClip ); setTransform( current ); } - protected native void initImage(QtImage image); - protected native void initVolatileImage(QtVolatileImage image); + protected native void initImage(QtImage image); + protected native void initVolatileImage(QtVolatileImage image); // Creates a new native QPainter object on the same context. private native void cloneNativeContext( QtGraphics parent ); @@ -174,10 +174,10 @@ public abstract class QtGraphics extends Graphics2D private native void setNativeStroke(QPen p); private native void setNativeComposite(int alphaMode); private native void drawStringNative(String string, double x, double y); - private native void setLinearGradient(int r1, int g1, int b1, - int r2, int g2, int b2, - double x1, double y1, - double x2, double y2, boolean cyclic); + private native void setLinearGradient(int r1, int g1, int b1, + int r2, int g2, int b2, + double x1, double y1, + double x2, double y2, boolean cyclic); private native void setAlphaNative(double alpha); private native void setFontNative(QtFontPeer font); private native QPainterPath getClipNative(); @@ -195,8 +195,8 @@ public abstract class QtGraphics extends Graphics2D */ public abstract Graphics create(); - public abstract void copyArea(int x, int y, int width, int height, - int dx, int dy); + public abstract void copyArea(int x, int y, int width, int height, + int dx, int dy); public abstract GraphicsConfiguration getDeviceConfiguration(); @@ -210,7 +210,7 @@ public abstract class QtGraphics extends Graphics2D { if( c == null ) c = Color.white; - this.color = c; + this.color = c; int alpha = (int)(c.getAlpha() * currentAlpha); setColor(c.getRed(), c.getGreen(), c.getBlue(), alpha); } @@ -238,15 +238,15 @@ public abstract class QtGraphics extends Graphics2D { if( onStroke ) { - Shape stroked = currentStroke.createStrokedShape( s ); - return stroked.intersects( (double)rect.x, (double)rect.y, - (double)rect.width, (double)rect.height ); + Shape stroked = currentStroke.createStrokedShape( s ); + return stroked.intersects( (double)rect.x, (double)rect.y, + (double)rect.width, (double)rect.height ); } - return s.intersects( (double)rect.x, (double)rect.y, - (double)rect.width, (double)rect.height ); + return s.intersects( (double)rect.x, (double)rect.y, + (double)rect.width, (double)rect.height ); } - // ******************* Font *********************** + // ******************* Font *********************** public Font getFont() { return font; @@ -287,7 +287,7 @@ public abstract class QtGraphics extends Graphics2D } public Shape getClip() - { + { return getClipNative().getPath(); } @@ -307,7 +307,7 @@ public abstract class QtGraphics extends Graphics2D // ***************** Drawing primitives ********************* public void draw(Shape s) - { + { if( nativeStroking ) drawNative( new QPainterPath(s) ); else @@ -330,14 +330,14 @@ public abstract class QtGraphics extends Graphics2D public void drawRect(int x, int y, int width, int height) { if( nativeStroking ) - drawNative( new QPainterPath((double)x, (double)y, - (double)width, (double)height) ); + drawNative( new QPainterPath((double)x, (double)y, + (double)width, (double)height) ); else fillNative( new QPainterPath - ( currentStroke.createStrokedShape - (new Rectangle2D.Double - ((double)x, (double)y, - (double)width, (double)height) ) ) ); + ( currentStroke.createStrokedShape + (new Rectangle2D.Double + ((double)x, (double)y, + (double)width, (double)height) ) ) ); } public void fillRect(int x, int y, int width, int height) @@ -353,24 +353,24 @@ public abstract class QtGraphics extends Graphics2D setColor( c ); } - public void drawRoundRect(int x, int y, int width, int height, - int arcWidth, int arcHeight) + public void drawRoundRect(int x, int y, int width, int height, + int arcWidth, int arcHeight) { - draw( new RoundRectangle2D.Double(x, y, width, height, - arcWidth, arcHeight) ); + draw( new RoundRectangle2D.Double(x, y, width, height, + arcWidth, arcHeight) ); } - public void fillRoundRect(int x, int y, int width, int height, - int arcWidth, int arcHeight) + public void fillRoundRect(int x, int y, int width, int height, + int arcWidth, int arcHeight) { - fill( new RoundRectangle2D.Double(x, y, width, height, - arcWidth, arcHeight) ); + fill( new RoundRectangle2D.Double(x, y, width, height, + arcWidth, arcHeight) ); } public void drawOval(int x, int y, int width, int height) { - draw( new Ellipse2D.Double((double)x, (double)y, - (double)width, (double)height) ); + draw( new Ellipse2D.Double((double)x, (double)y, + (double)width, (double)height) ); } public void fillOval(int x, int y, int width, int height) @@ -378,18 +378,18 @@ public abstract class QtGraphics extends Graphics2D fill( new Ellipse2D.Double(x, y, width, height) ); } - public void drawArc(int x, int y, int width, int height, - int arcStart, int arcAngle) + public void drawArc(int x, int y, int width, int height, + int arcStart, int arcAngle) { - draw( new Arc2D.Double(x, y, width, height, arcStart, arcAngle, - Arc2D.OPEN) ); + draw( new Arc2D.Double(x, y, width, height, arcStart, arcAngle, + Arc2D.OPEN) ); } - public void fillArc(int x, int y, int width, int height, - int arcStart, int arcAngle) + public void fillArc(int x, int y, int width, int height, + int arcStart, int arcAngle) { - fill( new Arc2D.Double(x, y, width, height, arcStart, arcAngle, - Arc2D.CHORD) ); + fill( new Arc2D.Double(x, y, width, height, arcStart, arcAngle, + Arc2D.CHORD) ); } public void drawPolyline(int xPoints[], int yPoints[], int npoints) @@ -428,17 +428,17 @@ public abstract class QtGraphics extends Graphics2D { // FIXME - to something more correct ? String s = ""; - for(char c = ci.first(); c != CharacterIterator.DONE; c = ci.next()) + for(char c = ci.first(); c != CharacterIterator.DONE; c = ci.next()) s += c; drawString(s, x, y); } - public void drawString(AttributedCharacterIterator ci, - float x, float y) + public void drawString(AttributedCharacterIterator ci, + float x, float y) { // FIXME - to something more correct ? String s = ""; - for(char c = ci.first(); c != CharacterIterator.DONE; c = ci.next()) + for(char c = ci.first(); c != CharacterIterator.DONE; c = ci.next()) s += c; drawString(s, x, y); } @@ -450,68 +450,68 @@ public abstract class QtGraphics extends Graphics2D // ******************* Image drawing ****************************** public boolean drawImage(Image image, - AffineTransform Tx, - ImageObserver obs) + AffineTransform Tx, + ImageObserver obs) { if (image instanceof QtImage) return ((QtImage)image).drawImage(this, new QMatrix( Tx ), obs); - return (new QtImage(image.getSource())).drawImage(this, - new QMatrix( Tx ), - obs); + return (new QtImage(image.getSource())).drawImage(this, + new QMatrix( Tx ), + obs); } - public boolean drawImage(Image image, int x, int y, Color bgcolor, - ImageObserver observer) + public boolean drawImage(Image image, int x, int y, Color bgcolor, + ImageObserver observer) { if (image instanceof QtImage) return ((QtImage)image).drawImage (this, x, y, bgcolor, observer); - return (new QtImage(image.getSource())).drawImage (this, x, y, - bgcolor, observer); + return (new QtImage(image.getSource())).drawImage (this, x, y, + bgcolor, observer); } - public boolean drawImage(Image image, - int dx1, int dy1, int dx2, int dy2, - int sx1, int sy1, int sx2, int sy2, - Color bgcolor, ImageObserver observer) + public boolean drawImage(Image image, + int dx1, int dy1, int dx2, int dy2, + int sx1, int sy1, int sx2, int sy2, + Color bgcolor, ImageObserver observer) { if (image instanceof QtImage) - return ((QtImage)image).drawImage(this, dx1, dy1, dx2, dy2, - sx1, sy1, sx2, sy2, bgcolor, observer); + return ((QtImage)image).drawImage(this, dx1, dy1, dx2, dy2, + sx1, sy1, sx2, sy2, bgcolor, observer); - return (new QtImage(image.getSource())).drawImage(this, dx1, dy1, - dx2, dy2, - sx1, sy1, sx2, sy2, - bgcolor, observer); + return (new QtImage(image.getSource())).drawImage(this, dx1, dy1, + dx2, dy2, + sx1, sy1, sx2, sy2, + bgcolor, observer); } - public boolean drawImage(Image image, int x, int y, - int width, int height, Color bgcolor, - ImageObserver observer) + public boolean drawImage(Image image, int x, int y, + int width, int height, Color bgcolor, + ImageObserver observer) { if (image instanceof QtImage) - return ((QtImage)image).drawImage (this, x, y, width, height, - bgcolor, observer); - return (new QtImage(image.getSource())).drawImage (this, x, y, - width, height, - bgcolor, observer); + return ((QtImage)image).drawImage (this, x, y, width, height, + bgcolor, observer); + return (new QtImage(image.getSource())).drawImage (this, x, y, + width, height, + bgcolor, observer); } - - public boolean drawImage(Image image, int x, int y, int width, int height, - ImageObserver observer) + + public boolean drawImage(Image image, int x, int y, int width, int height, + ImageObserver observer) { return drawImage(image, x, y, width, height, null, observer); } - + public boolean drawImage(Image image, int x, int y, ImageObserver observer) { return drawImage(image, x, y, null, observer); } - + public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) { - return drawImage(image, dx1, dy1, dx2, dy2, - sx1, sy1, sx2, sy2, null, observer); + return drawImage(image, dx1, dy1, dx2, dy2, + sx1, sy1, sx2, sy2, null, observer); } // *********************** Transform methods ************************* @@ -531,7 +531,7 @@ public abstract class QtGraphics extends Graphics2D xform.rotate( theta ); setQtTransform( new QMatrix( xform ) ); } - + public void rotate(double theta, double x, double y) { xform.rotate(theta, x, y); @@ -549,7 +549,7 @@ public abstract class QtGraphics extends Graphics2D xform.shear(shx, shy); setQtTransform( new QMatrix( xform ) ); } - + public void transform(AffineTransform Tx) { xform.concatenate( Tx ); @@ -572,14 +572,14 @@ public abstract class QtGraphics extends Graphics2D { try // ..to convert the stroke into a native one. { - QPen pen = new QPen( s ); - nativeStroking = true; - setNativeStroke( pen ); - setColor( color ); - } + QPen pen = new QPen( s ); + nativeStroking = true; + setNativeStroke( pen ); + setColor( color ); + } catch (IllegalArgumentException e) { - nativeStroking = false; + nativeStroking = false; } currentStroke = s; } @@ -593,27 +593,27 @@ public abstract class QtGraphics extends Graphics2D { if( comp == null) { - setNativeComposite( AlphaComposite.SRC_OVER ); - return; + setNativeComposite( AlphaComposite.SRC_OVER ); + return; } if( comp instanceof AlphaComposite ) { - if( ((AlphaComposite)comp).getRule() != AlphaComposite.XOR ) - setAlpha( ((AlphaComposite)comp).getAlpha() ); - setNativeComposite( ((AlphaComposite)comp).getRule() ); - composite = comp; + if( ((AlphaComposite)comp).getRule() != AlphaComposite.XOR ) + setAlpha( ((AlphaComposite)comp).getAlpha() ); + setNativeComposite( ((AlphaComposite)comp).getRule() ); + composite = comp; } else { - // FIXME: this check is only required "if this Graphics2D - // context is drawing to a Component on the display screen". - SecurityManager sm = System.getSecurityManager(); - if (sm != null) - sm.checkPermission(new AWTPermission("readDisplayPixels")); - - throw new UnsupportedOperationException("We don't support custom"+ - " composites yet."); + // FIXME: this check is only required "if this Graphics2D + // context is drawing to a Component on the display screen". + SecurityManager sm = System.getSecurityManager(); + if (sm != null) + sm.checkPermission(new AWTPermission("readDisplayPixels")); + + throw new UnsupportedOperationException("We don't support custom"+ + " composites yet."); } } @@ -625,28 +625,28 @@ public abstract class QtGraphics extends Graphics2D public void setPaint(Paint p) { if( p == null ) - return; + return; // FIXME currentPaint = p; if( p instanceof GradientPaint ) { - GradientPaint lg = (GradientPaint)p; - setLinearGradient(lg.getColor1().getRed(), lg.getColor1().getGreen(), - lg.getColor1().getBlue(), lg.getColor2().getRed(), - lg.getColor2().getGreen(), lg.getColor2().getBlue(), - lg.getPoint1().getX(), lg.getPoint1().getY(), - lg.getPoint2().getX(), lg.getPoint2().getY(), - lg.isCyclic() ); - return; + GradientPaint lg = (GradientPaint)p; + setLinearGradient(lg.getColor1().getRed(), lg.getColor1().getGreen(), + lg.getColor1().getBlue(), lg.getColor2().getRed(), + lg.getColor2().getGreen(), lg.getColor2().getBlue(), + lg.getPoint1().getX(), lg.getPoint1().getY(), + lg.getPoint2().getX(), lg.getPoint2().getY(), + lg.isCyclic() ); + return; } if( p instanceof Color ) { - setColor((Color) p); - return; + setColor((Color) p); + return; } throw new UnsupportedOperationException("We don't support custom"+ - " paints yet."); + " paints yet."); } public Paint getPaint() @@ -671,7 +671,7 @@ public abstract class QtGraphics extends Graphics2D { return (RenderingHints) renderingHints.clone(); } - + public void setRenderingHints(Map<?,?> hints) { renderingHints = new RenderingHints( null ); @@ -711,5 +711,4 @@ public abstract class QtGraphics extends Graphics2D { throw new UnsupportedOperationException("Not implemented yet"); } -} - +} diff --git a/gnu/java/awt/peer/qt/QtGraphicsEnvironment.java b/gnu/java/awt/peer/qt/QtGraphicsEnvironment.java index 15a015922..dec4db2c8 100644 --- a/gnu/java/awt/peer/qt/QtGraphicsEnvironment.java +++ b/gnu/java/awt/peer/qt/QtGraphicsEnvironment.java @@ -55,7 +55,7 @@ public class QtGraphicsEnvironment extends GraphicsEnvironment toolkit = tk; // Get the number of screens from Qt. int n = toolkit.numScreens(); - + /** * Create the screen device objects */ @@ -77,7 +77,7 @@ public class QtGraphicsEnvironment extends GraphicsEnvironment { return toolkit.getFontList(); } - + public String[] getAvailableFontFamilyNames(Locale l) { return getAvailableFontFamilyNames(); @@ -103,5 +103,3 @@ public class QtGraphicsEnvironment extends GraphicsEnvironment return toolkit; } } - - diff --git a/gnu/java/awt/peer/qt/QtImage.java b/gnu/java/awt/peer/qt/QtImage.java index b6fbb1dca..b7e50ea25 100644 --- a/gnu/java/awt/peer/qt/QtImage.java +++ b/gnu/java/awt/peer/qt/QtImage.java @@ -95,11 +95,11 @@ public class QtImage extends Image /* * The 32-bit AARRGGBB format the uses. */ - static ColorModel nativeModel = new DirectColorModel(32, - 0x00FF0000, - 0x0000FF00, - 0x000000FF, - 0xFF000000); + static ColorModel nativeModel = new DirectColorModel(32, + 0x00FF0000, + 0x0000FF00, + 0x000000FF, + 0xFF000000); /** * HashMap of Graphics objects painting on this Image. */ @@ -126,7 +126,7 @@ public class QtImage extends Image private native void setPixels(int[] pixels); /** - * Loads an image + * Loads an image */ private native boolean loadImage(String name); @@ -153,35 +153,35 @@ public class QtImage extends Image /** * Draws the image optionally composited. */ - native void drawPixels (QtGraphics gc, - int bg_red, int bg_green, int bg_blue, - int x, int y, - boolean composite); + native void drawPixels (QtGraphics gc, + int bg_red, int bg_green, int bg_blue, + int x, int y, + boolean composite); /** * Draws the image, optionally scaled and composited. */ - private native void drawPixelsScaled (QtGraphics gc, - int bg_red, int bg_green, int bg_blue, - int x, int y, int width, int height, - boolean composite); + private native void drawPixelsScaled (QtGraphics gc, + int bg_red, int bg_green, int bg_blue, + int x, int y, int width, int height, + boolean composite); /** * Draws the image transformed. */ private native void drawPixelsTransformed (QtGraphics gc, QMatrix transform); - + /** * Draws the image scaled flipped and optionally composited. */ - native void drawPixelsScaledFlipped (QtGraphics gc, - int bg_red, int bg_green, - int bg_blue, - boolean flipX, boolean flipY, - int srcX, int srcY, - int srcWidth, int srcHeight, - int dstX, int dstY, - int dstWidth, int dstHeight, - boolean composite); + native void drawPixelsScaledFlipped (QtGraphics gc, + int bg_red, int bg_green, + int bg_blue, + boolean flipX, boolean flipY, + int srcX, int srcY, + int srcWidth, int srcHeight, + int dstX, int dstY, + int dstWidth, int dstHeight, + boolean composite); /** * Creates the image from an ImageProducer. May result in an error image. @@ -216,13 +216,13 @@ public class QtImage extends Image byte[] buf = new byte[5000]; int n = 0; - while ( (n = bis.read( buf )) != -1 ) - baos.write(buf, 0, n); + while ( (n = bis.read( buf )) != -1 ) + baos.write(buf, 0, n); bis.close(); } catch(IOException e) { - throw new IllegalArgumentException("Couldn't load image."); + throw new IllegalArgumentException("Couldn't load image."); } if ( loadImageFromData( baos.toByteArray() ) != true ) throw new IllegalArgumentException("Couldn't load image."); @@ -245,19 +245,19 @@ public class QtImage extends Image props = new Hashtable(); try { - String fn = f.getCanonicalPath(); - if (loadImage( fn ) != true) - { - errorLoading = true; - isLoaded = false; - return; - } - } + String fn = f.getCanonicalPath(); + if (loadImage( fn ) != true) + { + errorLoading = true; + isLoaded = false; + return; + } + } catch(IOException e) { - errorLoading = true; - isLoaded = false; - return; + errorLoading = true; + isLoaded = false; + return; } errorLoading = false; isLoaded = true; @@ -315,8 +315,8 @@ public class QtImage extends Image /** * Callback from the image consumer. */ - public void setImage(int width, int height, - int[] pixels, Hashtable properties) + public void setImage(int width, int height, + int[] pixels, Hashtable properties) { this.width = width; this.height = height; @@ -324,8 +324,8 @@ public class QtImage extends Image if (width <= 0 || height <= 0 || pixels == null) { - errorLoading = true; - return; + errorLoading = true; + return; } isLoaded = true; @@ -343,12 +343,12 @@ public class QtImage extends Image return width; } - + public int getHeight (ImageObserver observer) { if (addObserver(observer)) return -1; - + return height; } @@ -356,7 +356,7 @@ public class QtImage extends Image { if (addObserver(observer)) return UndefinedProperty; - + Object value = props.get (name); return (value == null) ? UndefinedProperty : value; } @@ -368,8 +368,8 @@ public class QtImage extends Image { if (!isLoaded) return null; - return new MemoryImageSource(width, height, nativeModel, getPixels(), - 0, width); + return new MemoryImageSource(width, height, nativeModel, getPixels(), + 0, width); } void putPainter(QtImageGraphics g) @@ -391,7 +391,7 @@ public class QtImage extends Image */ public Graphics getGraphics () { - if (!isLoaded || killFlag) + if (!isLoaded || killFlag) return null; return new QtImageGraphics(this); @@ -402,28 +402,28 @@ public class QtImage extends Image */ Graphics getDirectGraphics(QtComponentPeer peer) { - if (!isLoaded) + if (!isLoaded) return null; return new QtImageDirectGraphics(this, peer); } - + /** * Returns a scaled instance of this image. */ public Image getScaledInstance(int width, - int height, - int hints) + int height, + int hints) { if (width <= 0 || height <= 0) throw new IllegalArgumentException("Width and height of scaled bitmap"+ - "must be >= 0"); + "must be >= 0"); return new QtImage(this, width, height, hints); } /** - * If the image is loaded and comes from an ImageProducer, + * If the image is loaded and comes from an ImageProducer, * regenerate the image from there. * * I have no idea if this is ever actually used. Since QtImage can't be @@ -434,10 +434,10 @@ public class QtImage extends Image { if (isLoaded && source != null) { - observers = new Vector(); - isLoaded = false; - freeImage(); - source.startProduction(new QtImageConsumer(this, source)); + observers = new Vector(); + isLoaded = false; + freeImage(); + source.startProduction(new QtImageConsumer(this, source)); } } @@ -450,11 +450,11 @@ public class QtImage extends Image { if (isLoaded) { - if( painters == null || painters.isEmpty() ) - freeImage(); - else - killFlag = true; // can't destroy image yet. - // Do so when all painters are gone. + if( painters == null || painters.isEmpty() ) + freeImage(); + else + killFlag = true; // can't destroy image yet. + // Do so when all painters are gone. } } @@ -465,12 +465,12 @@ public class QtImage extends Image { if (addObserver(observer)) { - if (errorLoading == true) - return ImageObserver.ERROR; - else - return 0; + if (errorLoading == true) + return ImageObserver.ERROR; + else + return 0; } - + return ImageObserver.ALLBITS | ImageObserver.WIDTH | ImageObserver.HEIGHT; } @@ -480,7 +480,7 @@ public class QtImage extends Image * Draws an image with eventual scaling/transforming. */ public boolean drawImage (QtGraphics g, QMatrix matrix, - ImageObserver observer) + ImageObserver observer) { if (addObserver(observer)) return false; @@ -495,14 +495,14 @@ public class QtImage extends Image * compositing with a background color. */ public boolean drawImage (QtGraphics g, int x, int y, - Color bgcolor, ImageObserver observer) + Color bgcolor, ImageObserver observer) { if (addObserver(observer)) return false; if(bgcolor != null) - drawPixels(g, bgcolor.getRed (), bgcolor.getGreen (), - bgcolor.getBlue (), x, y, true); + drawPixels(g, bgcolor.getRed (), bgcolor.getGreen (), + bgcolor.getBlue (), x, y, true); else drawPixels(g, 0, 0, 0, x, y, false); @@ -510,18 +510,18 @@ public class QtImage extends Image } /** - * Draws an image to the QtGraphics context, at (x,y) scaled to + * Draws an image to the QtGraphics context, at (x,y) scaled to * width and height, with optional compositing with a background color. */ public boolean drawImage (QtGraphics g, int x, int y, int width, int height, - Color bgcolor, ImageObserver observer) + Color bgcolor, ImageObserver observer) { if (addObserver(observer)) return false; if(bgcolor != null) - drawPixelsScaled(g, bgcolor.getRed (), bgcolor.getGreen (), - bgcolor.getBlue (), x, y, width, height, true); + drawPixelsScaled(g, bgcolor.getRed (), bgcolor.getGreen (), + bgcolor.getBlue (), x, y, width, height, true); else drawPixelsScaled(g, 0, 0, 0, x, y, width, height, false); @@ -531,9 +531,9 @@ public class QtImage extends Image /** * Draws an image with eventual scaling/transforming. */ - public boolean drawImage (QtGraphics g, int dx1, int dy1, int dx2, int dy2, - int sx1, int sy1, int sx2, int sy2, - Color bgcolor, ImageObserver observer) + public boolean drawImage (QtGraphics g, int dx1, int dy1, int dx2, int dy2, + int sx1, int sy1, int sx2, int sy2, + Color bgcolor, ImageObserver observer) { if (addObserver(observer)) return false; @@ -549,53 +549,53 @@ public class QtImage extends Image int dstX = (dx1 < dx2) ? dx1 : dx2; int dstY = (dy1 < dy2) ? dy1 : dy2; - // Clipping. This requires the dst to be scaled as well, + // Clipping. This requires the dst to be scaled as well, if (srcWidth > width) { - dstWidth = (int)((double)dstWidth*((double)width/(double)srcWidth)); - srcWidth = width - srcX; + dstWidth = (int)((double)dstWidth*((double)width/(double)srcWidth)); + srcWidth = width - srcX; } - if (srcHeight > height) + if (srcHeight > height) { - dstHeight = (int)((double)dstHeight*((double)height/(double)srcHeight)); - srcHeight = height - srcY; + dstHeight = (int)((double)dstHeight*((double)height/(double)srcHeight)); + srcHeight = height - srcY; } if (srcWidth + srcX > width) { - dstWidth = (int)((double)dstWidth * (double)(width - srcX)/(double)srcWidth); - srcWidth = width - srcX; + dstWidth = (int)((double)dstWidth * (double)(width - srcX)/(double)srcWidth); + srcWidth = width - srcX; } if (srcHeight + srcY > height) { - dstHeight = (int)((double)dstHeight * (double)(width - srcY)/(double)srcHeight); - srcHeight = height - srcY; + dstHeight = (int)((double)dstHeight * (double)(width - srcY)/(double)srcHeight); + srcHeight = height - srcY; } if ( srcWidth <= 0 || srcHeight <= 0 || dstWidth <= 0 || dstHeight <= 0) return true; if(bgcolor != null) - drawPixelsScaledFlipped (g, bgcolor.getRed (), bgcolor.getGreen (), - bgcolor.getBlue (), - flipX, flipY, - srcX, srcY, - srcWidth, srcHeight, - dstX, dstY, - dstWidth, dstHeight, - true); + drawPixelsScaledFlipped (g, bgcolor.getRed (), bgcolor.getGreen (), + bgcolor.getBlue (), + flipX, flipY, + srcX, srcY, + srcWidth, srcHeight, + dstX, dstY, + dstWidth, dstHeight, + true); else drawPixelsScaledFlipped (g, 0, 0, 0, flipX, flipY, - srcX, srcY, srcWidth, srcHeight, - dstX, dstY, dstWidth, dstHeight, - false); + srcX, srcY, srcWidth, srcHeight, + dstX, dstY, dstWidth, dstHeight, + false); return true; } - public native void copyArea(int x, int y, int width, int height, - int dx, int dy); + public native void copyArea(int x, int y, int width, int height, + int dx, int dy); // Private methods //////////////////////////////////////////////// @@ -604,19 +604,19 @@ public class QtImage extends Image */ private void deliver() { - int flags = ImageObserver.HEIGHT | + int flags = ImageObserver.HEIGHT | ImageObserver.WIDTH | ImageObserver.PROPERTIES | ImageObserver.ALLBITS; if (observers != null) for(int i=0; i < observers.size(); i++) - ((ImageObserver)observers.elementAt(i)). - imageUpdate(this, flags, 0, 0, width, height); + ((ImageObserver)observers.elementAt(i)). + imageUpdate(this, flags, 0, 0, width, height); observers = null; } - + /** * Adds an observer, if we need to. * @return true if an observer was added. @@ -625,10 +625,10 @@ public class QtImage extends Image { if (!isLoaded) { - if(observer != null) - if (!observers.contains (observer)) - observers.addElement (observer); - return true; + if(observer != null) + if (!observers.contains (observer)) + observers.addElement (observer); + return true; } return false; } diff --git a/gnu/java/awt/peer/qt/QtImageConsumer.java b/gnu/java/awt/peer/qt/QtImageConsumer.java index 7096c21e4..9883475f9 100644 --- a/gnu/java/awt/peer/qt/QtImageConsumer.java +++ b/gnu/java/awt/peer/qt/QtImageConsumer.java @@ -86,44 +86,44 @@ public class QtImageConsumer implements ImageConsumer public synchronized void setHints (int flags) { // This method informs us in which order the pixels are - // delivered, for progressive-loading support, etc. + // delivered, for progressive-loading support, etc. // Since we wait until it's all loaded, we can ignore the hints. } - public synchronized void setPixels (int x, int y, int width, int height, - ColorModel cm, byte[] pixels, - int offset, int scansize) + public synchronized void setPixels (int x, int y, int width, int height, + ColorModel cm, byte[] pixels, + int offset, int scansize) { setPixels (x, y, width, height, cm, convertPixels (pixels), offset, scansize); } - public synchronized void setPixels (int x, int y, int width, int height, - ColorModel cm, int[] pixels, - int offset, int scansize) + public synchronized void setPixels (int x, int y, int width, int height, + ColorModel cm, int[] pixels, + int offset, int scansize) { if (pixelCache == null) return; // Not sure this should ever happen. if (cm.equals(QtImage.nativeModel)) for (int i = 0; i < height; i++) - System.arraycopy (pixels, offset + (i * scansize), - pixelCache, (y + i) * this.width + x, - width); + System.arraycopy (pixels, offset + (i * scansize), + pixelCache, (y + i) * this.width + x, + width); else { - for (int i = 0; i < height; i++) - for (int j = 0; j < width; j++) - { - // get in AARRGGBB and convert to AABBGGRR - int pix = cm.getRGB(pixels[offset + (i * scansize) + x + j]); - byte b = (byte)(pix & 0xFF); - byte r = (byte)(((pix & 0x00FF0000) >> 16) & 0xFF); - pix &= 0xFF00FF00; - pix |= ((b & 0xFF) << 16); - pix |= (r & 0xFF); - pixelCache[(y + i) * this.width + x + j] = pix; - } + for (int i = 0; i < height; i++) + for (int j = 0; j < width; j++) + { + // get in AARRGGBB and convert to AABBGGRR + int pix = cm.getRGB(pixels[offset + (i * scansize) + x + j]); + byte b = (byte)(pix & 0xFF); + byte r = (byte)(((pix & 0x00FF0000) >> 16) & 0xFF); + pix &= 0xFF00FF00; + pix |= ((b & 0xFF) << 16); + pix |= (r & 0xFF); + pixelCache[(y + i) * this.width + x + j] = pix; + } } } @@ -136,7 +136,7 @@ public class QtImageConsumer implements ImageConsumer for (int i = 0; i < pixels.length; i++) ret[i] = pixels[i] & 0xFF; - + return ret; } @@ -145,5 +145,3 @@ public class QtImageConsumer implements ImageConsumer this.properties = props; } } - - diff --git a/gnu/java/awt/peer/qt/QtImageDirectGraphics.java b/gnu/java/awt/peer/qt/QtImageDirectGraphics.java index d49084af8..daa174ad4 100644 --- a/gnu/java/awt/peer/qt/QtImageDirectGraphics.java +++ b/gnu/java/awt/peer/qt/QtImageDirectGraphics.java @@ -75,7 +75,7 @@ public class QtImageDirectGraphics extends QtImageGraphics } public void draw(Shape s) - { + { super.draw(s); scheduleUpdate(); } @@ -105,43 +105,41 @@ public class QtImageDirectGraphics extends QtImageGraphics } public boolean drawImage(Image image, - AffineTransform Tx, - ImageObserver obs) + AffineTransform Tx, + ImageObserver obs) { boolean r = super.drawImage(image, Tx, obs); scheduleUpdate(); return r; } - public boolean drawImage(Image image, int x, int y, Color bgcolor, - ImageObserver observer) + public boolean drawImage(Image image, int x, int y, Color bgcolor, + ImageObserver observer) { boolean r = super.drawImage(image, x, y, bgcolor, observer); scheduleUpdate(); return r; } - public boolean drawImage(Image image, - int dx1, int dy1, int dx2, int dy2, - int sx1, int sy1, int sx2, int sy2, - Color bgcolor, ImageObserver observer) + public boolean drawImage(Image image, + int dx1, int dy1, int dx2, int dy2, + int sx1, int sy1, int sx2, int sy2, + Color bgcolor, ImageObserver observer) { - boolean r = super.drawImage( image, dx1, dy1, dx2, dy2, - sx1, sy1, sx2, sy2, - bgcolor, observer); + boolean r = super.drawImage( image, dx1, dy1, dx2, dy2, + sx1, sy1, sx2, sy2, + bgcolor, observer); scheduleUpdate(); return r; } - public boolean drawImage(Image image, int x, int y, - int width, int height, Color bgcolor, - ImageObserver observer) + public boolean drawImage(Image image, int x, int y, + int width, int height, Color bgcolor, + ImageObserver observer) { - boolean r = super.drawImage(image, x, y, width, height, bgcolor, - observer); + boolean r = super.drawImage(image, x, y, width, height, bgcolor, + observer); scheduleUpdate(); return r; } -} - - +} diff --git a/gnu/java/awt/peer/qt/QtImageGraphics.java b/gnu/java/awt/peer/qt/QtImageGraphics.java index 1224d6915..bba25e068 100644 --- a/gnu/java/awt/peer/qt/QtImageGraphics.java +++ b/gnu/java/awt/peer/qt/QtImageGraphics.java @@ -65,17 +65,17 @@ public class QtImageGraphics extends QtGraphics int w, h; if(image instanceof QtImage) { - w = ((QtImage)image).width; - h = ((QtImage)image).height; - initImage((QtImage) image ); - ((QtImage)image).putPainter( this ); - } + w = ((QtImage)image).width; + h = ((QtImage)image).height; + initImage((QtImage) image ); + ((QtImage)image).putPainter( this ); + } else { - w = ((QtVolatileImage)image).width; - h = ((QtVolatileImage)image).height; - initVolatileImage((QtVolatileImage) image ); - ((QtVolatileImage)image).putPainter( this ); + w = ((QtVolatileImage)image).width; + h = ((QtVolatileImage)image).height; + initVolatileImage((QtVolatileImage) image ); + ((QtVolatileImage)image).putPainter( this ); } parentImage = image; @@ -92,7 +92,7 @@ public class QtImageGraphics extends QtGraphics */ QtImageGraphics( QtImageGraphics g ) { - super( g ); + super( g ); parentImage = g.parentImage; if(parentImage instanceof QtImage) ((QtImage)parentImage).putPainter( this ); @@ -119,9 +119,9 @@ public class QtImageGraphics extends QtGraphics /** * Copy an area. - */ - public void copyArea(int x, int y, int width, int height, - int dx, int dy) + */ + public void copyArea(int x, int y, int width, int height, + int dx, int dy) { if(parentImage instanceof QtImage) ((QtImage)parentImage).copyArea(x, y, width, height, dx, dy); @@ -136,6 +136,4 @@ public class QtImageGraphics extends QtGraphics { throw new UnsupportedOperationException("Not implemented yet"); } -} - - +} diff --git a/gnu/java/awt/peer/qt/QtLabelPeer.java b/gnu/java/awt/peer/qt/QtLabelPeer.java index 449c9b3cb..80acd491d 100644 --- a/gnu/java/awt/peer/qt/QtLabelPeer.java +++ b/gnu/java/awt/peer/qt/QtLabelPeer.java @@ -46,9 +46,9 @@ public class QtLabelPeer extends QtComponentPeer implements LabelPeer { super( kit, owner ); } - + protected native void init(); - + protected void setup() { super.setup(); diff --git a/gnu/java/awt/peer/qt/QtListPeer.java b/gnu/java/awt/peer/qt/QtListPeer.java index 9df250a42..14ae2a0cd 100644 --- a/gnu/java/awt/peer/qt/QtListPeer.java +++ b/gnu/java/awt/peer/qt/QtListPeer.java @@ -84,26 +84,26 @@ public class QtListPeer extends QtComponentPeer implements ListPeer if( index == -1) ((List)owner).deselect( ((List)owner).getSelectedIndex() ); else - { - ((List)owner).select( index ); - ItemEvent e = new ItemEvent((List)owner, - ItemEvent.ITEM_STATE_CHANGED, - ""+index, - ItemEvent.SELECTED); - QtToolkit.eventQueue.postEvent(e); - } + { + ((List)owner).select( index ); + ItemEvent e = new ItemEvent((List)owner, + ItemEvent.ITEM_STATE_CHANGED, + ""+index, + ItemEvent.SELECTED); + QtToolkit.eventQueue.postEvent(e); + } } /** * Called back when an item is double-clicked. - */ + */ private void itemDoubleClicked( int index, int modifiers ) { ActionEvent e = new ActionEvent(owner, - ActionEvent.ACTION_PERFORMED, - ((List)owner).getItem( index ), - System.currentTimeMillis(), - modifiers); + ActionEvent.ACTION_PERFORMED, + ((List)owner).getItem( index ), + System.currentTimeMillis(), + modifiers); QtToolkit.eventQueue.postEvent(e); } @@ -129,10 +129,10 @@ public class QtListPeer extends QtComponentPeer implements ListPeer public native void delItems(int start_index, int end_index); public void deselect(int index) - { + { if( ignoreNextSelect == true ) ignoreNextSelect = false; - else + else select(index, false); } @@ -159,7 +159,7 @@ public class QtListPeer extends QtComponentPeer implements ListPeer { if( ignoreNextSelect == true ) ignoreNextSelect = false; - else + else select(index, true); } diff --git a/gnu/java/awt/peer/qt/QtMenuBarPeer.java b/gnu/java/awt/peer/qt/QtMenuBarPeer.java index c91b37f37..962d76d41 100644 --- a/gnu/java/awt/peer/qt/QtMenuBarPeer.java +++ b/gnu/java/awt/peer/qt/QtMenuBarPeer.java @@ -47,15 +47,15 @@ public class QtMenuBarPeer extends QtMenuComponentPeer implements MenuBarPeer { super( kit, owner ); } - + protected native void init(); - + protected void setup() { } - /** - * Recurses the menubar adding menus (and menu items), + /** + * Recurses the menubar adding menus (and menu items), * called from the Frame peer. */ void addMenus() @@ -99,4 +99,3 @@ public class QtMenuBarPeer extends QtMenuComponentPeer implements MenuBarPeer delMenu( (QtMenuPeer)m.getPeer() ); } } - diff --git a/gnu/java/awt/peer/qt/QtMenuComponentPeer.java b/gnu/java/awt/peer/qt/QtMenuComponentPeer.java index 7e292d00f..2050bef06 100644 --- a/gnu/java/awt/peer/qt/QtMenuComponentPeer.java +++ b/gnu/java/awt/peer/qt/QtMenuComponentPeer.java @@ -41,27 +41,27 @@ import java.awt.Font; import java.awt.MenuComponent; import java.awt.peer.MenuComponentPeer; -public class QtMenuComponentPeer extends NativeWrapper +public class QtMenuComponentPeer extends NativeWrapper implements MenuComponentPeer { protected QtToolkit toolkit; protected MenuComponent owner; - + public QtMenuComponentPeer( QtToolkit kit, MenuComponent owner ) { this.toolkit = kit; this.owner = owner; nativeObject = 0; - synchronized(this) + synchronized(this) { - callInit(); // Calls the init method FROM THE MAIN THREAD. - try - { - wait(); // Wait for the thing to be created. - } - catch(InterruptedException e) - { - } + callInit(); // Calls the init method FROM THE MAIN THREAD. + try + { + wait(); // Wait for the thing to be created. + } + catch(InterruptedException e) + { + } } setup(); } @@ -80,7 +80,7 @@ public class QtMenuComponentPeer extends NativeWrapper { dispose(); } - + // ************ Public methods ********************* public native void dispose(); @@ -88,7 +88,7 @@ public class QtMenuComponentPeer extends NativeWrapper public void setFont(Font font) { // TODO Auto-generated method stub - + } } diff --git a/gnu/java/awt/peer/qt/QtMenuItemPeer.java b/gnu/java/awt/peer/qt/QtMenuItemPeer.java index 7658ff078..2b77540a5 100644 --- a/gnu/java/awt/peer/qt/QtMenuItemPeer.java +++ b/gnu/java/awt/peer/qt/QtMenuItemPeer.java @@ -43,7 +43,7 @@ import java.awt.event.ActionEvent; import java.awt.peer.MenuItemPeer; import java.awt.peer.CheckboxMenuItemPeer; -public class QtMenuItemPeer extends QtMenuComponentPeer +public class QtMenuItemPeer extends QtMenuComponentPeer implements MenuItemPeer, CheckboxMenuItemPeer { public QtMenuItemPeer( QtToolkit toolkit, MenuItem owner ) @@ -73,15 +73,15 @@ public class QtMenuItemPeer extends QtMenuComponentPeer private void fireClick(int modifiers) { ActionEvent e = new ActionEvent(owner, - ActionEvent.ACTION_PERFORMED, - ((MenuItem)owner).getActionCommand(), - System.currentTimeMillis(), - (modifiers & 0x2FF)); + ActionEvent.ACTION_PERFORMED, + ((MenuItem)owner).getActionCommand(), + System.currentTimeMillis(), + (modifiers & 0x2FF)); QtToolkit.eventQueue.postEvent(e); } // ************ Public methods ********************* - + public void disable() { setEnabled(false); @@ -98,10 +98,3 @@ public class QtMenuItemPeer extends QtMenuComponentPeer public native void setState(boolean state); } - - - - - - - diff --git a/gnu/java/awt/peer/qt/QtMenuPeer.java b/gnu/java/awt/peer/qt/QtMenuPeer.java index 87324c710..0f65fecbd 100644 --- a/gnu/java/awt/peer/qt/QtMenuPeer.java +++ b/gnu/java/awt/peer/qt/QtMenuPeer.java @@ -56,7 +56,7 @@ public class QtMenuPeer extends QtMenuComponentPeer implements MenuPeer } protected native void init(); - + protected void setup() { items = new Vector(); @@ -65,29 +65,29 @@ public class QtMenuPeer extends QtMenuComponentPeer implements MenuPeer allowTearOff(); } - // Recurse the menu tree adding items, + // Recurse the menu tree adding items, // called from the MenuBar addMenus() method, called from the Frame peer. void addItems() { if(!itemsAdded) { - Menu o = (Menu)owner; - for( int i=0; i < o.getItemCount(); i++ ) - { - MenuItem ci = o.getItem(i); - if (ci instanceof Menu && ci.getPeer() != null) - ((QtMenuPeer)ci.getPeer()).addItems(); - addItem( ci ); - } - itemsAdded = true; + Menu o = (Menu)owner; + for( int i=0; i < o.getItemCount(); i++ ) + { + MenuItem ci = o.getItem(i); + if (ci instanceof Menu && ci.getPeer() != null) + ((QtMenuPeer)ci.getPeer()).addItems(); + addItem( ci ); + } + itemsAdded = true; } } private void fireClick() { ActionEvent e = new ActionEvent(owner, - ActionEvent.ACTION_PERFORMED, - ((Menu)owner).getActionCommand()); + ActionEvent.ACTION_PERFORMED, + ((Menu)owner).getActionCommand()); QtToolkit.eventQueue.postEvent(e); } @@ -112,13 +112,13 @@ public class QtMenuPeer extends QtMenuComponentPeer implements MenuPeer { if( item instanceof Menu || item instanceof PopupMenu) insertMenu((QtMenuPeer)item.getPeer()); - else + else { - QtMenuItemPeer p = (QtMenuItemPeer)item.getPeer(); - insertItem(p); + QtMenuItemPeer p = (QtMenuItemPeer)item.getPeer(); + insertItem(p); } } - + public void addSeparator() { insertSeperator(); @@ -147,6 +147,3 @@ public class QtMenuPeer extends QtMenuComponentPeer implements MenuPeer public native void setLabel(String text); } - - - diff --git a/gnu/java/awt/peer/qt/QtPanelPeer.java b/gnu/java/awt/peer/qt/QtPanelPeer.java index 9e4352331..1ac0ca9a6 100644 --- a/gnu/java/awt/peer/qt/QtPanelPeer.java +++ b/gnu/java/awt/peer/qt/QtPanelPeer.java @@ -46,7 +46,7 @@ public class QtPanelPeer extends QtContainerPeer implements PanelPeer { super( kit, owner ); } - + protected native void init(); protected void setup() diff --git a/gnu/java/awt/peer/qt/QtPopupMenuPeer.java b/gnu/java/awt/peer/qt/QtPopupMenuPeer.java index b96c5c510..eb4dae404 100644 --- a/gnu/java/awt/peer/qt/QtPopupMenuPeer.java +++ b/gnu/java/awt/peer/qt/QtPopupMenuPeer.java @@ -74,6 +74,3 @@ public class QtPopupMenuPeer extends QtMenuPeer implements PopupMenuPeer show((Component)e.target, e.x, e.y); } } - - - diff --git a/gnu/java/awt/peer/qt/QtRepaintThread.java b/gnu/java/awt/peer/qt/QtRepaintThread.java index 405505e9b..6861be8fc 100644 --- a/gnu/java/awt/peer/qt/QtRepaintThread.java +++ b/gnu/java/awt/peer/qt/QtRepaintThread.java @@ -42,13 +42,13 @@ package gnu.java.awt.peer.qt; * do this directly from the paint callback in QtComponentPeer, because that * is executed from the main thread. Thus, if a call is made at the same time * which requires execution by the main thread, and this is sharing a lock with - * paint(), then a deadlock will occur, which must be avoided. In general, + * paint(), then a deadlock will occur, which must be avoided. In general, * the main Qt thread should avoid calling into java code as far as possible. * */ -public class QtRepaintThread extends Thread +public class QtRepaintThread extends Thread { - static class RepaintComponent + static class RepaintComponent { public QtComponentPeer curr; public RepaintComponent next; @@ -72,7 +72,7 @@ public class QtRepaintThread extends Thread this.h = h; } } - + RepaintComponent component; boolean busy; @@ -85,39 +85,39 @@ public class QtRepaintThread extends Thread { while( true ) { - try - { - busy = false; - // Wait for a repaint - sleep(100); - busy = true; - } - catch (InterruptedException ie) - { - while( component != null ) - { - try - { - if( component.paintAll ) - { - // update the back-buffer. - component.curr.paintBackBuffer(); - component.curr.QtUpdate(); // trigger a native repaint event - } - else - { - component.curr.paintBackBuffer(component.x, component.y, - component.w, component.h); - component.curr.QtUpdateArea(component.x, component.y, - component.w, component.h); - } - } - catch (InterruptedException e) - { - } - component = component.next; - } - } + try + { + busy = false; + // Wait for a repaint + sleep(100); + busy = true; + } + catch (InterruptedException ie) + { + while( component != null ) + { + try + { + if( component.paintAll ) + { + // update the back-buffer. + component.curr.paintBackBuffer(); + component.curr.QtUpdate(); // trigger a native repaint event + } + else + { + component.curr.paintBackBuffer(component.x, component.y, + component.w, component.h); + component.curr.QtUpdateArea(component.x, component.y, + component.w, component.h); + } + } + catch (InterruptedException e) + { + } + component = component.next; + } + } } } @@ -130,9 +130,9 @@ public class QtRepaintThread extends Thread component = new RepaintComponent(p); else { - RepaintComponent r = component; - while( r.next != null ) r = r.next; - r.next = new RepaintComponent(p); + RepaintComponent r = component; + while( r.next != null ) r = r.next; + r.next = new RepaintComponent(p); } interrupt(); } @@ -140,16 +140,16 @@ public class QtRepaintThread extends Thread /** * Enqueue a component for repainting. */ - public synchronized void queueComponent(QtComponentPeer p, int x, int y, - int w, int h) + public synchronized void queueComponent(QtComponentPeer p, int x, int y, + int w, int h) { if( component == null ) component = new RepaintComponent(p, x, y, w, h); else { - RepaintComponent r = component; - while( r.next != null ) r = r.next; - r.next = new RepaintComponent(p, x, y, w, h); + RepaintComponent r = component; + while( r.next != null ) r = r.next; + r.next = new RepaintComponent(p, x, y, w, h); } interrupt(); } diff --git a/gnu/java/awt/peer/qt/QtScreenDevice.java b/gnu/java/awt/peer/qt/QtScreenDevice.java index c2d73aed1..c7d8a4784 100644 --- a/gnu/java/awt/peer/qt/QtScreenDevice.java +++ b/gnu/java/awt/peer/qt/QtScreenDevice.java @@ -113,4 +113,3 @@ public class QtScreenDevice extends GraphicsDevice { } } - diff --git a/gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java b/gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java index c67b55bf4..34de36c09 100644 --- a/gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java +++ b/gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java @@ -47,7 +47,7 @@ import java.awt.image.VolatileImage; import java.awt.geom.AffineTransform; public class QtScreenDeviceConfiguration extends GraphicsConfiguration { - + private QtScreenDevice owner; private Rectangle bounds; private double dpiX, dpiY; @@ -67,21 +67,21 @@ public class QtScreenDeviceConfiguration extends GraphicsConfiguration { switch( depth ) { case 24: - return new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR); + return new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR); case 16: - return new BufferedImage(width, height, - BufferedImage.TYPE_USHORT_565_RGB); + return new BufferedImage(width, height, + BufferedImage.TYPE_USHORT_565_RGB); case 8: - return new BufferedImage(width, height, BufferedImage.TYPE_BYTE_INDEXED); + return new BufferedImage(width, height, BufferedImage.TYPE_BYTE_INDEXED); default: case 32: - return new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + return new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); } } public BufferedImage createCompatibleImage(int width, int height, int transparency) { - // FIXME: Take the transpareny flag into account? + // FIXME: Take the transpareny flag into account? // For now, ignore it and just use an alpha channel. if(depth == 32) return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); @@ -92,9 +92,9 @@ public class QtScreenDeviceConfiguration extends GraphicsConfiguration { { return new QtVolatileImage( width, height ); } - - public VolatileImage createCompatibleVolatileImage(int width, int height, - ImageCapabilities caps) + + public VolatileImage createCompatibleVolatileImage(int width, int height, + ImageCapabilities caps) { return createCompatibleVolatileImage( width, height ); } @@ -121,7 +121,7 @@ public class QtScreenDeviceConfiguration extends GraphicsConfiguration { return new AffineTransform(); } - public GraphicsDevice getDevice() + public GraphicsDevice getDevice() { return owner; } @@ -137,8 +137,8 @@ public class QtScreenDeviceConfiguration extends GraphicsConfiguration { return nTrans; } - public VolatileImage createCompatibleVolatileImage(int width, int height, - int transparency) + public VolatileImage createCompatibleVolatileImage(int width, int height, + int transparency) { return createCompatibleVolatileImage(width, height); } diff --git a/gnu/java/awt/peer/qt/QtScrollPanePeer.java b/gnu/java/awt/peer/qt/QtScrollPanePeer.java index c3731cbd5..079d06de7 100644 --- a/gnu/java/awt/peer/qt/QtScrollPanePeer.java +++ b/gnu/java/awt/peer/qt/QtScrollPanePeer.java @@ -48,7 +48,7 @@ public class QtScrollPanePeer extends QtContainerPeer implements ScrollPanePeer { super( kit, owner ); } - + protected native void init(); protected void setup() @@ -73,9 +73,9 @@ public class QtScrollPanePeer extends QtContainerPeer implements ScrollPanePeer { // FIXME : more accurate? return new Insets(5 + getHScrollbarHeight(), // Top - 5 + getVScrollbarWidth(), // Left - 5, // Bottom - 5); // Right + 5 + getVScrollbarWidth(), // Left + 5, // Bottom + 5); // Right } public void setUnitIncrement(Adjustable item, int inc) diff --git a/gnu/java/awt/peer/qt/QtScrollbarPeer.java b/gnu/java/awt/peer/qt/QtScrollbarPeer.java index 838cca62d..694287131 100644 --- a/gnu/java/awt/peer/qt/QtScrollbarPeer.java +++ b/gnu/java/awt/peer/qt/QtScrollbarPeer.java @@ -65,13 +65,13 @@ public class QtScrollbarPeer extends QtComponentPeer implements ScrollbarPeer private void fireMoved(int type, int value) { AdjustmentEvent e = new AdjustmentEvent((Scrollbar)owner, - AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, - type, value); + AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, + type, value); QtToolkit.eventQueue.postEvent(e); } - + // ************ Public methods ********************* - + public native void setLineIncrement(int inc); public native void setPageIncrement(int inc); diff --git a/gnu/java/awt/peer/qt/QtTextAreaPeer.java b/gnu/java/awt/peer/qt/QtTextAreaPeer.java index f37b9537c..a5aff58ef 100644 --- a/gnu/java/awt/peer/qt/QtTextAreaPeer.java +++ b/gnu/java/awt/peer/qt/QtTextAreaPeer.java @@ -69,7 +69,7 @@ public class QtTextAreaPeer extends QtComponentPeer implements TextAreaPeer * Called back on a text edit. */ private void textChanged() - { + { TextEvent e = new TextEvent(owner, TextEvent.TEXT_VALUE_CHANGED); QtToolkit.eventQueue.postEvent(e); } @@ -95,7 +95,7 @@ public class QtTextAreaPeer extends QtComponentPeer implements TextAreaPeer public native int getIndexAtPoint(int x, int y); // public void reshape(int x, int y, -// int width, int height) +// int width, int height) // { // if(width != 0 || height != 0) // super.reshape(x, y, width, height); @@ -177,4 +177,3 @@ public class QtTextAreaPeer extends QtComponentPeer implements TextAreaPeer return null; } } - diff --git a/gnu/java/awt/peer/qt/QtTextFieldPeer.java b/gnu/java/awt/peer/qt/QtTextFieldPeer.java index 0e3d5af78..f92943202 100644 --- a/gnu/java/awt/peer/qt/QtTextFieldPeer.java +++ b/gnu/java/awt/peer/qt/QtTextFieldPeer.java @@ -80,7 +80,7 @@ public class QtTextFieldPeer extends QtComponentPeer implements TextFieldPeer // ************ Public methods ********************* - public long filterEvents(long e) + public long filterEvents(long e) { return e; } @@ -91,7 +91,7 @@ public class QtTextFieldPeer extends QtComponentPeer implements TextFieldPeer { return new Rectangle(0,0,0,0); } - + public int getIndexAtPoint(int x, int y) { // FIXME @@ -157,4 +157,3 @@ public class QtTextFieldPeer extends QtComponentPeer implements TextFieldPeer return null; } } - diff --git a/gnu/java/awt/peer/qt/QtToolkit.java b/gnu/java/awt/peer/qt/QtToolkit.java index 4cea976ac..9f8a691c6 100644 --- a/gnu/java/awt/peer/qt/QtToolkit.java +++ b/gnu/java/awt/peer/qt/QtToolkit.java @@ -111,7 +111,7 @@ import java.util.Properties; public class QtToolkit extends ClasspathToolkit { public static EventQueue eventQueue = null; // the native event queue - public static QtRepaintThread repaintThread = null; + public static QtRepaintThread repaintThread = null; public static MainQtThread guiThread = null; public static QtGraphicsEnvironment graphicsEnv = null; @@ -122,12 +122,12 @@ public class QtToolkit extends ClasspathToolkit System.loadLibrary("qtpeer"); String theme = null; - try + try { - String style = System.getProperty("qtoptions.style"); - if(style != null) - theme = style; - } + String style = System.getProperty("qtoptions.style"); + if(style != null) + theme = style; + } catch(SecurityException e) { } @@ -136,12 +136,12 @@ public class QtToolkit extends ClasspathToolkit } boolean doublebuffer = true; - try + try { - String style = System.getProperty("qtoptions.nodoublebuffer"); - if(style != null) - doublebuffer = false; - } + String style = System.getProperty("qtoptions.nodoublebuffer"); + if(style != null) + doublebuffer = false; + } catch(SecurityException e) { } @@ -171,7 +171,7 @@ public class QtToolkit extends ClasspathToolkit } native String[] nativeFontFamilies(); - + native int numScreens(); native int defaultScreen(); @@ -213,7 +213,7 @@ public class QtToolkit extends ClasspathToolkit return new QtMenuItemPeer( this, target ); } - public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) + public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) { throw new RuntimeException("Not implemented"); } @@ -232,16 +232,16 @@ public class QtToolkit extends ClasspathToolkit { return new QtImage( producer ); } - + public Image createImage(byte[] imageData, - int imageOffset, - int imageLength) + int imageOffset, + int imageLength) { byte[] dataCopy = new byte[imageLength]; System.arraycopy(imageData, imageOffset, dataCopy, 0, imageLength); return new QtImage( dataCopy ); } - + public Image createImage(String filename) { return new QtImage( filename ); @@ -256,7 +256,7 @@ public class QtToolkit extends ClasspathToolkit { return new QtTextFieldPeer(this,target); } - + protected LabelPeer createLabel(Label target) { return new QtLabelPeer( this, target ); @@ -335,11 +335,11 @@ public class QtToolkit extends ClasspathToolkit public ColorModel getColorModel() { - return new DirectColorModel(32, - 0x00FF0000, - 0x0000FF00, - 0x000000FF, - 0xFF000000); + return new DirectColorModel(32, + 0x00FF0000, + 0x0000FF00, + 0x000000FF, + 0xFF000000); } /** @@ -347,11 +347,11 @@ public class QtToolkit extends ClasspathToolkit */ public String[] getFontList() { - String[] builtIn = new String[] { "Dialog", - "DialogInput", - "Monospaced", - "Serif", - "SansSerif" }; + String[] builtIn = new String[] { "Dialog", + "DialogInput", + "Monospaced", + "Serif", + "SansSerif" }; String[] nat = nativeFontFamilies(); String[] allFonts = new String[ nat.length + 5 ]; System.arraycopy(builtIn, 0, allFonts, 0, 5); @@ -365,7 +365,7 @@ public class QtToolkit extends ClasspathToolkit } protected FontPeer getFontPeer(String name, - int style) + int style) { Map attrs = new HashMap (); ClasspathFontPeer.copyStyleToAttrs(style, attrs); @@ -384,14 +384,14 @@ public class QtToolkit extends ClasspathToolkit } public PrintJob getPrintJob(Frame frame, - String jobtitle, - Properties props) + String jobtitle, + Properties props) { SecurityManager sm; sm = System.getSecurityManager(); if (sm != null) sm.checkPrintJobAccess(); - + throw new RuntimeException("Not implemented"); } @@ -412,8 +412,8 @@ public class QtToolkit extends ClasspathToolkit public Map mapInputMethodHighlight(InputMethodHighlight highlight) { return null; // FIXME - } - + } + public boolean prepareImage(Image image, int w, int h, ImageObserver observer) { if(image instanceof QtImage) @@ -431,7 +431,7 @@ public class QtToolkit extends ClasspathToolkit } public ClasspathFontPeer getClasspathFontPeer (String name, Map attrs) - { + { return new QtFontPeer (name, attrs); } diff --git a/gnu/java/awt/peer/qt/QtVolatileImage.java b/gnu/java/awt/peer/qt/QtVolatileImage.java index c81bb2a09..a203de0d0 100644 --- a/gnu/java/awt/peer/qt/QtVolatileImage.java +++ b/gnu/java/awt/peer/qt/QtVolatileImage.java @@ -74,11 +74,11 @@ public class QtVolatileImage extends VolatileImage /* * The 32-bit AARRGGBB format the uses. */ - static ColorModel nativeModel = new DirectColorModel(32, - 0x00FF0000, - 0x0000FF00, - 0x000000FF, - 0xFF000000); + static ColorModel nativeModel = new DirectColorModel(32, + 0x00FF0000, + 0x0000FF00, + 0x000000FF, + 0xFF000000); /** * Clears the image to RGBA 0 @@ -111,7 +111,7 @@ public class QtVolatileImage extends VolatileImage private native void freeImage(); /** - * Blit a QImage + * Blit a QImage */ public native void blit(QtImage i); public native void blit(QtImage i, int x, int y, int w, int h); @@ -124,35 +124,35 @@ public class QtVolatileImage extends VolatileImage /** * Draws the image optionally composited. */ - private native void drawPixels (QtGraphics gc, - int bg_red, int bg_green, int bg_blue, - int x, int y, - boolean composite); + private native void drawPixels (QtGraphics gc, + int bg_red, int bg_green, int bg_blue, + int x, int y, + boolean composite); /** * Draws the image, optionally scaled and composited. */ - private native void drawPixelsScaled (QtGraphics gc, - int bg_red, int bg_green, int bg_blue, - int x, int y, int width, int height, - boolean composite); + private native void drawPixelsScaled (QtGraphics gc, + int bg_red, int bg_green, int bg_blue, + int x, int y, int width, int height, + boolean composite); /** * Draws the image transformed. */ private native void drawPixelsTransformed (QtGraphics gc, QMatrix transform); - + /** * Draws the image scaled flipped and optionally composited. */ - native void drawPixelsScaledFlipped (QtGraphics gc, - int bg_red, int bg_green, - int bg_blue, - boolean flipX, boolean flipY, - int srcX, int srcY, - int srcWidth, int srcHeight, - int dstX, int dstY, - int dstWidth, int dstHeight, - boolean composite); + native void drawPixelsScaledFlipped (QtGraphics gc, + int bg_red, int bg_green, + int bg_blue, + boolean flipX, boolean flipY, + int srcX, int srcY, + int srcWidth, int srcHeight, + int dstX, int dstY, + int dstWidth, int dstHeight, + boolean composite); /** * Constructs an empty QtVolatileImage. @@ -169,8 +169,8 @@ public class QtVolatileImage extends VolatileImage /** * Constructs a scaled version of the src bitmap, using Qt */ - private QtVolatileImage (QtVolatileImage src, int width, int height, - int hints) + private QtVolatileImage (QtVolatileImage src, int width, int height, + int hints) { this.width = width; this.height = height; @@ -190,7 +190,7 @@ public class QtVolatileImage extends VolatileImage if( painters == null || painters.isEmpty() ) freeImage(); else - killFlag = true; // can't destroy image yet. + killFlag = true; // can't destroy image yet. // Do so when all painters are gone. } @@ -200,7 +200,7 @@ public class QtVolatileImage extends VolatileImage { return getWidth(); } - + public int getHeight (ImageObserver observer) { return getHeight(); @@ -217,8 +217,8 @@ public class QtVolatileImage extends VolatileImage */ public ImageProducer getSource () { - return new MemoryImageSource(width, height, nativeModel, getPixels(), - 0, width); + return new MemoryImageSource(width, height, nativeModel, getPixels(), + 0, width); } void putPainter(QtImageGraphics g) @@ -244,17 +244,17 @@ public class QtVolatileImage extends VolatileImage putPainter( g ); return g; } - + /** * Returns a scaled instance of this image. */ public Image getScaledInstance(int width, - int height, - int hints) + int height, + int hints) { if (width <= 0 || height <= 0) throw new IllegalArgumentException("Width and height of scaled bitmap"+ - "must be >= 0"); + "must be >= 0"); return new QtVolatileImage(this, width, height, hints); } @@ -280,7 +280,7 @@ public class QtVolatileImage extends VolatileImage * Draws an image with eventual scaling/transforming. */ public boolean drawImage (QtGraphics g, QMatrix matrix, - ImageObserver observer) + ImageObserver observer) { drawPixelsTransformed (g, matrix); return true; @@ -291,11 +291,11 @@ public class QtVolatileImage extends VolatileImage * compositing with a background color. */ public boolean drawImage (QtGraphics g, int x, int y, - Color bgcolor, ImageObserver observer) + Color bgcolor, ImageObserver observer) { if(bgcolor != null) - drawPixels(g, bgcolor.getRed (), bgcolor.getGreen (), - bgcolor.getBlue (), x, y, true); + drawPixels(g, bgcolor.getRed (), bgcolor.getGreen (), + bgcolor.getBlue (), x, y, true); else drawPixels(g, 0, 0, 0, x, y, false); @@ -303,27 +303,27 @@ public class QtVolatileImage extends VolatileImage } /** - * Draws an image to the QtGraphics context, at (x,y) scaled to + * Draws an image to the QtGraphics context, at (x,y) scaled to * width and height, with optional compositing with a background color. */ public boolean drawImage (QtGraphics g, int x, int y, int width, int height, - Color bgcolor, ImageObserver observer) + Color bgcolor, ImageObserver observer) { if(bgcolor != null) - drawPixelsScaled(g, bgcolor.getRed (), bgcolor.getGreen (), - bgcolor.getBlue (), x, y, width, height, true); + drawPixelsScaled(g, bgcolor.getRed (), bgcolor.getGreen (), + bgcolor.getBlue (), x, y, width, height, true); else drawPixelsScaled(g, 0, 0, 0, x, y, width, height, false); - + return true; } /** * Draws an image with eventual scaling/transforming. */ - public boolean drawImage (QtGraphics g, int dx1, int dy1, int dx2, int dy2, - int sx1, int sy1, int sx2, int sy2, - Color bgcolor, ImageObserver observer) + public boolean drawImage (QtGraphics g, int dx1, int dy1, int dx2, int dy2, + int sx1, int sy1, int sx2, int sy2, + Color bgcolor, ImageObserver observer) { boolean flipX = (dx1 > dx2)^(sx1 > sx2); boolean flipY = (dy1 > dy2)^(sy1 > sy2); @@ -336,53 +336,53 @@ public class QtVolatileImage extends VolatileImage int dstX = (dx1 < dx2) ? dx1 : dx2; int dstY = (dy1 < dy2) ? dy1 : dy2; - // Clipping. This requires the dst to be scaled as well, + // Clipping. This requires the dst to be scaled as well, if (srcWidth > width) { - dstWidth = (int)((double)dstWidth*((double)width/(double)srcWidth)); - srcWidth = width - srcX; + dstWidth = (int)((double)dstWidth*((double)width/(double)srcWidth)); + srcWidth = width - srcX; } - if (srcHeight > height) + if (srcHeight > height) { - dstHeight = (int)((double)dstHeight*((double)height/(double)srcHeight)); - srcHeight = height - srcY; + dstHeight = (int)((double)dstHeight*((double)height/(double)srcHeight)); + srcHeight = height - srcY; } if (srcWidth + srcX > width) { - dstWidth = (int)((double)dstWidth * (double)(width - srcX)/(double)srcWidth); - srcWidth = width - srcX; + dstWidth = (int)((double)dstWidth * (double)(width - srcX)/(double)srcWidth); + srcWidth = width - srcX; } if (srcHeight + srcY > height) { - dstHeight = (int)((double)dstHeight * (double)(width - srcY)/(double)srcHeight); - srcHeight = height - srcY; + dstHeight = (int)((double)dstHeight * (double)(width - srcY)/(double)srcHeight); + srcHeight = height - srcY; } if ( srcWidth <= 0 || srcHeight <= 0 || dstWidth <= 0 || dstHeight <= 0) return true; if(bgcolor != null) - drawPixelsScaledFlipped (g, bgcolor.getRed (), bgcolor.getGreen (), - bgcolor.getBlue (), - flipX, flipY, - srcX, srcY, - srcWidth, srcHeight, - dstX, dstY, - dstWidth, dstHeight, - true); + drawPixelsScaledFlipped (g, bgcolor.getRed (), bgcolor.getGreen (), + bgcolor.getBlue (), + flipX, flipY, + srcX, srcY, + srcWidth, srcHeight, + dstX, dstY, + dstWidth, dstHeight, + true); else drawPixelsScaledFlipped (g, 0, 0, 0, flipX, flipY, - srcX, srcY, srcWidth, srcHeight, - dstX, dstY, dstWidth, dstHeight, - false); + srcX, srcY, srcWidth, srcHeight, + dstX, dstY, dstWidth, dstHeight, + false); return true; } - - public native void copyArea(int x, int y, int width, int height, - int dx, int dy); + + public native void copyArea(int x, int y, int width, int height, + int dx, int dy); //******************** VolatileImage stuff ******************** @@ -402,10 +402,10 @@ public class QtVolatileImage extends VolatileImage { return new ImageCapabilities(false) { - public boolean isTrueVolatile() - { - return false; - } + public boolean isTrueVolatile() + { + return false; + } }; } @@ -416,8 +416,8 @@ public class QtVolatileImage extends VolatileImage public BufferedImage getSnapshot() { - BufferedImage bi = new BufferedImage(width, height, - BufferedImage.TYPE_INT_ARGB_PRE); + BufferedImage bi = new BufferedImage(width, height, + BufferedImage.TYPE_INT_ARGB_PRE); bi.setRGB( 0, 0, width, height, getPixels(), 0, width); return bi; } diff --git a/gnu/java/awt/peer/qt/QtWindowPeer.java b/gnu/java/awt/peer/qt/QtWindowPeer.java index e0a9e8c55..2dfe2ec5a 100644 --- a/gnu/java/awt/peer/qt/QtWindowPeer.java +++ b/gnu/java/awt/peer/qt/QtWindowPeer.java @@ -53,7 +53,7 @@ public class QtWindowPeer extends QtContainerPeer implements WindowPeer { super.setup(); } - + // ************ Public methods ********************* public native void toBack(); @@ -68,7 +68,7 @@ public class QtWindowPeer extends QtContainerPeer implements WindowPeer public void updateAlwaysOnTop() { // TODO Auto-generated method stub - + } public boolean requestWindowFocus() diff --git a/gnu/java/awt/peer/swing/SwingButtonPeer.java b/gnu/java/awt/peer/swing/SwingButtonPeer.java index 192d612ee..1a42fc953 100644 --- a/gnu/java/awt/peer/swing/SwingButtonPeer.java +++ b/gnu/java/awt/peer/swing/SwingButtonPeer.java @@ -185,7 +185,7 @@ public class SwingButtonPeer par = button.getParent(); return par; } - + /** * Handles focus events by forwarding it to * <code>processFocusEvent()</code>. @@ -232,7 +232,7 @@ public class SwingButtonPeer for (int i = 0; i < l.length; ++i) l[i].actionPerformed(ev); } - + } /** diff --git a/gnu/java/awt/peer/swing/SwingCheckboxPeer.java b/gnu/java/awt/peer/swing/SwingCheckboxPeer.java index 03d6388e9..7080831a2 100755 --- a/gnu/java/awt/peer/swing/SwingCheckboxPeer.java +++ b/gnu/java/awt/peer/swing/SwingCheckboxPeer.java @@ -62,7 +62,7 @@ public class SwingCheckboxPeer extends SwingComponentPeer implements /** * A spezialized Swing checkbox used to paint the checkbox for the - * AWT checkbox. + * AWT checkbox. */ private class SwingCheckbox extends JCheckBox @@ -211,7 +211,7 @@ public class SwingCheckboxPeer extends SwingComponentPeer implements * Receives notification when an action was performend on the button. * * @param event the action event - */ + */ public void itemStateChanged(ItemEvent event) { awtCheckbox.setState(event.getStateChange()==ItemEvent.SELECTED); @@ -224,7 +224,7 @@ public class SwingCheckboxPeer extends SwingComponentPeer implements l[i].itemStateChanged(ev); } } - + /** * Creates a new SwingCheckboxPeer instance. */ diff --git a/gnu/java/awt/peer/swing/SwingComponent.java b/gnu/java/awt/peer/swing/SwingComponent.java index d22f55d6f..ca42fb748 100644 --- a/gnu/java/awt/peer/swing/SwingComponent.java +++ b/gnu/java/awt/peer/swing/SwingComponent.java @@ -87,7 +87,7 @@ public interface SwingComponent * @param ev the key event */ void handleKeyEvent(KeyEvent ev); - + /** * Handles a focus event. This is usually forwarded to * {@link Component#processFocusEvent(FocusEvent)} of the swing diff --git a/gnu/java/awt/peer/swing/SwingComponentPeer.java b/gnu/java/awt/peer/swing/SwingComponentPeer.java index 71a7bac4d..8be95dcb7 100644 --- a/gnu/java/awt/peer/swing/SwingComponentPeer.java +++ b/gnu/java/awt/peer/swing/SwingComponentPeer.java @@ -195,7 +195,7 @@ public class SwingComponentPeer public Image createImage(ImageProducer prod) { Image image = Toolkit.getDefaultToolkit().createImage(prod); - return image; + return image; } /** @@ -379,7 +379,7 @@ public class SwingComponentPeer /** * Handles the given event. This is called from - * {@link Component#dispatchEvent(AWTEvent)} to give the peer a chance to + * {@link Component#dispatchEvent(AWTEvent)} to give the peer a chance to * react to events for the component. * * @param e the event @@ -458,7 +458,7 @@ public class SwingComponentPeer /** * Returns <code>true</code> if the component can receive keyboard input * focus. This is called from {@link Component#isFocusTraversable()}. - * + * * This is implemented to return isFocusable() from the Swing component. * * @specnote Part of the earlier 1.1 API, replaced by isFocusable(). @@ -591,10 +591,10 @@ public class SwingComponentPeer /** * Requests that this component receives the focus. This is called from * {@link Component#requestFocus()}. - * + * * This calls requestFocus() on the Swing component. * - * @specnote Part of the earlier 1.1 API, apparently replaced by argument + * @specnote Part of the earlier 1.1 API, apparently replaced by argument * form of the same method. */ public void requestFocus() @@ -762,7 +762,7 @@ public class SwingComponentPeer swingComponent.getJComponent().setVisible(true); } - /** + /** * Get the graphics configuration of the component. The color model * of the component can be derived from the configuration. * @@ -845,7 +845,7 @@ public class SwingComponentPeer * Returns true, if this component can handle wheel scrolling, * <code>false</code> otherwise. * - * This is not yet implemented and returns <code>false</code>. + * This is not yet implemented and returns <code>false</code>. * * @return true, if this component can handle wheel scrolling, * <code>false</code> otherwise @@ -979,7 +979,7 @@ public class SwingComponentPeer /** * Reparent this component under another container. - * + * * @param parent * @since 1.5 */ @@ -1009,7 +1009,7 @@ public class SwingComponentPeer /** * Check if this component supports being reparented. - * + * * @return true if this component can be reparented, * false otherwise. * @since 1.5 @@ -1051,13 +1051,13 @@ public class SwingComponentPeer } finally { userGraphics.dispose(); } - + } /** * Paints the actual 'heavyweight' swing component, if there is one * associated to this peer. - * + * * @param g the graphics to paint the component with */ protected void peerPaintComponent(Graphics g) @@ -1115,7 +1115,7 @@ public class SwingComponentPeer swingComponent.handleFocusEvent(e); } - + /** * Returns the AWT component for this peer. * diff --git a/gnu/java/awt/peer/swing/SwingContainerPeer.java b/gnu/java/awt/peer/swing/SwingContainerPeer.java index 2d5d97ff1..ca3adc4c7 100644 --- a/gnu/java/awt/peer/swing/SwingContainerPeer.java +++ b/gnu/java/awt/peer/swing/SwingContainerPeer.java @@ -340,7 +340,7 @@ public class SwingContainerPeer } } } - + /** * Handles key events on the component. This is usually forwarded to the * SwingComponent's processKeyEvent() method. @@ -352,12 +352,12 @@ public class SwingContainerPeer Component owner = getFocusOwner(); if(owner != null) owner.getPeer().handleEvent(e); - else + else super.handleKeyEvent(e); } private Component focusOwner = null; - + private Component getFocusOwner() { if(focusOwner == null) @@ -369,10 +369,10 @@ public class SwingContainerPeer { focusOwner = child; break; - } + } } } return focusOwner; } - + } diff --git a/gnu/java/awt/peer/swing/SwingLabelPeer.java b/gnu/java/awt/peer/swing/SwingLabelPeer.java index 55c394ecb..5c979d613 100644 --- a/gnu/java/awt/peer/swing/SwingLabelPeer.java +++ b/gnu/java/awt/peer/swing/SwingLabelPeer.java @@ -62,7 +62,7 @@ public class SwingLabelPeer { /** - * A spezialized Swing label used to paint the label for the AWT Label. + * A spezialized Swing label used to paint the label for the AWT Label. * * @author Roman Kennke (kennke@aicas.com) */ @@ -71,13 +71,13 @@ public class SwingLabelPeer implements SwingComponent { Label label; - - + + SwingLabel(Label label) { this.label = label; } - + /** * Returns this label. * diff --git a/gnu/java/awt/peer/swing/SwingListPeer.java b/gnu/java/awt/peer/swing/SwingListPeer.java index 22a6052bb..cf766fd4f 100644 --- a/gnu/java/awt/peer/swing/SwingListPeer.java +++ b/gnu/java/awt/peer/swing/SwingListPeer.java @@ -63,7 +63,7 @@ public class SwingListPeer { /** - * A spezialized Swing scroller used to hold the list. + * A spezialized Swing scroller used to hold the list. * * @author Roman Kennke (kennke@aicas.com) */ @@ -139,7 +139,7 @@ public class SwingListPeer processFocusEvent(ev); } - + /** * Overridden so that this method returns the correct value even without a * peer. @@ -356,7 +356,7 @@ public class SwingListPeer super.peerPaint(g, update); jList.doLayout(); jList.list(); - + Rectangle r = getBounds(); g.setColor(Color.RED); g.drawRect(r.x, r.y, r.width, r.height); diff --git a/gnu/java/awt/peer/swing/SwingMenuItemPeer.java b/gnu/java/awt/peer/swing/SwingMenuItemPeer.java index 8b9d47ec0..721b3349f 100644 --- a/gnu/java/awt/peer/swing/SwingMenuItemPeer.java +++ b/gnu/java/awt/peer/swing/SwingMenuItemPeer.java @@ -83,7 +83,7 @@ public class SwingMenuItemPeer event.setSource(awtMenuItem); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(event); } - + } /** diff --git a/gnu/java/awt/peer/swing/SwingMenuPeer.java b/gnu/java/awt/peer/swing/SwingMenuPeer.java index ecb54a524..afe20616d 100644 --- a/gnu/java/awt/peer/swing/SwingMenuPeer.java +++ b/gnu/java/awt/peer/swing/SwingMenuPeer.java @@ -140,7 +140,7 @@ public class SwingMenuPeer { MenuItem item = awtMenu.getItem(i); item.addNotify(); - SwingMenuItemPeer peer = (SwingMenuItemPeer) item.getPeer(); + SwingMenuItemPeer peer = (SwingMenuItemPeer) item.getPeer(); menu.add(peer.menuItem); } } diff --git a/gnu/java/awt/peer/swing/SwingTextAreaPeer.java b/gnu/java/awt/peer/swing/SwingTextAreaPeer.java index 5be82f695..d56e950ec 100644 --- a/gnu/java/awt/peer/swing/SwingTextAreaPeer.java +++ b/gnu/java/awt/peer/swing/SwingTextAreaPeer.java @@ -66,7 +66,7 @@ public class SwingTextAreaPeer { /** - * A spezialized Swing scroller used to hold the textarea. + * A spezialized Swing scroller used to hold the textarea. * * @author Roman Kennke (kennke@aicas.com) */ @@ -112,7 +112,7 @@ public class SwingTextAreaPeer else { ev.setSource(this); - this.dispatchEvent(ev); + this.dispatchEvent(ev); } } @@ -208,7 +208,7 @@ public class SwingTextAreaPeer par = SwingTextAreaPeer.this.awtComponent.getParent(); return par; } - + public void requestFocus() { SwingTextAreaPeer.this.requestFocus(awtComponent, false, true, 0); } @@ -311,7 +311,7 @@ public class SwingTextAreaPeer true, 0); } } - + /** * The actual JTextArea. */ @@ -349,7 +349,7 @@ public class SwingTextAreaPeer rows = 5; textArea.setRows(rows); } - + jTextArea.setColumns(columns); jTextArea.setRows(rows); } diff --git a/gnu/java/awt/peer/swing/SwingTextFieldPeer.java b/gnu/java/awt/peer/swing/SwingTextFieldPeer.java index 28dc5f339..9750c9bf7 100644 --- a/gnu/java/awt/peer/swing/SwingTextFieldPeer.java +++ b/gnu/java/awt/peer/swing/SwingTextFieldPeer.java @@ -76,7 +76,7 @@ public class SwingTextFieldPeer SwingTextField(TextField textField) { - this.textField = textField; + this.textField = textField; } /** @@ -173,7 +173,7 @@ public class SwingTextFieldPeer processFocusEvent(ev); } - + public Container getParent() { Container par = null; @@ -186,7 +186,7 @@ public class SwingTextFieldPeer { return SwingTextFieldPeer.this.getGraphics(); } - + public void requestFocus() { SwingTextFieldPeer.this.requestFocus(awtComponent, false, true, 0); } diff --git a/gnu/java/awt/peer/x/GLGraphics.java b/gnu/java/awt/peer/x/GLGraphics.java index dde5b9195..3cf3797ab 100644 --- a/gnu/java/awt/peer/x/GLGraphics.java +++ b/gnu/java/awt/peer/x/GLGraphics.java @@ -72,7 +72,7 @@ public class GLGraphics extends AbstractGraphics2D public void setBackground(Color b) { super.setBackground(b); - + gl.clearColor(b.getRed() / 255.F, b.getGreen() / 255.F, b.getBlue() / 255.F, b.getAlpha() / 255.F); } @@ -128,7 +128,7 @@ public class GLGraphics extends AbstractGraphics2D { // FIXME: not sure it's correct return new Rectangle(0, 0, - gl.display.default_screen.width, + gl.display.default_screen.width, gl.display.default_screen.height); } } diff --git a/gnu/java/awt/peer/x/KeyboardMapping.java b/gnu/java/awt/peer/x/KeyboardMapping.java index 8cda31d81..c982a30d5 100644 --- a/gnu/java/awt/peer/x/KeyboardMapping.java +++ b/gnu/java/awt/peer/x/KeyboardMapping.java @@ -54,7 +54,7 @@ final class KeyboardMapping /** * Maps X keycodes to AWT keycodes. - * + * * @param xInput the X input event * @param xKeyCode the X keycode to map * @param xMods the X modifiers diff --git a/gnu/java/awt/peer/x/XEventPump.java b/gnu/java/awt/peer/x/XEventPump.java index 379839196..8e80b97a3 100644 --- a/gnu/java/awt/peer/x/XEventPump.java +++ b/gnu/java/awt/peer/x/XEventPump.java @@ -178,7 +178,7 @@ public class XEventPump { target = awtWindow; } - + MouseEvent mp = new MouseEvent(target, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), KeyboardMapping.mapModifiers(event.getState()) @@ -187,26 +187,26 @@ public class XEventPump 1, false, button); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mp); } - + private void handleButtonRelease(ButtonRelease event) { Integer key = new Integer(event.getEventWindowID()); Window awtWindow = (Window) windows.get(key); int button = event.detail(); - + // AWT cannot handle more than 3 buttons and expects 0 instead. if (button >= gnu.x11.Input.BUTTON3) button = 0; drag = -1; - + Component target = findMouseEventTarget(awtWindow, event.getEventX(), event.getEventY()); if(target == null) { target = awtWindow; } - + MouseEvent mr = new MouseEvent(target, MouseEvent.MOUSE_RELEASED, System.currentTimeMillis(), KeyboardMapping.mapModifiers(event.getState()) @@ -215,15 +215,15 @@ public class XEventPump 1, false, button); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mr); } - - + + private void handleMotionNotify(MotionNotify event) { Integer key = new Integer(event.getEventWindowID()); Window awtWindow = (Window) windows.get(key); int button = event.detail(); - + // AWT cannot handle more than 3 buttons and expects 0 instead. if (button >= gnu.x11.Input.BUTTON3) button = 0; @@ -250,26 +250,26 @@ public class XEventPump } Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mm); } - + // FIME: refactor and make faster, maybe caching the event and handle // and/or check timing (timing is generated for PropertyChange)? private void handleExpose(Expose event) { Integer key = new Integer(event.window_id); Window awtWindow = (Window) windows.get(key); - + if (XToolkit.DEBUG) System.err.println("expose request for window id: " + key); - + Rectangle r = new Rectangle(event.x(), event.y(), event.width(), event.height()); // We need to clear the background of the exposed rectangle. assert awtWindow != null : "awtWindow == null for window ID: " + key; - + Graphics g = awtWindow.getGraphics(); g.clearRect(r.x, r.y, r.width, r.height); g.dispose(); - + XWindowPeer xwindow = (XWindowPeer) awtWindow.getPeer(); Insets i = xwindow.insets(); if (event.width() != awtWindow.getWidth() - i.left - i.right @@ -279,75 +279,75 @@ public class XEventPump int h = event.height(); int x = xwindow.xwindow.x; int y = xwindow.xwindow.y; - + if (XToolkit.DEBUG) System.err.println("Setting size on AWT window: " + w + ", " + h + ", " + awtWindow.getWidth() + ", " + awtWindow.getHeight()); - + // new width and height xwindow.xwindow.width = w; xwindow.xwindow.height = h; - + // reshape the window ComponentReshapeEvent cre = new ComponentReshapeEvent(awtWindow, x, y, w, h); awtWindow.dispatchEvent(cre); } - + ComponentEvent ce = new ComponentEvent(awtWindow, ComponentEvent.COMPONENT_RESIZED); awtWindow.dispatchEvent(ce); - + PaintEvent pev = new PaintEvent(awtWindow, PaintEvent.UPDATE, r); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(pev); } - + private void handleDestroyNotify(DestroyNotify destroyNotify) { if (XToolkit.DEBUG) System.err.println("DestroyNotify event: " + destroyNotify); - + Integer key = new Integer(destroyNotify.event_window_id); Window awtWindow = (Window) windows.get(key); - + AWTEvent event = new WindowEvent(awtWindow, WindowEvent.WINDOW_CLOSED); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(event); } - + private void handleClientMessage(ClientMessage clientMessage) { if (XToolkit.DEBUG) System.err.println("ClientMessage event: " + clientMessage); - + if (clientMessage.delete_window()) { if (XToolkit.DEBUG) System.err.println("ClientMessage is a delete_window event"); - + Integer key = new Integer(clientMessage.window_id); Window awtWindow = (Window) windows.get(key); - + AWTEvent event = new WindowEvent(awtWindow, WindowEvent.WINDOW_CLOSING); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(event); } } - + private void handleEvent(Event xEvent) { if (XToolkit.DEBUG) System.err.println("fetched event: " + xEvent); - + switch (xEvent.code() & 0x7f) { case ButtonPress.CODE: this.handleButtonPress((ButtonPress) xEvent); break; case ButtonRelease.CODE: - this.handleButtonRelease((ButtonRelease) xEvent); + this.handleButtonRelease((ButtonRelease) xEvent); break; case MotionNotify.CODE: - this.handleMotionNotify((MotionNotify) xEvent); + this.handleMotionNotify((MotionNotify) xEvent); break; case Expose.CODE: this.handleExpose((Expose) xEvent); @@ -410,7 +410,7 @@ public class XEventPump keyChar); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ke); } - + } else { @@ -438,9 +438,9 @@ public class XEventPump return MouseEvent.BUTTON3_DOWN_MASK | MouseEvent.BUTTON3_MASK; } - return 0; + return 0; } - + /** * Finds the heavyweight mouse event target. * diff --git a/gnu/java/awt/peer/x/XFontPeer.java b/gnu/java/awt/peer/x/XFontPeer.java index 4372c965f..190209014 100644 --- a/gnu/java/awt/peer/x/XFontPeer.java +++ b/gnu/java/awt/peer/x/XFontPeer.java @@ -98,12 +98,12 @@ public class XFontPeer { /** * The ascent of the font. - */ + */ int ascent; /** * The descent of the font. - */ + */ int descent; /** @@ -253,7 +253,7 @@ public class XFontPeer * * @param c the char buffer holding the string * @param offset the starting offset of the string in the buffer - * @param length the number of characters in the string buffer + * @param length the number of characters in the string buffer * * @return the overall width of the specified string */ @@ -393,7 +393,7 @@ public class XFontPeer { return 1.F; // TODO: Provided by X?? } - + } /** @@ -410,7 +410,7 @@ public class XFontPeer /** * The font metrics for this font. */ - XFontMetrics fontMetrics; + XFontMetrics fontMetrics; /** * Creates a new XFontPeer for the specified font name, style and size. @@ -694,7 +694,7 @@ public class XFontPeer case Font.PLAIN: default: key.append("plain"); - + } String protoType = fontProperties.getProperty(key.toString()); diff --git a/gnu/java/awt/peer/x/XFramePeer.java b/gnu/java/awt/peer/x/XFramePeer.java index a355c68b3..cde67778d 100644 --- a/gnu/java/awt/peer/x/XFramePeer.java +++ b/gnu/java/awt/peer/x/XFramePeer.java @@ -107,10 +107,10 @@ public class XFramePeer // TODO: Implement this. throw new UnsupportedOperationException("Not yet implemented."); } - + /** * Check if this frame peer supports being restacked. - * + * * @return true if this frame peer can be restacked, * false otherwise * @since 1.5 @@ -120,10 +120,10 @@ public class XFramePeer // TODO: Implement this. throw new UnsupportedOperationException("Not yet implemented."); } - + /** * Sets the bounds of this frame peer. - * + * * @param x the new x co-ordinate * @param y the new y co-ordinate * @param width the new width diff --git a/gnu/java/awt/peer/x/XGraphics2D.java b/gnu/java/awt/peer/x/XGraphics2D.java index 0339a424d..1fce2dcf7 100644 --- a/gnu/java/awt/peer/x/XGraphics2D.java +++ b/gnu/java/awt/peer/x/XGraphics2D.java @@ -325,7 +325,7 @@ public class XGraphics2D colorMap.put(c, col); }*/ //xgc.set_foreground(col); - + xgc.set_foreground(c.getRGB()); foreground = c; } @@ -394,19 +394,19 @@ public class XGraphics2D xdrawable.put_image(xgc, zpixmap, x, y); imageCache.put(image, zpixmap); } else { - + // TODO optimize reusing the rectangles Rectangle source = new Rectangle(0, 0, xdrawable.width, xdrawable.height); Rectangle target = new Rectangle(x, y, w, h); - - Rectangle destination = source.intersection(target); - + + Rectangle destination = source.intersection(target); + x = destination.x; y = destination.y; w = destination.width; h = destination.height; - + ZPixmap zpixmap = (ZPixmap) xdrawable.image(x, y, w, h, 0xffffffff, @@ -506,4 +506,3 @@ public class XGraphics2D } } - diff --git a/gnu/java/awt/peer/x/XGraphicsConfiguration.java b/gnu/java/awt/peer/x/XGraphicsConfiguration.java index becb92a7d..aed11a3af 100644 --- a/gnu/java/awt/peer/x/XGraphicsConfiguration.java +++ b/gnu/java/awt/peer/x/XGraphicsConfiguration.java @@ -127,7 +127,7 @@ public class XGraphicsConfiguration throw new UnsupportedOperationException("Not yet implemented"); default: throw new IllegalArgumentException("Unknown transparency type: " - + transparency); + + transparency); } return im; } @@ -159,8 +159,8 @@ public class XGraphicsConfiguration { Display d = device.getDisplay(); Screen screen = d.default_screen; - - return new Rectangle(0, 0, screen.width, screen.height); + + return new Rectangle(0, 0, screen.width, screen.height); } /** diff --git a/gnu/java/awt/peer/x/XGraphicsDevice.java b/gnu/java/awt/peer/x/XGraphicsDevice.java index ca37f3adb..6b65e14ed 100644 --- a/gnu/java/awt/peer/x/XGraphicsDevice.java +++ b/gnu/java/awt/peer/x/XGraphicsDevice.java @@ -136,7 +136,7 @@ public class XGraphicsDevice } catch (EscherServerConnectionException e) { - throw new RuntimeException(e.getCause()); + throw new RuntimeException(e.getCause()); } } } @@ -155,7 +155,7 @@ public class XGraphicsDevice throw new RuntimeException(e.getCause()); } } - + eventPump = new XEventPump(display); } return display; @@ -167,7 +167,7 @@ public class XGraphicsDevice } /** - * Tries to load the LocalSocket class and initiate a connection to the + * Tries to load the LocalSocket class and initiate a connection to the * local X server. */ private Socket createLocalSocket() diff --git a/gnu/java/awt/peer/x/XGraphicsEnvironment.java b/gnu/java/awt/peer/x/XGraphicsEnvironment.java index 8ec8d57bb..7b1d82fee 100644 --- a/gnu/java/awt/peer/x/XGraphicsEnvironment.java +++ b/gnu/java/awt/peer/x/XGraphicsEnvironment.java @@ -130,7 +130,7 @@ public class XGraphicsEnvironment defaultDevice = initDefaultDevice(); devices = new XGraphicsDevice[]{ defaultDevice }; } - + } /** diff --git a/gnu/java/awt/peer/x/XImage.java b/gnu/java/awt/peer/x/XImage.java index fa94d00c1..f3df89f4d 100644 --- a/gnu/java/awt/peer/x/XImage.java +++ b/gnu/java/awt/peer/x/XImage.java @@ -81,7 +81,7 @@ public class XImage public ImageProducer getSource() { - return new XImageProducer(); + return new XImageProducer(); } /** @@ -113,11 +113,11 @@ public class XImage { pixmap.free(); } - + protected class XImageProducer implements ImageProducer { private Vector<ImageConsumer> consumers = new Vector<ImageConsumer>(); - + public void addConsumer(ImageConsumer ic) { if (ic != null && !isConsumer(ic)) @@ -148,30 +148,30 @@ public class XImage { int width = XImage.this.getWidth(null); int height = XImage.this.getHeight(null); - + XGraphics2D graphics = (XGraphics2D) getGraphics(); ColorModel model = graphics.getColorModel(); graphics.dispose(); - + ZPixmap zpixmap = (ZPixmap) XImage.this.pixmap.image(0, 0, width, height, 0xffffffff, gnu.x11.image.Image.Format.ZPIXMAP); - + int size = zpixmap.get_data_length(); System.out.println("size: " + size + ", w = " + width + ", h = " + height); - + int [] pixel = new int[size]; for (int i = 0; i < size; i++) pixel[i] = zpixmap.get_data_element(i); consumer.setHints(ImageConsumer.SINGLEPASS); - + consumer.setDimensions(width, height); consumer.setPixels(0, 0, width, height, model, pixel, 0, width); consumer.imageComplete(ImageConsumer.STATICIMAGEDONE); } - + System.out.println("done!"); } } diff --git a/gnu/java/awt/peer/x/XToolkit.java b/gnu/java/awt/peer/x/XToolkit.java index af12574a1..a3eeb0f53 100644 --- a/gnu/java/awt/peer/x/XToolkit.java +++ b/gnu/java/awt/peer/x/XToolkit.java @@ -239,23 +239,23 @@ public class XToolkit protected ButtonPeer createButton(Button target) { checkHeadLess("No ButtonPeer can be created in an headless" + - "graphics environment."); - + "graphics environment."); + return new SwingButtonPeer(target); } protected TextFieldPeer createTextField(TextField target) { checkHeadLess("No TextFieldPeer can be created in an headless " + - "graphics environment."); - + "graphics environment."); + return new SwingTextFieldPeer(target); } protected LabelPeer createLabel(Label target) { checkHeadLess("No LabelPeer can be created in an headless graphics " + - "environment."); + "environment."); return new SwingLabelPeer(target); } @@ -269,7 +269,7 @@ public class XToolkit { checkHeadLess("No CheckboxPeer can be created in an headless graphics " + "environment."); - + return new SwingCheckboxPeer(target); } @@ -288,8 +288,8 @@ public class XToolkit protected TextAreaPeer createTextArea(TextArea target) { checkHeadLess("No TextAreaPeer can be created in an headless graphics " + - "environment."); - + "environment."); + return new SwingTextAreaPeer(target); } @@ -518,7 +518,7 @@ public class XToolkit /** * Creates an image that is returned when calls to createImage() yields an * error. - * + * * @return an image that is returned when calls to createImage() yields an * error */ @@ -660,7 +660,7 @@ public class XToolkit { if(message == null) message = "This method cannot be called in headless mode."; - + throw new HeadlessException(message); } } diff --git a/gnu/java/awt/peer/x/XWindowPeer.java b/gnu/java/awt/peer/x/XWindowPeer.java index 930247da5..541eb74fa 100644 --- a/gnu/java/awt/peer/x/XWindowPeer.java +++ b/gnu/java/awt/peer/x/XWindowPeer.java @@ -80,7 +80,7 @@ public class XWindowPeer | Event.KEY_RELEASE_MASK //| Event.VISIBILITY_CHANGE_MASK // ; - + /** * The X window. */ @@ -105,10 +105,10 @@ public class XWindowPeer int h = Math.max(window.getHeight(), 1); xwindow = new Window(dev.getDisplay().default_root, x, y, w, h, 0, atts); xwindow.select_input(standardSelect); - + dev.getEventPump().registerWindow(xwindow, window); xwindow.set_wm_delete_window(); - + boolean undecorated; if (awtComponent instanceof Frame) { @@ -178,11 +178,11 @@ public class XWindowPeer */ public Graphics getGraphics() { - XGraphics2D xg2d = new XGraphics2D(xwindow); - xg2d.setColor(awtComponent.getForeground()); - xg2d.setBackground(awtComponent.getBackground()); - xg2d.setFont(awtComponent.getFont()); - return xg2d; + XGraphics2D xg2d = new XGraphics2D(xwindow); + xg2d.setColor(awtComponent.getForeground()); + xg2d.setBackground(awtComponent.getBackground()); + xg2d.setFont(awtComponent.getFont()); + return xg2d; } public Image createImage(int w, int h) @@ -226,7 +226,7 @@ public class XWindowPeer // // Reset input selection. // atts.set_override_redirect(false); // xwindow.change_attributes(atts); - + // Determine the frame insets. Atom atom = (Atom) Atom.intern(dev.getDisplay(), "_NET_FRAME_EXTENTS"); Window.Property p = xwindow.get_property(false, atom, Atom.CARDINAL, 0, @@ -295,7 +295,7 @@ public class XWindowPeer XGraphicsDevice dev = XToolkit.getDefaultDevice(); dev.getEventPump().unregisterWindow(xwindow); } - + public Window getXwindow() { return xwindow; diff --git a/gnu/java/awt/print/JavaPrinterGraphics.java b/gnu/java/awt/print/JavaPrinterGraphics.java index b86eea50b..64d197cd0 100644 --- a/gnu/java/awt/print/JavaPrinterGraphics.java +++ b/gnu/java/awt/print/JavaPrinterGraphics.java @@ -107,47 +107,47 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics * If Pageable is non-null, it will print that, otherwise it will use * the supplied printable and pageFormat. */ - public SpooledDocument spoolPostScript(Printable printable, - PageFormat pageFormat, - Pageable pageable) + public SpooledDocument spoolPostScript(Printable printable, + PageFormat pageFormat, + Pageable pageable) throws PrinterException { - try + try { - // spool to a temporary file - File temp = File.createTempFile("cpspool", ".ps"); - temp.deleteOnExit(); - - PrintWriter out = new PrintWriter - (new BufferedWriter - (new OutputStreamWriter - (new FileOutputStream(temp), "ISO8859_1"), 1000000)); - - writePSHeader(out); - - if(pageable != null) - { - for(int index = 0; index < pageable.getNumberOfPages(); index++) - spoolPage(out, pageable.getPrintable(index), - pageable.getPageFormat(index), index); - } - else - { - int index = 0; - while(spoolPage(out, printable, pageFormat, index++) == - Printable.PAGE_EXISTS) + // spool to a temporary file + File temp = File.createTempFile("cpspool", ".ps"); + temp.deleteOnExit(); + + PrintWriter out = new PrintWriter + (new BufferedWriter + (new OutputStreamWriter + (new FileOutputStream(temp), "ISO8859_1"), 1000000)); + + writePSHeader(out); + + if(pageable != null) + { + for(int index = 0; index < pageable.getNumberOfPages(); index++) + spoolPage(out, pageable.getPrintable(index), + pageable.getPageFormat(index), index); + } + else + { + int index = 0; + while(spoolPage(out, printable, pageFormat, index++) == + Printable.PAGE_EXISTS) ; - } - out.println("%%Trailer"); - out.println("%%EOF"); - out.close(); - return new SpooledDocument( temp ); - } - catch (IOException e) + } + out.println("%%Trailer"); + out.println("%%EOF"); + out.close(); + return new SpooledDocument( temp ); + } + catch (IOException e) { - PrinterException pe = new PrinterException(); - pe.initCause(e); - throw pe; + PrinterException pe = new PrinterException(); + pe.initCause(e); + throw pe; } } @@ -156,9 +156,9 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics * PAGE_EXISTS if it was. */ public int spoolPage(PrintWriter out, - Printable printable, - PageFormat pageFormat, - int index) throws IOException, PrinterException + Printable printable, + PageFormat pageFormat, + int index) throws IOException, PrinterException { initImage( pageFormat ); if(printable.print(this, pageFormat, index) == Printable.NO_SUCH_PAGE) @@ -168,22 +168,22 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics writePage( out, pageFormat ); return Printable.PAGE_EXISTS; } - + private void initImage(PageFormat pageFormat) { // Create a really big image and draw to that. xSize = (int)(DPI*pageFormat.getWidth()/72.0); ySize = (int)(DPI*pageFormat.getHeight()/72.0); - + // Swap X and Y sizes if it's a Landscape page. if( pageFormat.getOrientation() != PageFormat.PORTRAIT ) { - int t = xSize; - xSize = ySize; - ySize = t; + int t = xSize; + xSize = ySize; + ySize = t; } - // FIXME: This should at least be BufferedImage. + // FIXME: This should at least be BufferedImage. // Fix once we have a working B.I. // Graphics2D should also be supported of course. image = CairoSurface.getBufferedImage(xSize, ySize); @@ -196,7 +196,7 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics private void writePSHeader(PrintWriter out) { - out.println("%!PS-Adobe-3.0"); + out.println("%!PS-Adobe-3.0"); out.println("%%Title: "+printerJob.getJobName()); out.println("%%Creator: GNU Classpath "); out.println("%%DocumentData: Clean8Bit"); @@ -204,19 +204,19 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics out.println("%%DocumentNeededResources: font Times-Roman Helvetica Courier"); // out.println("%%Pages: "+); // FIXME # pages. out.println("%%EndComments"); - + out.println("%%BeginProlog"); out.println("%%EndProlog"); out.println("%%BeginSetup"); - + // FIXME: Paper name // E.g. "A4" "Letter" // out.println("%%BeginFeature: *PageSize A4"); - + out.println("%%EndFeature"); out.println("%%EndSetup"); - + // out.println("%%Page: 1 1"); } @@ -232,14 +232,14 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics out.println( "%%Orientation: Portrait" ); else { - out.println( "%%Orientation: Landscape" ); - double t = pWidth; - pWidth = pHeight; - pHeight = t; + out.println( "%%Orientation: Landscape" ); + double t = pWidth; + pWidth = pHeight; + pHeight = t; } - + out.println("gsave % first save"); - + // 595x842; 612x792 respectively out.println("<< /PageSize [" +pWidth + " "+pHeight+ "] >> setpagedevice"); @@ -247,8 +247,8 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics AffineTransform pageTransform = new AffineTransform(); if( pageFormat.getOrientation() == PageFormat.REVERSE_LANDSCAPE ) { - pageTransform.translate(pWidth, pHeight); - pageTransform.scale(-1.0, -1.0); + pageTransform.translate(pWidth, pHeight); + pageTransform.scale(-1.0, -1.0); } concatCTM(out, pageTransform); out.println("%%EndPageSetup"); @@ -257,7 +257,7 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics // Draw the image - out.println(xSize+" "+ySize+" 8 [1 0 0 -1 0 "+ySize+" ]"); + out.println(xSize+" "+ySize+" 8 [1 0 0 -1 0 "+ySize+" ]"); out.println("{currentfile 3 string readhexstring pop} bind"); out.println("false 3 colorimage"); int[] pixels = new int[xSize * ySize]; @@ -272,19 +272,19 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics int n = 0; for (int j = 0; j < ySize; j++) { for (int i = 0; i < xSize; i++) { - out.print( colorTripleHex(pixels[j * xSize + i]) ); - if(((++n)%11) == 0) out.println(); + out.print( colorTripleHex(pixels[j * xSize + i]) ); + if(((++n)%11) == 0) out.println(); } } - + out.println(); out.println("%%EOF"); out.println("grestore"); out.println("showpage"); } - + /** - * Get a nonsperated hex RGB triple, e.g. FFFFFF = white + * Get a nonsperated hex RGB triple, e.g. FFFFFF = white */ private String colorTripleHex(int num){ String s = ""; @@ -292,10 +292,10 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics try { s = Integer.toHexString( ( num & 0x00FFFFFF ) ); if( s.length() < 6 ) - { - s = "000000"+s; - return s.substring(s.length()-6); - } + { + s = "000000"+s; + return s.substring(s.length()-6); + } } catch (Exception e){ s = "FFFFFF"; } @@ -306,7 +306,7 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics private void concatCTM(PrintWriter out, AffineTransform Tx){ double[] matrixElements = new double[6]; Tx.getMatrix(matrixElements); - + out.print("[ "); for(int i=0;i<6;i++) out.print(matrixElements[i]+" "); @@ -349,14 +349,14 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics { } - public void drawArc(int x, int y, int width, int height, int startAngle, - int arcAngle) + public void drawArc(int x, int y, int width, int height, int startAngle, + int arcAngle) { g.drawArc(x, y, width, height, startAngle, arcAngle); } - public boolean drawImage(Image img, int x, int y, Color bgcolor, - ImageObserver observer) + public boolean drawImage(Image img, int x, int y, Color bgcolor, + ImageObserver observer) { return g.drawImage(img, x, y, bgcolor, observer); } @@ -366,31 +366,31 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics return g.drawImage(img, x, y, observer); } - public boolean drawImage(Image img, int x, int y, int width, int height, - Color bgcolor, ImageObserver observer) + public boolean drawImage(Image img, int x, int y, int width, int height, + Color bgcolor, ImageObserver observer) { return g.drawImage(img, x, y, width, height, bgcolor, observer); } - public boolean drawImage(Image img, int x, int y, int width, int height, - ImageObserver observer) + public boolean drawImage(Image img, int x, int y, int width, int height, + ImageObserver observer) { return g.drawImage(img, x, y, width, height, observer); } - public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, - int sx1, int sy1, int sx2, int sy2, Color bgcolor, - ImageObserver observer) + public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, + int sx1, int sy1, int sx2, int sy2, Color bgcolor, + ImageObserver observer) { - return g.drawImage(img, dx1, dy1, dx2, dy2, - sx1, sy1, sx2, sy2, bgcolor, observer); + return g.drawImage(img, dx1, dy1, dx2, dy2, + sx1, sy1, sx2, sy2, bgcolor, observer); } - public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, - int sx1, int sy1, int sx2, int sy2, ImageObserver observer) + public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, + int sx1, int sy1, int sx2, int sy2, ImageObserver observer) { - return g.drawImage(img, dx1, dy1, dx2, dy2, - sx1, sy1, sx2, sy2, observer); + return g.drawImage(img, dx1, dy1, dx2, dy2, + sx1, sy1, sx2, sy2, observer); } public void drawLine(int x1, int y1, int x2, int y2) @@ -413,8 +413,8 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics g.drawPolyline(xPoints, yPoints, nPoints); } - public void drawRoundRect(int x, int y, int width, int height, - int arcWidth, int arcHeight) + public void drawRoundRect(int x, int y, int width, int height, + int arcWidth, int arcHeight) { g.drawRoundRect(x, y, width, height, arcWidth, arcHeight); } @@ -429,8 +429,8 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics g.drawString(str, x, y); } - public void fillArc(int x, int y, int width, int height, - int startAngle, int arcAngle) + public void fillArc(int x, int y, int width, int height, + int startAngle, int arcAngle) { g.fillArc(x, y, width, height, startAngle, arcAngle); } @@ -450,8 +450,8 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics g.fillRect(x, y, width, height); } - public void fillRoundRect(int x, int y, int width, int height, - int arcWidth, int arcHeight) + public void fillRoundRect(int x, int y, int width, int height, + int arcWidth, int arcHeight) { g.fillRoundRect(x, y, width, height, arcWidth, arcHeight); } @@ -516,4 +516,3 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics g.translate(x, y); } } - diff --git a/gnu/java/awt/print/JavaPrinterJob.java b/gnu/java/awt/print/JavaPrinterJob.java index adeeba04a..295d231cb 100644 --- a/gnu/java/awt/print/JavaPrinterJob.java +++ b/gnu/java/awt/print/JavaPrinterJob.java @@ -113,15 +113,15 @@ public class JavaPrinterJob extends PrinterJob { // lookup all services without any constraints services = PrintServiceLookup.lookupPrintServices - (DocFlavor.INPUT_STREAM.POSTSCRIPT, null); + (DocFlavor.INPUT_STREAM.POSTSCRIPT, null); } private static final Class copyClass = (new Copies(1)).getClass(); private static final Class jobNameClass = (new JobName("", null)).getClass(); private static final Class userNameClass = (new RequestingUserName("", null)).getClass(); - + /** - * Initializes a new instance of <code>PrinterJob</code>. + * Initializes a new instance of <code>PrinterJob</code>. */ public JavaPrinterJob() { @@ -143,7 +143,7 @@ public class JavaPrinterJob extends PrinterJob else if( orientation.equals(OrientationRequested.LANDSCAPE) ) pageFormat.setOrientation(PageFormat.LANDSCAPE); else if( orientation.equals(OrientationRequested.REVERSE_LANDSCAPE) ) - pageFormat.setOrientation(PageFormat.REVERSE_LANDSCAPE); + pageFormat.setOrientation(PageFormat.REVERSE_LANDSCAPE); } /** @@ -203,11 +203,11 @@ public class JavaPrinterJob extends PrinterJob { try { - if(printJob != null && (printJob instanceof CancelablePrintJob)) - { - ((CancelablePrintJob)printJob).cancel(); - cancelled = true; - } + if(printJob != null && (printJob instanceof CancelablePrintJob)) + { + ((CancelablePrintJob)printJob).cancel(); + cancelled = true; + } } catch(PrintException pe) { @@ -261,20 +261,20 @@ public class JavaPrinterJob extends PrinterJob return; PostScriptGraphics2D pg = new PostScriptGraphics2D( this ); - SpooledDocument doc = pg.spoolPostScript( printable, pageFormat, - pageable ); + SpooledDocument doc = pg.spoolPostScript( printable, pageFormat, + pageable ); cancelled = false; printJob = printer.createPrintJob(); try { - printJob.print(doc, attributes); + printJob.print(doc, attributes); } - catch (PrintException pe) + catch (PrintException pe) { - PrinterException p = new PrinterException(); - p.initCause(pe); - throw p; + PrinterException p = new PrinterException(); + p.initCause(pe); + throw p; } // no printjob active. printJob = null; @@ -313,22 +313,22 @@ public class JavaPrinterJob extends PrinterJob throws HeadlessException { PrintService chosenPrinter = ServiceUI.printDialog - (null, 50, 50, services, null, + (null, 50, 50, services, null, DocFlavor.INPUT_STREAM.POSTSCRIPT, attributes); getPageAttributes(); if( chosenPrinter != null ) { - try - { - setPrintService( chosenPrinter ); - } - catch(PrinterException pe) - { - // Should not happen. - } - return true; + try + { + setPrintService( chosenPrinter ); + } + catch(PrinterException pe) + { + // Should not happen. + } + return true; } return false; } diff --git a/gnu/java/awt/print/PostScriptGraphics2D.java b/gnu/java/awt/print/PostScriptGraphics2D.java index 01894e5a4..10fc25c2f 100644 --- a/gnu/java/awt/print/PostScriptGraphics2D.java +++ b/gnu/java/awt/print/PostScriptGraphics2D.java @@ -126,7 +126,7 @@ class PostScriptGraphics2D extends Graphics2D private double Y = pageY; private boolean gradientOn = false; - /** + /** * Constructor * */ @@ -162,74 +162,74 @@ class PostScriptGraphics2D extends Graphics2D * If Pageable is non-null, it will print that, otherwise it will use * the supplied printable and pageFormat. */ - public SpooledDocument spoolPostScript(Printable printable, - PageFormat pageFormat, - Pageable pageable) + public SpooledDocument spoolPostScript(Printable printable, + PageFormat pageFormat, + Pageable pageable) throws PrinterException { - try + try { - // spool to a temporary file - File temp = File.createTempFile("cpspool", ".ps"); - temp.deleteOnExit(); - - out = new PrintWriter(new BufferedWriter - (new OutputStreamWriter - (new FileOutputStream(temp), - "ISO8859_1"), 1000000)); - - writePSHeader(); - - if(pageable != null) - { - for(int index = 0; index < pageable.getNumberOfPages(); index++) - spoolPage(out, pageable.getPrintable(index), - pageable.getPageFormat(index), index); - } - else - { - int index = 0; - while(spoolPage(out, printable, pageFormat, index++) == - Printable.PAGE_EXISTS) + // spool to a temporary file + File temp = File.createTempFile("cpspool", ".ps"); + temp.deleteOnExit(); + + out = new PrintWriter(new BufferedWriter + (new OutputStreamWriter + (new FileOutputStream(temp), + "ISO8859_1"), 1000000)); + + writePSHeader(); + + if(pageable != null) + { + for(int index = 0; index < pageable.getNumberOfPages(); index++) + spoolPage(out, pageable.getPrintable(index), + pageable.getPageFormat(index), index); + } + else + { + int index = 0; + while(spoolPage(out, printable, pageFormat, index++) == + Printable.PAGE_EXISTS) ; - } - out.println("%%Trailer"); - out.println("%%EOF"); - out.close(); - return new SpooledDocument( temp ); - } - catch (IOException e) + } + out.println("%%Trailer"); + out.println("%%EOF"); + out.close(); + return new SpooledDocument( temp ); + } + catch (IOException e) { - PrinterException pe = new PrinterException(); - pe.initCause(e); - throw pe; + PrinterException pe = new PrinterException(); + pe.initCause(e); + throw pe; } } //-------------------------------------------------------------------------- - /** + /** * Write the postscript file header, - * setup the page format and transforms. + * setup the page format and transforms. */ private void writePSHeader() { - out.println("%!PS-Adobe-3.0"); + out.println("%!PS-Adobe-3.0"); out.println("%%Title: "+printerJob.getJobName()); out.println("%%Creator: GNU Classpath "); out.println("%%DocumentData: Clean8Bit"); out.println("%%DocumentNeededResources: font Times-Roman Helvetica Courier"); out.println("%%EndComments"); - + out.println("%%BeginProlog"); out.println("%%EndProlog"); out.println("%%BeginSetup"); - + out.println("%%EndFeature"); setupFonts(); out.println("%%EndSetup"); - + // set default fonts and colors setFont( new Font("Dialog", Font.PLAIN, 12) ); currentColor = Color.white; @@ -268,9 +268,9 @@ class PostScriptGraphics2D extends Graphics2D * PAGE_EXISTS if it was. */ public int spoolPage(PrintWriter out, - Printable printable, - PageFormat pageFormat, - int index) throws IOException, PrinterException + Printable printable, + PageFormat pageFormat, + int index) throws IOException, PrinterException { out.println("%%BeginPageSetup"); @@ -282,23 +282,23 @@ class PostScriptGraphics2D extends Graphics2D out.println( "%%Orientation: Portrait" ); else { - out.println( "%%Orientation: Landscape" ); - double t = pageX; - pageX = pageY; - pageY = t; + out.println( "%%Orientation: Landscape" ); + double t = pageX; + pageX = pageY; + pageY = t; } - + setClip(0, 0, (int)pageX, (int)pageY); out.println("gsave % first save"); - + // 595x842; 612x792 respectively out.println("<< /PageSize [" +pageX + " "+pageY+ "] >> setpagedevice"); if( pageFormat.getOrientation() != PageFormat.LANDSCAPE ) { - pageTransform.translate(pageX, 0); - pageTransform.scale(-1.0, 1.0); + pageTransform.translate(pageX, 0); + pageTransform.scale(-1.0, 1.0); } // save the original CTM @@ -312,7 +312,7 @@ class PostScriptGraphics2D extends Graphics2D if( printable.print(this, pageFormat, index) == Printable.NO_SUCH_PAGE ) return Printable.NO_SUCH_PAGE; - + out.println("grestore"); out.println("showpage"); @@ -417,7 +417,7 @@ class PostScriptGraphics2D extends Graphics2D setStroke(currentStroke); } - //--------------- Image drawing ------------------------------------------ + //--------------- Image drawing ------------------------------------------ public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) { @@ -425,7 +425,7 @@ class PostScriptGraphics2D extends Graphics2D int h = img.getHeight(null); return drawImage(img, x, y, x + w, y + h, 0, 0, w - 1, h - 1, bgcolor, - observer); + observer); } public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, @@ -439,31 +439,31 @@ class PostScriptGraphics2D extends Graphics2D // swap X and Y's if (sx1 > sx2) { - n = sx1; - sx1 = sx2; - sx2 = n; - flipx = ! flipx; + n = sx1; + sx1 = sx2; + sx2 = n; + flipx = ! flipx; } if (sy1 > sy2) { - n = sy1; - sy1 = sy2; - sy2 = n; - flipy = ! flipy; + n = sy1; + sy1 = sy2; + sy2 = n; + flipy = ! flipy; } if (dx1 > dx2) { - n = dx1; - dx1 = dx2; - dx2 = n; - flipx = ! flipx; + n = dx1; + dx1 = dx2; + dx2 = n; + flipx = ! flipx; } if (dy1 > dy2) { - n = dy1; - dy1 = dy2; - dy2 = n; - flipy = ! flipy; + n = dy1; + dy1 = dy2; + dy2 = n; + flipy = ! flipy; } n = 0; int sw = sx2 - sx1; // source width @@ -487,28 +487,28 @@ class PostScriptGraphics2D extends Graphics2D PixelGrabber pg = new PixelGrabber(img, sx1, sy1, sw, sh, pixels, 0, sw); try { - pg.grabPixels(); + pg.grabPixels(); } catch (InterruptedException e) { - System.err.println("interrupted waiting for pixels!"); - return (false); + System.err.println("interrupted waiting for pixels!"); + return (false); } if ((pg.getStatus() & ImageObserver.ABORT) != 0) { - System.err.println("image fetch aborted or errored"); - return (false); + System.err.println("image fetch aborted or errored"); + return (false); } for (int j = 0; j < sh; j++) { - for (int i = 0; i < sw; i++) - { - out.print(colorTripleHex(new Color(pixels[j * sw + i]))); - if (((++n) % 11) == 0) - out.println(); - } + for (int i = 0; i < sw; i++) + { + out.print(colorTripleHex(new Color(pixels[j * sw + i]))); + if (((++n) % 11) == 0) + out.println(); + } } out.println(); @@ -522,7 +522,7 @@ class PostScriptGraphics2D extends Graphics2D ImageObserver observer) { return drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null, - observer); + observer); } public boolean drawImage(Image img, int x, int y, ImageObserver observer) @@ -531,18 +531,18 @@ class PostScriptGraphics2D extends Graphics2D } public boolean drawImage(Image img, int x, int y, int width, int height, - Color bgcolor, ImageObserver observer) + Color bgcolor, ImageObserver observer) { int sw = img.getWidth(null); int sh = img.getHeight(null); return drawImage(img, x, y, x + width, y + height, /* destination */ - 0, 0, sw - 1, sh - 1, /* source */ - bgcolor, observer); + 0, 0, sw - 1, sh - 1, /* source */ + bgcolor, observer); // correct? } public boolean drawImage(Image img, int x, int y, int width, int height, - ImageObserver observer) + ImageObserver observer) { return drawImage(img, x, y, width, height, null, observer); } @@ -602,8 +602,8 @@ class PostScriptGraphics2D extends Graphics2D if( currentFontIsPS ) { - drawStringPSFont(str, x, y); - return; + drawStringPSFont(str, x, y); + return; } TextLayout text = new TextLayout(str, currentFont, getFontRenderContext()); @@ -626,22 +626,22 @@ class PostScriptGraphics2D extends Graphics2D popCTM(); pushCTM(); - double[] test = + double[] test = { - pageTransform.getScaleX(), pageTransform.getShearY(), - pageTransform.getShearX(), pageTransform.getScaleY(), - pageTransform.getTranslateX(), - -pageTransform.getTranslateY() + pageY + pageTransform.getScaleX(), pageTransform.getShearY(), + pageTransform.getShearX(), pageTransform.getScaleY(), + pageTransform.getTranslateX(), + -pageTransform.getTranslateY() + pageY }; - double[] test2 = + double[] test2 = { - currentTransform.getScaleX(), - currentTransform.getShearY(), - -currentTransform.getShearX(), - -currentTransform.getScaleY(), - currentTransform.getTranslateX(), - currentTransform.getTranslateY() + currentTransform.getScaleX(), + currentTransform.getShearY(), + -currentTransform.getShearX(), + -currentTransform.getScaleY(), + currentTransform.getTranslateX(), + currentTransform.getTranslateY() }; AffineTransform total = new AffineTransform(test); @@ -673,43 +673,43 @@ class PostScriptGraphics2D extends Graphics2D while (! pi.isDone()) { - switch (pi.currentSegment(coords)) - { - case PathIterator.SEG_MOVETO: - out.println((coords[0]) + " " + (Y - coords[1]) + " moveto"); - cx = coords[0]; - cy = coords[1]; - break; - case PathIterator.SEG_LINETO: - out.println((coords[0]) + " " + (Y - coords[1]) + " lineto"); - cx = coords[0]; - cy = coords[1]; - break; - case PathIterator.SEG_QUADTO: - // convert to cubic bezier points - float x1 = (cx + 2 * coords[0]) / 3; - float y1 = (cy + 2 * coords[1]) / 3; - float x2 = (2 * coords[2] + coords[0]) / 3; - float y2 = (2 * coords[3] + coords[1]) / 3; - - out.print((x1) + " " + (Y - y1) + " "); - out.print((x2) + " " + (Y - y2) + " "); - out.println((coords[2]) + " " + (Y - coords[3]) + " curveto"); - cx = coords[2]; - cy = coords[3]; - break; - case PathIterator.SEG_CUBICTO: - out.print((coords[0]) + " " + (Y - coords[1]) + " "); - out.print((coords[2]) + " " + (Y - coords[3]) + " "); - out.println((coords[4]) + " " + (Y - coords[5]) + " curveto"); - cx = coords[4]; - cy = coords[5]; - break; - case PathIterator.SEG_CLOSE: - out.println("closepath"); - break; - } - pi.next(); + switch (pi.currentSegment(coords)) + { + case PathIterator.SEG_MOVETO: + out.println((coords[0]) + " " + (Y - coords[1]) + " moveto"); + cx = coords[0]; + cy = coords[1]; + break; + case PathIterator.SEG_LINETO: + out.println((coords[0]) + " " + (Y - coords[1]) + " lineto"); + cx = coords[0]; + cy = coords[1]; + break; + case PathIterator.SEG_QUADTO: + // convert to cubic bezier points + float x1 = (cx + 2 * coords[0]) / 3; + float y1 = (cy + 2 * coords[1]) / 3; + float x2 = (2 * coords[2] + coords[0]) / 3; + float y2 = (2 * coords[3] + coords[1]) / 3; + + out.print((x1) + " " + (Y - y1) + " "); + out.print((x2) + " " + (Y - y2) + " "); + out.println((coords[2]) + " " + (Y - coords[3]) + " curveto"); + cx = coords[2]; + cy = coords[3]; + break; + case PathIterator.SEG_CUBICTO: + out.print((coords[0]) + " " + (Y - coords[1]) + " "); + out.print((coords[2]) + " " + (Y - coords[3]) + " "); + out.println((coords[4]) + " " + (Y - coords[5]) + " curveto"); + cx = coords[4]; + cy = coords[5]; + break; + case PathIterator.SEG_CLOSE: + out.println("closepath"); + break; + } + pi.next(); } out.println("fill"); @@ -851,7 +851,7 @@ class PostScriptGraphics2D extends Graphics2D try { - out.close(); + out.close(); } catch (Exception e) { @@ -877,43 +877,43 @@ class PostScriptGraphics2D extends Graphics2D while (! pi.isDone()) { - switch (pi.currentSegment(coords)) - { - case PathIterator.SEG_MOVETO: - out.println(coords[0] + " " + (coords[1]) + " moveto"); - cx = coords[0]; - cy = coords[1]; - break; - case PathIterator.SEG_LINETO: - out.println(coords[0] + " " + (coords[1]) + " lineto"); - cx = coords[0]; - cy = coords[1]; - break; - case PathIterator.SEG_QUADTO: - // convert to cubic bezier points - float x1 = (cx + 2 * coords[0]) / 3; - float y1 = (cy + 2 * coords[1]) / 3; - float x2 = (2 * coords[2] + coords[0]) / 3; - float y2 = (2 * coords[3] + coords[1]) / 3; - - out.print(x1 + " " + (Y - y1) + " "); - out.print(x2 + " " + (Y - y2) + " "); - out.println(coords[2] + " " + (Y - coords[3]) + " curveto"); - cx = coords[2]; - cy = coords[3]; - break; - case PathIterator.SEG_CUBICTO: - out.print(coords[0] + " " + coords[1] + " "); - out.print(coords[2] + " " + coords[3] + " "); - out.println(coords[4] + " " + coords[5] + " curveto"); - cx = coords[4]; - cy = coords[5]; - break; - case PathIterator.SEG_CLOSE: - out.println("closepath"); - break; - } - pi.next(); + switch (pi.currentSegment(coords)) + { + case PathIterator.SEG_MOVETO: + out.println(coords[0] + " " + (coords[1]) + " moveto"); + cx = coords[0]; + cy = coords[1]; + break; + case PathIterator.SEG_LINETO: + out.println(coords[0] + " " + (coords[1]) + " lineto"); + cx = coords[0]; + cy = coords[1]; + break; + case PathIterator.SEG_QUADTO: + // convert to cubic bezier points + float x1 = (cx + 2 * coords[0]) / 3; + float y1 = (cy + 2 * coords[1]) / 3; + float x2 = (2 * coords[2] + coords[0]) / 3; + float y2 = (2 * coords[3] + coords[1]) / 3; + + out.print(x1 + " " + (Y - y1) + " "); + out.print(x2 + " " + (Y - y2) + " "); + out.println(coords[2] + " " + (Y - coords[3]) + " curveto"); + cx = coords[2]; + cy = coords[3]; + break; + case PathIterator.SEG_CUBICTO: + out.print(coords[0] + " " + coords[1] + " "); + out.print(coords[2] + " " + coords[3] + " "); + out.println(coords[4] + " " + coords[5] + " curveto"); + cx = coords[4]; + cy = coords[5]; + break; + case PathIterator.SEG_CLOSE: + out.println("closepath"); + break; + } + pi.next(); } } @@ -923,8 +923,8 @@ class PostScriptGraphics2D extends Graphics2D { clipShape = s; out.println("% clip INACTIVE"); - // writeShape(s); - // out.println("clip"); + // writeShape(s); + // out.println("clip"); } /** Strokes the outline of a Shape using the @@ -946,7 +946,7 @@ class PostScriptGraphics2D extends Graphics2D out.println("% drawGlyphVector"); Shape s = gv.getOutline(); drawStringShape(AffineTransform.getTranslateInstance(x, y) - .createTransformedShape(s)); + .createTransformedShape(s)); } /** Renders the text of the specified iterator, @@ -971,17 +971,17 @@ class PostScriptGraphics2D extends Graphics2D out.println("% fill"); if (! gradientOn) { - writeShape(s); - out.println("fill"); + writeShape(s); + out.println("fill"); } else { - out.println("gsave"); - writeShape(s); - out.println("clip"); - writeGradient(); - out.println("shfill"); - out.println("grestore"); + out.println("gsave"); + writeShape(s); + out.println("clip"); + writeGradient(); + out.println("shfill"); + out.println("grestore"); } } @@ -1011,10 +1011,10 @@ class PostScriptGraphics2D extends Graphics2D { out.println("% getFontRenderContext()"); - double[] scaling = + double[] scaling = { - pageTransform.getScaleX(), 0, 0, - -pageTransform.getScaleY(), 0, 0 + pageTransform.getScaleX(), 0, 0, + -pageTransform.getScaleY(), 0, 0 }; return (new FontRenderContext(new AffineTransform(scaling), false, true)); @@ -1050,15 +1050,15 @@ class PostScriptGraphics2D extends Graphics2D return currentTransform; } - /** - * Checks whether or not the specified Shape intersects - * the specified Rectangle, which is in device space. + /** + * Checks whether or not the specified Shape intersects + * the specified Rectangle, which is in device space. */ public boolean hit(Rectangle rect, Shape s, boolean onStroke) { Rectangle2D.Double r = new Rectangle2D.Double(rect.getX(), rect.getY(), - rect.getWidth(), - rect.getHeight()); + rect.getWidth(), + rect.getHeight()); return s.intersects(r); } @@ -1082,13 +1082,13 @@ class PostScriptGraphics2D extends Graphics2D gradientOn = false; if (paint instanceof Color) { - setColor((Color) paint); - return; + setColor((Color) paint); + return; } if (paint instanceof GradientPaint) { - gradientOn = true; - return; + gradientOn = true; + return; } } @@ -1096,13 +1096,13 @@ class PostScriptGraphics2D extends Graphics2D private String colorTriple(Color c) { return (((double) c.getRed() / 255.0) + " " - + ((double) c.getGreen() / 255.0) + " " - + ((double) c.getBlue() / 255.0)); + + ((double) c.getGreen() / 255.0) + " " + + ((double) c.getBlue() / 255.0)); } /** * Get a nonsperated hex RGB triple, eg FFFFFF = white - * used by writeGradient and drawImage + * used by writeGradient and drawImage */ private String colorTripleHex(Color c) { @@ -1135,11 +1135,11 @@ class PostScriptGraphics2D extends Graphics2D // get number of repetitions while (x + n * dx < pageY && y + n * dy < pageX && x + n * dx > 0 - && y + n * dy > 0) + && y + n * dy > 0) n++; out.println("<<"); // start - out.println("/ShadingType 2"); // gradient fill + out.println("/ShadingType 2"); // gradient fill out.println("/ColorSpace [ /DeviceRGB ]"); // RGB colors out.print("/Coords ["); out.print(x + " " + y + " " + (x + n * dx) + " " + (y + n * dy) + " "); @@ -1152,17 +1152,17 @@ class PostScriptGraphics2D extends Graphics2D out.println("/BitsPerSample 8"); out.println("/Size [ " + (1 + n) + " ]"); out.print("/DataSource < " + colorTripleHex(paint.getColor1()) + " " - + colorTripleHex(paint.getColor2()) + " "); + + colorTripleHex(paint.getColor2()) + " "); for (; n > 1; n--) if (paint.isCyclic()) - { - if ((n % 2) == 1) - out.print(colorTripleHex(paint.getColor1()) + " "); - else - out.print(colorTripleHex(paint.getColor2()) + " "); - } + { + if ((n % 2) == 1) + out.print(colorTripleHex(paint.getColor1()) + " "); + else + out.print(colorTripleHex(paint.getColor2()) + " "); + } else - out.print(colorTripleHex(paint.getColor2()) + " "); + out.print(colorTripleHex(paint.getColor2()) + " "); out.println(">"); out.println(">>"); out.println(">>"); @@ -1181,7 +1181,7 @@ class PostScriptGraphics2D extends Graphics2D /* we don't allow the changing of rendering hints. */ } - /** + /** * Sets the Stroke for the Graphics2D context. BasicStroke fully implemented. */ public void setStroke(Stroke s) @@ -1195,53 +1195,53 @@ class PostScriptGraphics2D extends Graphics2D out.println("% setStroke()"); try { - // set the line width - out.println(bs.getLineWidth() + " setlinewidth"); - - // set the line dash - float[] dashArray = bs.getDashArray(); - if (dashArray != null) - { - out.print("[ "); - for (int i = 0; i < dashArray.length; i++) - out.print(dashArray[i] + " "); - out.println("] " + bs.getDashPhase() + " setdash"); - } - else - out.println("[] 0 setdash"); // set solid - - // set the line cap - switch (bs.getEndCap()) - { - case BasicStroke.CAP_BUTT: - out.println("0 setlinecap"); - break; - case BasicStroke.CAP_ROUND: - out.println("1 setlinecap"); - break; - case BasicStroke.CAP_SQUARE: - out.println("2 setlinecap"); - break; - } - - // set the line join - switch (bs.getLineJoin()) - { - case BasicStroke.JOIN_BEVEL: - out.println("2 setlinejoin"); - break; - case BasicStroke.JOIN_MITER: - out.println("0 setlinejoin"); - out.println(bs.getMiterLimit() + " setmiterlimit"); - break; - case BasicStroke.JOIN_ROUND: - out.println("1 setlinejoin"); - break; - } + // set the line width + out.println(bs.getLineWidth() + " setlinewidth"); + + // set the line dash + float[] dashArray = bs.getDashArray(); + if (dashArray != null) + { + out.print("[ "); + for (int i = 0; i < dashArray.length; i++) + out.print(dashArray[i] + " "); + out.println("] " + bs.getDashPhase() + " setdash"); + } + else + out.println("[] 0 setdash"); // set solid + + // set the line cap + switch (bs.getEndCap()) + { + case BasicStroke.CAP_BUTT: + out.println("0 setlinecap"); + break; + case BasicStroke.CAP_ROUND: + out.println("1 setlinecap"); + break; + case BasicStroke.CAP_SQUARE: + out.println("2 setlinecap"); + break; + } + + // set the line join + switch (bs.getLineJoin()) + { + case BasicStroke.JOIN_BEVEL: + out.println("2 setlinejoin"); + break; + case BasicStroke.JOIN_MITER: + out.println("0 setlinejoin"); + out.println(bs.getMiterLimit() + " setmiterlimit"); + break; + case BasicStroke.JOIN_ROUND: + out.println("1 setlinejoin"); + break; + } } catch (Exception e) { - out.println("% Exception in setStroke()"); + out.println("% Exception in setStroke()"); } } diff --git a/gnu/java/awt/print/SpooledDocument.java b/gnu/java/awt/print/SpooledDocument.java index 812906b18..54819984f 100644 --- a/gnu/java/awt/print/SpooledDocument.java +++ b/gnu/java/awt/print/SpooledDocument.java @@ -53,13 +53,13 @@ public class SpooledDocument implements Doc public SpooledDocument(File file) { - try + try { - fis = new FileInputStream(file); + fis = new FileInputStream(file); } - catch (FileNotFoundException ffne) + catch (FileNotFoundException ffne) { - // Shouldn't happen. + // Shouldn't happen. } } @@ -77,7 +77,7 @@ public class SpooledDocument implements Doc { return fis; } - + public Reader getReaderForText() { return new InputStreamReader(fis); diff --git a/gnu/java/beans/BeanInfoEmbryo.java b/gnu/java/beans/BeanInfoEmbryo.java index 0cf73e5b9..cc474e817 100644 --- a/gnu/java/beans/BeanInfoEmbryo.java +++ b/gnu/java/beans/BeanInfoEmbryo.java @@ -7,7 +7,7 @@ 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 @@ -70,79 +70,79 @@ import java.util.Vector; public class BeanInfoEmbryo { - // by using a TreeMap the properties will be sorted alphabetically by name - // which matches the (undocumented) behavior of jdk - TreeMap properties = new TreeMap(); - Hashtable events = new Hashtable(); - Vector methods = new Vector(); - - BeanDescriptor beanDescriptor; - BeanInfo[] additionalBeanInfo; - java.awt.Image[] im; - String defaultPropertyName; - String defaultEventName; - - public BeanInfoEmbryo() { - } - - public BeanInfo getBeanInfo() { - int defaultProperty = -1; - int defaultEvent = -1; - - PropertyDescriptor[] Aproperties = new PropertyDescriptor[properties.size()]; - int i = 0; - Iterator it = properties.entrySet().iterator(); - while (it.hasNext()) { - Aproperties[i] = (PropertyDescriptor) (((Map.Entry)it.next()).getValue()); - if(defaultPropertyName != null && Aproperties[i].getName().equals(defaultPropertyName)) { - defaultProperty = i; - } - i++; - } - - EventSetDescriptor[] Aevents = new EventSetDescriptor[events.size()]; - i = 0; - Enumeration e = events.elements(); - while (e.hasMoreElements()) { - Aevents[i] = (EventSetDescriptor) e.nextElement(); - if(defaultEventName != null && Aevents[i].getName().equals(defaultEventName)) { - defaultEvent = i; - } - i++; - } - - MethodDescriptor[] Amethods = new MethodDescriptor[methods.size()]; - methods.copyInto(Amethods); - - return new ExplicitBeanInfo(beanDescriptor,additionalBeanInfo,Aproperties,defaultProperty,Aevents,defaultEvent,Amethods,im); - } - - public void setBeanDescriptor(BeanDescriptor b) { - beanDescriptor = b; - } - - public void setAdditionalBeanInfo(BeanInfo[] b) { - additionalBeanInfo = b; - } - - public boolean hasProperty(PropertyDescriptor p) { - return properties.get(p.getName()) != null; - } - public void addProperty(PropertyDescriptor p) { - properties.put(p.getName(),p); - } - public void addIndexedProperty(IndexedPropertyDescriptor p) { - properties.put(p.getName(),p); - } - - public boolean hasEvent(EventSetDescriptor e) { - return events.get(e.getName()) != null; - } - public void addEvent(EventSetDescriptor e) { - events.put(e.getName(),e); - } - - public boolean hasMethod(MethodDescriptor m) { + // by using a TreeMap the properties will be sorted alphabetically by name + // which matches the (undocumented) behavior of jdk + TreeMap properties = new TreeMap(); + Hashtable events = new Hashtable(); + Vector methods = new Vector(); + + BeanDescriptor beanDescriptor; + BeanInfo[] additionalBeanInfo; + java.awt.Image[] im; + String defaultPropertyName; + String defaultEventName; + + public BeanInfoEmbryo() { + } + + public BeanInfo getBeanInfo() { + int defaultProperty = -1; + int defaultEvent = -1; + + PropertyDescriptor[] Aproperties = new PropertyDescriptor[properties.size()]; + int i = 0; + Iterator it = properties.entrySet().iterator(); + while (it.hasNext()) { + Aproperties[i] = (PropertyDescriptor) (((Map.Entry)it.next()).getValue()); + if(defaultPropertyName != null && Aproperties[i].getName().equals(defaultPropertyName)) { + defaultProperty = i; + } + i++; + } + + EventSetDescriptor[] Aevents = new EventSetDescriptor[events.size()]; + i = 0; + Enumeration e = events.elements(); + while (e.hasMoreElements()) { + Aevents[i] = (EventSetDescriptor) e.nextElement(); + if(defaultEventName != null && Aevents[i].getName().equals(defaultEventName)) { + defaultEvent = i; + } + i++; + } + + MethodDescriptor[] Amethods = new MethodDescriptor[methods.size()]; + methods.copyInto(Amethods); + + return new ExplicitBeanInfo(beanDescriptor,additionalBeanInfo,Aproperties,defaultProperty,Aevents,defaultEvent,Amethods,im); + } + + public void setBeanDescriptor(BeanDescriptor b) { + beanDescriptor = b; + } + + public void setAdditionalBeanInfo(BeanInfo[] b) { + additionalBeanInfo = b; + } + + public boolean hasProperty(PropertyDescriptor p) { + return properties.get(p.getName()) != null; + } + public void addProperty(PropertyDescriptor p) { + properties.put(p.getName(),p); + } + public void addIndexedProperty(IndexedPropertyDescriptor p) { + properties.put(p.getName(),p); + } + + public boolean hasEvent(EventSetDescriptor e) { + return events.get(e.getName()) != null; + } + public void addEvent(EventSetDescriptor e) { + events.put(e.getName(),e); + } + + public boolean hasMethod(MethodDescriptor m) { for(int i=0;i<methods.size();i++) { Method thisMethod = ((MethodDescriptor)methods.elementAt(i)).getMethod(); if(m.getMethod().getName().equals(thisMethod.getName()) @@ -152,20 +152,20 @@ public class BeanInfoEmbryo { } } return false; - } - public void addMethod(MethodDescriptor m) { - methods.addElement(m); - } - - public void setDefaultPropertyName(String defaultPropertyName) { - this.defaultPropertyName = defaultPropertyName; - } - - public void setDefaultEventName(String defaultEventName) { - this.defaultEventName = defaultEventName; - } - - public void setIcons(java.awt.Image[] im) { - this.im = im; - } + } + public void addMethod(MethodDescriptor m) { + methods.addElement(m); + } + + public void setDefaultPropertyName(String defaultPropertyName) { + this.defaultPropertyName = defaultPropertyName; + } + + public void setDefaultEventName(String defaultEventName) { + this.defaultEventName = defaultEventName; + } + + public void setIcons(java.awt.Image[] im) { + this.im = im; + } } diff --git a/gnu/java/beans/DefaultExceptionListener.java b/gnu/java/beans/DefaultExceptionListener.java index 42b31fae8..124ad9c94 100644 --- a/gnu/java/beans/DefaultExceptionListener.java +++ b/gnu/java/beans/DefaultExceptionListener.java @@ -55,12 +55,12 @@ public class DefaultExceptionListener implements ExceptionListener { public final static DefaultExceptionListener INSTANCE = new DefaultExceptionListener(); - + public void exceptionThrown(Exception e) { System.err.println("exception thrown: " + e + " - message: " + e.getMessage()); } - + } diff --git a/gnu/java/beans/ExplicitBeanInfo.java b/gnu/java/beans/ExplicitBeanInfo.java index 6da5e8696..30f1de4fc 100644 --- a/gnu/java/beans/ExplicitBeanInfo.java +++ b/gnu/java/beans/ExplicitBeanInfo.java @@ -7,7 +7,7 @@ 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 @@ -55,95 +55,95 @@ import java.beans.PropertyDescriptor; **/ public class ExplicitBeanInfo implements BeanInfo { - /** The BeanDescriptor returned by getBeanDescriptor. **/ - protected BeanDescriptor beanDescriptor; - - /** The EventSetDescriptor array returned by - ** getEventSetDescriptors(). - **/ - protected EventSetDescriptor[] eventSetDescriptors = new EventSetDescriptor[0]; - - /** The PropertyDescriptor array returned by - ** getPropertyDescriptors(). - **/ - protected PropertyDescriptor[] propertyDescriptors = new PropertyDescriptor[0]; - - /** The MethodDescriptor array returned by - ** getMethodDescriptors(). - **/ - protected MethodDescriptor[] methodDescriptors; - - /** The default property index. **/ - protected int defaultPropertyIndex; - - /** The default event index. **/ - protected int defaultEventIndex; - - /** The BeanInfo array returned by - ** getAdditionalBeanInfo(). - **/ - protected BeanInfo[] additionalBeanInfo; - - /** The set of icons. **/ - protected Image[] icons; - - public ExplicitBeanInfo(BeanDescriptor beanDescriptor, - BeanInfo[] additionalBeanInfo, - PropertyDescriptor[] propertyDescriptors, - int defaultPropertyIndex, - EventSetDescriptor[] eventSetDescriptors, - int defaultEventIndex, - MethodDescriptor[] methodDescriptors, - Image[] icons) { - this.beanDescriptor = beanDescriptor; - this.additionalBeanInfo = additionalBeanInfo; - this.propertyDescriptors = propertyDescriptors; - this.defaultPropertyIndex = defaultPropertyIndex; - this.eventSetDescriptors = eventSetDescriptors; - this.defaultEventIndex = defaultEventIndex; - this.methodDescriptors = methodDescriptors; - this.icons = icons; - } - - /** Get Bean descriptor. **/ - public BeanDescriptor getBeanDescriptor() { - return beanDescriptor; - } - - /** Get Bean events. **/ - public EventSetDescriptor[] getEventSetDescriptors() { - return eventSetDescriptors; - } - - /** Get default event set. **/ - public int getDefaultEventIndex() { - return defaultEventIndex; - } - - /** Get Bean properties. **/ - public PropertyDescriptor[] getPropertyDescriptors() { - return propertyDescriptors; - } - - /** Get "default" property. **/ - public int getDefaultPropertyIndex() { - return defaultPropertyIndex; - } - - /** Get Bean methods. **/ - public MethodDescriptor[] getMethodDescriptors() { - return methodDescriptors; - } - - /** Get additional Bean info. **/ - public BeanInfo[] getAdditionalBeanInfo() { - return additionalBeanInfo; - } - - /** Get Bean icons. - ** @param iconType the type of icon - **/ - public Image getIcon(int iconType) { - return icons != null ? icons[iconType - 1] : null; - } + /** The BeanDescriptor returned by getBeanDescriptor. **/ + protected BeanDescriptor beanDescriptor; + + /** The EventSetDescriptor array returned by + ** getEventSetDescriptors(). + **/ + protected EventSetDescriptor[] eventSetDescriptors = new EventSetDescriptor[0]; + + /** The PropertyDescriptor array returned by + ** getPropertyDescriptors(). + **/ + protected PropertyDescriptor[] propertyDescriptors = new PropertyDescriptor[0]; + + /** The MethodDescriptor array returned by + ** getMethodDescriptors(). + **/ + protected MethodDescriptor[] methodDescriptors; + + /** The default property index. **/ + protected int defaultPropertyIndex; + + /** The default event index. **/ + protected int defaultEventIndex; + + /** The BeanInfo array returned by + ** getAdditionalBeanInfo(). + **/ + protected BeanInfo[] additionalBeanInfo; + + /** The set of icons. **/ + protected Image[] icons; + + public ExplicitBeanInfo(BeanDescriptor beanDescriptor, + BeanInfo[] additionalBeanInfo, + PropertyDescriptor[] propertyDescriptors, + int defaultPropertyIndex, + EventSetDescriptor[] eventSetDescriptors, + int defaultEventIndex, + MethodDescriptor[] methodDescriptors, + Image[] icons) { + this.beanDescriptor = beanDescriptor; + this.additionalBeanInfo = additionalBeanInfo; + this.propertyDescriptors = propertyDescriptors; + this.defaultPropertyIndex = defaultPropertyIndex; + this.eventSetDescriptors = eventSetDescriptors; + this.defaultEventIndex = defaultEventIndex; + this.methodDescriptors = methodDescriptors; + this.icons = icons; + } + + /** Get Bean descriptor. **/ + public BeanDescriptor getBeanDescriptor() { + return beanDescriptor; + } + + /** Get Bean events. **/ + public EventSetDescriptor[] getEventSetDescriptors() { + return eventSetDescriptors; + } + + /** Get default event set. **/ + public int getDefaultEventIndex() { + return defaultEventIndex; + } + + /** Get Bean properties. **/ + public PropertyDescriptor[] getPropertyDescriptors() { + return propertyDescriptors; + } + + /** Get "default" property. **/ + public int getDefaultPropertyIndex() { + return defaultPropertyIndex; + } + + /** Get Bean methods. **/ + public MethodDescriptor[] getMethodDescriptors() { + return methodDescriptors; + } + + /** Get additional Bean info. **/ + public BeanInfo[] getAdditionalBeanInfo() { + return additionalBeanInfo; + } + + /** Get Bean icons. + ** @param iconType the type of icon + **/ + public Image getIcon(int iconType) { + return icons != null ? icons[iconType - 1] : null; + } } diff --git a/gnu/java/beans/IntrospectionIncubator.java b/gnu/java/beans/IntrospectionIncubator.java index e0d9480e3..978429a1e 100644 --- a/gnu/java/beans/IntrospectionIncubator.java +++ b/gnu/java/beans/IntrospectionIncubator.java @@ -7,7 +7,7 @@ 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 @@ -69,373 +69,373 @@ import java.util.Vector; **/ public class IntrospectionIncubator { - Hashtable propertyMethods = new Hashtable(); - Hashtable listenerMethods = new Hashtable(); - Vector otherMethods = new Vector(); - - Class propertyStopClass; - Class eventStopClass; - Class methodStopClass; - - public IntrospectionIncubator() { - } - - /** Examines the given method and files it in a suitable collection. - * It files the method as a property method if it finds: - * <ul> - * <li>boolean "is" getter</li> - * <li>"get" style getter</li> - * <li>single argument setter</li> - * <li>indiced setter and getter</li> - * </ul> - * It files the method as a listener method if all of these rules apply: - * <ul> - * <li>the method name starts with "add" or "remove"</li> - * <li>there is only a single argument</li> - * <li>the argument type is a subclass of <code>java.util.EventListener</code></li> - * </ul> - * All public methods are filed as such. - * - * @param method The method instance to examine. - */ - public void addMethod(Method method) { - if(Modifier.isPublic(method.getModifiers())) { - String name = ClassHelper.getTruncatedName(method.getName()); - Class retType = method.getReturnType(); - Class[] params = method.getParameterTypes(); - boolean isVoid = retType.equals(java.lang.Void.TYPE); - Class methodClass = method.getDeclaringClass(); - - /* Accepts the method for examination if no stop class is given or the method is declared in a subclass of the stop class. - * The rules for this are described in {@link java.beans.Introspector.getBeanInfo(Class, Class)}. - * This block finds out whether the method is a suitable getter or setter method (or read/write method). - */ - if(isReachable(propertyStopClass, methodClass)) { - /* At this point a method may regarded as a property's read or write method if its name - * starts with "is", "get" or "set". However, if a method is static it cannot be part - * of a property. - */ - if(Modifier.isStatic(method.getModifiers())) { - // files method as other because it is static - otherMethods.addElement(method); - } else if(name.startsWith("is") - && retType.equals(java.lang.Boolean.TYPE) - && params.length == 0) { - // files method as boolean "is" style getter - addToPropertyHash(name,method,IS); - } else if(name.startsWith("get") && !isVoid) { - if(params.length == 0) { - // files as legal non-argument getter - addToPropertyHash(name,method,GET); - } else if(params.length == 1 && params[0].equals(java.lang.Integer.TYPE)) { - // files as legal indiced getter - addToPropertyHash(name,method,GET_I); - } else { - // files as other because the method's signature is not Bean-like - otherMethods.addElement(method); - } - } else if(name.startsWith("set") && isVoid) { - if(params.length == 1) { - // files as legal single-argument setter method - addToPropertyHash(name,method,SET); - } else if(params.length == 2 && params[0].equals(java.lang.Integer.TYPE)) { - // files as legal indiced setter method - addToPropertyHash(name,method,SET_I); - } else { - // files as other because the method's signature is not Bean-like - otherMethods.addElement(method); - } - } - } - - if(isReachable(eventStopClass, methodClass)) { - if(name.startsWith("add") - && isVoid - && params.length == 1 - && java.util.EventListener.class.isAssignableFrom(params[0])) { - addToListenerHash(name,method,ADD); - } else if(name.startsWith("remove") - && isVoid - && params.length == 1 - && java.util.EventListener.class.isAssignableFrom(params[0])) { - addToListenerHash(name,method,REMOVE); - } - } - - if(isReachable(methodStopClass, methodClass)) { - // files as reachable public method - otherMethods.addElement(method); - } - - } - } - - public void addMethods(Method[] m) { - for(int i=0;i<m.length;i++) { - addMethod(m[i]); - } - } - - public void setPropertyStopClass(Class c) { - propertyStopClass = c; - } - - public void setEventStopClass(Class c) { - eventStopClass = c; - } - - public void setMethodStopClass(Class c) { - methodStopClass = c; - } - - - public BeanInfoEmbryo getBeanInfoEmbryo() throws IntrospectionException { - BeanInfoEmbryo b = new BeanInfoEmbryo(); - findXXX(b,IS); - findXXXInt(b,GET_I); - findXXXInt(b,SET_I); - findXXX(b,GET); - findXXX(b,SET); - findAddRemovePairs(b); - for(int i=0;i<otherMethods.size();i++) { - MethodDescriptor newMethod = new MethodDescriptor((Method)otherMethods.elementAt(i)); - if(!b.hasMethod(newMethod)) { - b.addMethod(new MethodDescriptor((Method)otherMethods.elementAt(i))); - } - } - return b; - } - - public BeanInfo getBeanInfo() throws IntrospectionException { - return getBeanInfoEmbryo().getBeanInfo(); - } - - - void findAddRemovePairs(BeanInfoEmbryo b) throws IntrospectionException { - Enumeration listenerEnum = listenerMethods.keys(); - while(listenerEnum.hasMoreElements()) { - DoubleKey k = (DoubleKey)listenerEnum.nextElement(); - Method[] m = (Method[])listenerMethods.get(k); - if(m[ADD] != null && m[REMOVE] != null) { - EventSetDescriptor e = new EventSetDescriptor(Introspector.decapitalize(k.getName()), - k.getType(), k.getType().getMethods(), - m[ADD],m[REMOVE]); - e.setUnicast(ArrayHelper.contains(m[ADD].getExceptionTypes(),java.util.TooManyListenersException.class)); - if(!b.hasEvent(e)) { - b.addEvent(e); - } - } - } - } - - void findXXX(BeanInfoEmbryo b, int funcType) throws IntrospectionException { - Enumeration keys = propertyMethods.keys(); - while(keys.hasMoreElements()) { - DoubleKey k = (DoubleKey)keys.nextElement(); - Method[] m = (Method[])propertyMethods.get(k); - if(m[funcType] != null) { - PropertyDescriptor p = new PropertyDescriptor(Introspector.decapitalize(k.getName()), - m[IS] != null ? m[IS] : m[GET], - m[SET]); - if(m[SET] != null) { - p.setConstrained(ArrayHelper.contains(m[SET].getExceptionTypes(),java.beans.PropertyVetoException.class)); - } - if(!b.hasProperty(p)) { - b.addProperty(p); - } - } - } - } - - void findXXXInt(BeanInfoEmbryo b, int funcType) throws IntrospectionException { - Enumeration keys = propertyMethods.keys(); - while(keys.hasMoreElements()) { - DoubleKey k = (DoubleKey)keys.nextElement(); - Method[] m = (Method[])propertyMethods.get(k); - if(m[funcType] != null) { - boolean constrained; - if(m[SET_I] != null) { - constrained = ArrayHelper.contains(m[SET_I].getExceptionTypes(),java.beans.PropertyVetoException.class); - } else { - constrained = false; - } - - /** Find out if there is an array type get or set **/ - Class arrayType = Array.newInstance(k.getType(),0).getClass(); - DoubleKey findSetArray = new DoubleKey(arrayType,k.getName()); - Method[] m2 = (Method[])propertyMethods.get(findSetArray); - IndexedPropertyDescriptor p; - if(m2 == null) { - p = new IndexedPropertyDescriptor(Introspector.decapitalize(k.getName()), - null,null, - m[GET_I],m[SET_I]); - } else { - if(constrained && m2[SET] != null) { - constrained = ArrayHelper.contains(m2[SET].getExceptionTypes(),java.beans.PropertyVetoException.class); - } - p = new IndexedPropertyDescriptor(Introspector.decapitalize(k.getName()), - m2[GET],m2[SET], - m[GET_I],m[SET_I]); - } - p.setConstrained(constrained); - if(!b.hasProperty(p)) { - b.addProperty(p); - } - } - } - } - - static final int IS=0; - static final int GET_I=1; - static final int SET_I=2; - static final int GET=3; - static final int SET=4; - - static final int ADD=0; - static final int REMOVE=1; - - void addToPropertyHash(String name, Method method, int funcType) { - String newName; - Class type; - - switch(funcType) { - case IS: - type = java.lang.Boolean.TYPE; - newName = name.substring(2); - break; - case GET_I: - type = method.getReturnType(); - newName = name.substring(3); - break; - case SET_I: - type = method.getParameterTypes()[1]; - newName = name.substring(3); - break; - case GET: - type = method.getReturnType(); - newName = name.substring(3); - break; - case SET: - type = method.getParameterTypes()[0]; - newName = name.substring(3); - break; - default: - return; - } - newName = capitalize(newName); - if (newName.length() == 0) - return; - - DoubleKey k = new DoubleKey(type,newName); - Method[] methods = (Method[])propertyMethods.get(k); - if(methods == null) { - methods = new Method[5]; - propertyMethods.put(k,methods); - } - methods[funcType] = method; - } - - void addToListenerHash(String name, Method method, int funcType) { - String newName; - Class type; - - switch(funcType) { - case ADD: - type = method.getParameterTypes()[0]; - newName = name.substring(3,name.length()-8); - break; - case REMOVE: - type = method.getParameterTypes()[0]; - newName = name.substring(6,name.length()-8); - break; - default: - return; - } - newName = capitalize(newName); - if (newName.length() == 0) - return; - - DoubleKey k = new DoubleKey(type,newName); - Method[] methods = (Method[])listenerMethods.get(k); - if(methods == null) { - methods = new Method[2]; - listenerMethods.put(k,methods); - } - methods[funcType] = method; - } - - /* Determines whether <code>stopClass</code> is <code>null</code> - * or <code>declaringClass<code> is a true subclass of <code>stopClass</code>. - * This expression is useful to detect whether a method should be introspected or not. - * The rules for this are described in {@link java.beans.Introspector.getBeanInfo(Class, Class)}. - */ - static boolean isReachable(Class stopClass, Class declaringClass) { - return stopClass == null || (stopClass.isAssignableFrom(declaringClass) && !stopClass.equals(declaringClass)); - } - - /** Transforms a property name into a part of a method name. - * E.g. "value" becomes "Value" which can then concatenated with - * "set", "get" or "is" to form a valid method name. - * - * Implementation notes: - * If "" is the argument, it is returned without changes. - * If <code>null</code> is the argument, <code>null</code> is returned. - * - * @param name Name of a property. - * @return Part of a method name of a property. - */ - static String capitalize(String name) { - try { - if(Character.isUpperCase(name.charAt(0))) { - return name; - } else { - char[] c = name.toCharArray(); - c[0] = Character.toLowerCase(c[0]); - return new String(c); - } - } catch(StringIndexOutOfBoundsException E) { - return name; - } catch(NullPointerException E) { - return null; - } - } + Hashtable propertyMethods = new Hashtable(); + Hashtable listenerMethods = new Hashtable(); + Vector otherMethods = new Vector(); + + Class propertyStopClass; + Class eventStopClass; + Class methodStopClass; + + public IntrospectionIncubator() { + } + + /** Examines the given method and files it in a suitable collection. + * It files the method as a property method if it finds: + * <ul> + * <li>boolean "is" getter</li> + * <li>"get" style getter</li> + * <li>single argument setter</li> + * <li>indiced setter and getter</li> + * </ul> + * It files the method as a listener method if all of these rules apply: + * <ul> + * <li>the method name starts with "add" or "remove"</li> + * <li>there is only a single argument</li> + * <li>the argument type is a subclass of <code>java.util.EventListener</code></li> + * </ul> + * All public methods are filed as such. + * + * @param method The method instance to examine. + */ + public void addMethod(Method method) { + if(Modifier.isPublic(method.getModifiers())) { + String name = ClassHelper.getTruncatedName(method.getName()); + Class retType = method.getReturnType(); + Class[] params = method.getParameterTypes(); + boolean isVoid = retType.equals(java.lang.Void.TYPE); + Class methodClass = method.getDeclaringClass(); + + /* Accepts the method for examination if no stop class is given or the method is declared in a subclass of the stop class. + * The rules for this are described in {@link java.beans.Introspector.getBeanInfo(Class, Class)}. + * This block finds out whether the method is a suitable getter or setter method (or read/write method). + */ + if(isReachable(propertyStopClass, methodClass)) { + /* At this point a method may regarded as a property's read or write method if its name + * starts with "is", "get" or "set". However, if a method is static it cannot be part + * of a property. + */ + if(Modifier.isStatic(method.getModifiers())) { + // files method as other because it is static + otherMethods.addElement(method); + } else if(name.startsWith("is") + && retType.equals(java.lang.Boolean.TYPE) + && params.length == 0) { + // files method as boolean "is" style getter + addToPropertyHash(name,method,IS); + } else if(name.startsWith("get") && !isVoid) { + if(params.length == 0) { + // files as legal non-argument getter + addToPropertyHash(name,method,GET); + } else if(params.length == 1 && params[0].equals(java.lang.Integer.TYPE)) { + // files as legal indiced getter + addToPropertyHash(name,method,GET_I); + } else { + // files as other because the method's signature is not Bean-like + otherMethods.addElement(method); + } + } else if(name.startsWith("set") && isVoid) { + if(params.length == 1) { + // files as legal single-argument setter method + addToPropertyHash(name,method,SET); + } else if(params.length == 2 && params[0].equals(java.lang.Integer.TYPE)) { + // files as legal indiced setter method + addToPropertyHash(name,method,SET_I); + } else { + // files as other because the method's signature is not Bean-like + otherMethods.addElement(method); + } + } + } + + if(isReachable(eventStopClass, methodClass)) { + if(name.startsWith("add") + && isVoid + && params.length == 1 + && java.util.EventListener.class.isAssignableFrom(params[0])) { + addToListenerHash(name,method,ADD); + } else if(name.startsWith("remove") + && isVoid + && params.length == 1 + && java.util.EventListener.class.isAssignableFrom(params[0])) { + addToListenerHash(name,method,REMOVE); + } + } + + if(isReachable(methodStopClass, methodClass)) { + // files as reachable public method + otherMethods.addElement(method); + } + + } + } + + public void addMethods(Method[] m) { + for(int i=0;i<m.length;i++) { + addMethod(m[i]); + } + } + + public void setPropertyStopClass(Class c) { + propertyStopClass = c; + } + + public void setEventStopClass(Class c) { + eventStopClass = c; + } + + public void setMethodStopClass(Class c) { + methodStopClass = c; + } + + + public BeanInfoEmbryo getBeanInfoEmbryo() throws IntrospectionException { + BeanInfoEmbryo b = new BeanInfoEmbryo(); + findXXX(b,IS); + findXXXInt(b,GET_I); + findXXXInt(b,SET_I); + findXXX(b,GET); + findXXX(b,SET); + findAddRemovePairs(b); + for(int i=0;i<otherMethods.size();i++) { + MethodDescriptor newMethod = new MethodDescriptor((Method)otherMethods.elementAt(i)); + if(!b.hasMethod(newMethod)) { + b.addMethod(new MethodDescriptor((Method)otherMethods.elementAt(i))); + } + } + return b; + } + + public BeanInfo getBeanInfo() throws IntrospectionException { + return getBeanInfoEmbryo().getBeanInfo(); + } + + + void findAddRemovePairs(BeanInfoEmbryo b) throws IntrospectionException { + Enumeration listenerEnum = listenerMethods.keys(); + while(listenerEnum.hasMoreElements()) { + DoubleKey k = (DoubleKey)listenerEnum.nextElement(); + Method[] m = (Method[])listenerMethods.get(k); + if(m[ADD] != null && m[REMOVE] != null) { + EventSetDescriptor e = new EventSetDescriptor(Introspector.decapitalize(k.getName()), + k.getType(), k.getType().getMethods(), + m[ADD],m[REMOVE]); + e.setUnicast(ArrayHelper.contains(m[ADD].getExceptionTypes(),java.util.TooManyListenersException.class)); + if(!b.hasEvent(e)) { + b.addEvent(e); + } + } + } + } + + void findXXX(BeanInfoEmbryo b, int funcType) throws IntrospectionException { + Enumeration keys = propertyMethods.keys(); + while(keys.hasMoreElements()) { + DoubleKey k = (DoubleKey)keys.nextElement(); + Method[] m = (Method[])propertyMethods.get(k); + if(m[funcType] != null) { + PropertyDescriptor p = new PropertyDescriptor(Introspector.decapitalize(k.getName()), + m[IS] != null ? m[IS] : m[GET], + m[SET]); + if(m[SET] != null) { + p.setConstrained(ArrayHelper.contains(m[SET].getExceptionTypes(),java.beans.PropertyVetoException.class)); + } + if(!b.hasProperty(p)) { + b.addProperty(p); + } + } + } + } + + void findXXXInt(BeanInfoEmbryo b, int funcType) throws IntrospectionException { + Enumeration keys = propertyMethods.keys(); + while(keys.hasMoreElements()) { + DoubleKey k = (DoubleKey)keys.nextElement(); + Method[] m = (Method[])propertyMethods.get(k); + if(m[funcType] != null) { + boolean constrained; + if(m[SET_I] != null) { + constrained = ArrayHelper.contains(m[SET_I].getExceptionTypes(),java.beans.PropertyVetoException.class); + } else { + constrained = false; + } + + /** Find out if there is an array type get or set **/ + Class arrayType = Array.newInstance(k.getType(),0).getClass(); + DoubleKey findSetArray = new DoubleKey(arrayType,k.getName()); + Method[] m2 = (Method[])propertyMethods.get(findSetArray); + IndexedPropertyDescriptor p; + if(m2 == null) { + p = new IndexedPropertyDescriptor(Introspector.decapitalize(k.getName()), + null,null, + m[GET_I],m[SET_I]); + } else { + if(constrained && m2[SET] != null) { + constrained = ArrayHelper.contains(m2[SET].getExceptionTypes(),java.beans.PropertyVetoException.class); + } + p = new IndexedPropertyDescriptor(Introspector.decapitalize(k.getName()), + m2[GET],m2[SET], + m[GET_I],m[SET_I]); + } + p.setConstrained(constrained); + if(!b.hasProperty(p)) { + b.addProperty(p); + } + } + } + } + + static final int IS=0; + static final int GET_I=1; + static final int SET_I=2; + static final int GET=3; + static final int SET=4; + + static final int ADD=0; + static final int REMOVE=1; + + void addToPropertyHash(String name, Method method, int funcType) { + String newName; + Class type; + + switch(funcType) { + case IS: + type = java.lang.Boolean.TYPE; + newName = name.substring(2); + break; + case GET_I: + type = method.getReturnType(); + newName = name.substring(3); + break; + case SET_I: + type = method.getParameterTypes()[1]; + newName = name.substring(3); + break; + case GET: + type = method.getReturnType(); + newName = name.substring(3); + break; + case SET: + type = method.getParameterTypes()[0]; + newName = name.substring(3); + break; + default: + return; + } + newName = capitalize(newName); + if (newName.length() == 0) + return; + + DoubleKey k = new DoubleKey(type,newName); + Method[] methods = (Method[])propertyMethods.get(k); + if(methods == null) { + methods = new Method[5]; + propertyMethods.put(k,methods); + } + methods[funcType] = method; + } + + void addToListenerHash(String name, Method method, int funcType) { + String newName; + Class type; + + switch(funcType) { + case ADD: + type = method.getParameterTypes()[0]; + newName = name.substring(3,name.length()-8); + break; + case REMOVE: + type = method.getParameterTypes()[0]; + newName = name.substring(6,name.length()-8); + break; + default: + return; + } + newName = capitalize(newName); + if (newName.length() == 0) + return; + + DoubleKey k = new DoubleKey(type,newName); + Method[] methods = (Method[])listenerMethods.get(k); + if(methods == null) { + methods = new Method[2]; + listenerMethods.put(k,methods); + } + methods[funcType] = method; + } + + /* Determines whether <code>stopClass</code> is <code>null</code> + * or <code>declaringClass<code> is a true subclass of <code>stopClass</code>. + * This expression is useful to detect whether a method should be introspected or not. + * The rules for this are described in {@link java.beans.Introspector.getBeanInfo(Class, Class)}. + */ + static boolean isReachable(Class stopClass, Class declaringClass) { + return stopClass == null || (stopClass.isAssignableFrom(declaringClass) && !stopClass.equals(declaringClass)); + } + + /** Transforms a property name into a part of a method name. + * E.g. "value" becomes "Value" which can then concatenated with + * "set", "get" or "is" to form a valid method name. + * + * Implementation notes: + * If "" is the argument, it is returned without changes. + * If <code>null</code> is the argument, <code>null</code> is returned. + * + * @param name Name of a property. + * @return Part of a method name of a property. + */ + static String capitalize(String name) { + try { + if(Character.isUpperCase(name.charAt(0))) { + return name; + } else { + char[] c = name.toCharArray(); + c[0] = Character.toLowerCase(c[0]); + return new String(c); + } + } catch(StringIndexOutOfBoundsException E) { + return name; + } catch(NullPointerException E) { + return null; + } + } } /** This class is a hashmap key that consists of a <code>Class</code> and a * <code>String</code> element. - * + * * It is used for XXX: find out what this is used for - * + * * @author John Keiser * @author Robert Schuster - */ + */ class DoubleKey { - Class type; - String name; - - DoubleKey(Class type, String name) { - this.type = type; - this.name = name; - } - - Class getType() { - return type; - } - - String getName() { - return name; - } - - public boolean equals(Object o) { - if(o instanceof DoubleKey) { - DoubleKey d = (DoubleKey)o; - return d.type.equals(type) && d.name.equals(name); - } else { - return false; - } - } - - public int hashCode() { - return type.hashCode() ^ name.hashCode(); - } + Class type; + String name; + + DoubleKey(Class type, String name) { + this.type = type; + this.name = name; + } + + Class getType() { + return type; + } + + String getName() { + return name; + } + + public boolean equals(Object o) { + if(o instanceof DoubleKey) { + DoubleKey d = (DoubleKey)o; + return d.type.equals(type) && d.name.equals(name); + } else { + return false; + } + } + + public int hashCode() { + return type.hashCode() ^ name.hashCode(); + } } diff --git a/gnu/java/beans/decoder/AbstractContext.java b/gnu/java/beans/decoder/AbstractContext.java index 0e95d4329..e6f90e21f 100644 --- a/gnu/java/beans/decoder/AbstractContext.java +++ b/gnu/java/beans/decoder/AbstractContext.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/beans/decoder/AbstractCreatableObjectContext.java b/gnu/java/beans/decoder/AbstractCreatableObjectContext.java index 47f04fa1c..d108f191c 100644 --- a/gnu/java/beans/decoder/AbstractCreatableObjectContext.java +++ b/gnu/java/beans/decoder/AbstractCreatableObjectContext.java @@ -7,7 +7,7 @@ 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 @@ -65,7 +65,7 @@ abstract class AbstractCreatableObjectContext extends AbstractObjectContext /** Adds a parameter object to this Context. Implement this without caring * for illegal states because this has been done already. * - * @param obj The parameter object to be added. + * @param obj The parameter object to be added. */ protected abstract void addParameterObjectImpl(Object obj); @@ -83,7 +83,7 @@ abstract class AbstractCreatableObjectContext extends AbstractObjectContext /** Creates the result object. This method is called only once. Implement this * without checking for double invocations as this is already being prevented. * - * @param outerContext The Context that exists around this one. + * @param outerContext The Context that exists around this one. * @return The result object. * @throws AssemblerException if the object creation fails somehow. */ diff --git a/gnu/java/beans/decoder/AbstractElementHandler.java b/gnu/java/beans/decoder/AbstractElementHandler.java index e5578a990..51765658f 100644 --- a/gnu/java/beans/decoder/AbstractElementHandler.java +++ b/gnu/java/beans/decoder/AbstractElementHandler.java @@ -7,7 +7,7 @@ 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 @@ -91,21 +91,21 @@ abstract class AbstractElementHandler implements ElementHandler { try { - // lets the subclass create the appropriate Context instance - context = startElement(attributes, exceptionListener); + // lets the subclass create the appropriate Context instance + context = startElement(attributes, exceptionListener); } catch (AssemblyException pe) { - Throwable t = pe.getCause(); + Throwable t = pe.getCause(); - if (t instanceof Exception) - exceptionListener.exceptionThrown((Exception) t); - else - throw new InternalError("Unexpected Throwable type in AssemblerException. Please file a bug report."); + if (t instanceof Exception) + exceptionListener.exceptionThrown((Exception) t); + else + throw new InternalError("Unexpected Throwable type in AssemblerException. Please file a bug report."); - notifyContextFailed(); + notifyContextFailed(); - return; + return; } } @@ -129,48 +129,48 @@ abstract class AbstractElementHandler implements ElementHandler // is then invalid or may not exist at all) if (!hasFailed) { - try - { - // note: the order of operations is very important here - // sends the stored character data to the Context - endElement(buffer.toString()); - - // reports to the parent handler if this handler's Context is a - // statement (returning no value BACK to the parent's Context) - if (context.isStatement()) - { - // This may create a valid result in the parent's Context - // or let it fail - parent.notifyStatement(exceptionListener); - - // skips any further processing if the parent handler is now marked - // as failed - if (parent.hasFailed()) - return; - } - - // processes the Context and stores the result - putObject(context.getId(), context.endContext(parent.getContext())); - - // transfers the Context's results to the parent's Context - // if it is an expression (rather than a statement) - if (! context.isStatement()) - parent.getContext().addParameterObject(context.getResult()); - } - catch (AssemblyException pe) - { - // notifies that an exception was thrown in this handler's Context - Throwable t = pe.getCause(); - - if (t instanceof Exception) - exceptionListener.exceptionThrown((Exception) t); - else - throw (InternalError) new InternalError("Severe problem while decoding XML data.") - .initCause(t); - - // marks the handler as failed - notifyContextFailed(); - } + try + { + // note: the order of operations is very important here + // sends the stored character data to the Context + endElement(buffer.toString()); + + // reports to the parent handler if this handler's Context is a + // statement (returning no value BACK to the parent's Context) + if (context.isStatement()) + { + // This may create a valid result in the parent's Context + // or let it fail + parent.notifyStatement(exceptionListener); + + // skips any further processing if the parent handler is now marked + // as failed + if (parent.hasFailed()) + return; + } + + // processes the Context and stores the result + putObject(context.getId(), context.endContext(parent.getContext())); + + // transfers the Context's results to the parent's Context + // if it is an expression (rather than a statement) + if (! context.isStatement()) + parent.getContext().addParameterObject(context.getResult()); + } + catch (AssemblyException pe) + { + // notifies that an exception was thrown in this handler's Context + Throwable t = pe.getCause(); + + if (t instanceof Exception) + exceptionListener.exceptionThrown((Exception) t); + else + throw (InternalError) new InternalError("Severe problem while decoding XML data.") + .initCause(t); + + // marks the handler as failed + notifyContextFailed(); + } } } @@ -184,31 +184,31 @@ abstract class AbstractElementHandler implements ElementHandler { try { - - // propagates to parent handler first to generate objects - // needed by this Context instance - if(context.isStatement()) - { - parent.notifyStatement(exceptionListener); - } - - // Some Context instances do stuff which can fail now. If that - // happens this handler is marked as failed. - context.notifyStatement(parent.getContext()); + + // propagates to parent handler first to generate objects + // needed by this Context instance + if(context.isStatement()) + { + parent.notifyStatement(exceptionListener); + } + + // Some Context instances do stuff which can fail now. If that + // happens this handler is marked as failed. + context.notifyStatement(parent.getContext()); } catch (AssemblyException ae) { - // notifies that an exception was thrown in this handler's Context - Throwable t = ae.getCause(); + // notifies that an exception was thrown in this handler's Context + Throwable t = ae.getCause(); - if (t instanceof Exception) - exceptionListener.exceptionThrown((Exception) t); - else - throw (InternalError) new InternalError("Severe problem while decoding XML data.") - .initCause(t); + if (t instanceof Exception) + exceptionListener.exceptionThrown((Exception) t); + else + throw (InternalError) new InternalError("Severe problem while decoding XML data.") + .initCause(t); - // marks the handler as failed - notifyContextFailed(); + // marks the handler as failed + notifyContextFailed(); } } diff --git a/gnu/java/beans/decoder/AbstractObjectContext.java b/gnu/java/beans/decoder/AbstractObjectContext.java index 202c33b34..963ef0905 100644 --- a/gnu/java/beans/decoder/AbstractObjectContext.java +++ b/gnu/java/beans/decoder/AbstractObjectContext.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/beans/decoder/ArrayContext.java b/gnu/java/beans/decoder/ArrayContext.java index cf4267f27..bdec1c647 100644 --- a/gnu/java/beans/decoder/ArrayContext.java +++ b/gnu/java/beans/decoder/ArrayContext.java @@ -7,7 +7,7 @@ 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 @@ -67,7 +67,7 @@ class ArrayContext extends AbstractContext */ public void notifyStatement(Context outerContext) { - // method call intentionally ignored because there is not any useful effect + // method call intentionally ignored because there is not any useful effect } /* (non-Javadoc) @@ -92,11 +92,11 @@ class ArrayContext extends AbstractContext { try { - Array.set(array, index, o); + Array.set(array, index, o); } catch (ArrayIndexOutOfBoundsException aioobe) { - throw new AssemblyException(aioobe); + throw new AssemblyException(aioobe); } } @@ -104,11 +104,11 @@ class ArrayContext extends AbstractContext { try { - return Array.get(array, index); + return Array.get(array, index); } catch (ArrayIndexOutOfBoundsException aioobe) { - throw new AssemblyException(aioobe); + throw new AssemblyException(aioobe); } } diff --git a/gnu/java/beans/decoder/ArrayHandler.java b/gnu/java/beans/decoder/ArrayHandler.java index 23f028519..28930f519 100644 --- a/gnu/java/beans/decoder/ArrayHandler.java +++ b/gnu/java/beans/decoder/ArrayHandler.java @@ -7,7 +7,7 @@ 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 @@ -86,31 +86,31 @@ class ArrayHandler extends AbstractElementHandler if (className != null) { - try - { - Class klass; - - if (typeMap.containsKey(className)) - klass = (Class) typeMap.get(className); - else - klass = instantiateClass(className); - - String length = attributes.getValue("length"); - if (length != null) - // creates Array with predefined length - return new ArrayContext(id, klass, Integer.parseInt(length)); - else - // creates Array without length restriction - return new GrowableArrayContext(id, klass); - } - catch (ClassNotFoundException cnfe) - { - throw new AssemblyException(cnfe); - } - catch (NumberFormatException nfe) - { - throw new AssemblyException(nfe); - } + try + { + Class klass; + + if (typeMap.containsKey(className)) + klass = (Class) typeMap.get(className); + else + klass = instantiateClass(className); + + String length = attributes.getValue("length"); + if (length != null) + // creates Array with predefined length + return new ArrayContext(id, klass, Integer.parseInt(length)); + else + // creates Array without length restriction + return new GrowableArrayContext(id, klass); + } + catch (ClassNotFoundException cnfe) + { + throw new AssemblyException(cnfe); + } + catch (NumberFormatException nfe) + { + throw new AssemblyException(nfe); + } } throw new AssemblyException(new IllegalArgumentException("Missing 'class' attribute in <array> tag.")); diff --git a/gnu/java/beans/decoder/AssemblyException.java b/gnu/java/beans/decoder/AssemblyException.java index 29dfa65ac..206c5841b 100644 --- a/gnu/java/beans/decoder/AssemblyException.java +++ b/gnu/java/beans/decoder/AssemblyException.java @@ -7,7 +7,7 @@ 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 @@ -41,7 +41,7 @@ package gnu.java.beans.decoder; /** The AssemblyException is used to wrap the cause of problems when assembling objects. * In all cases only the wrapped exception is given to the PersistenceParser's * ExceptionListener instance (never the AssemblyException itself). - * + * * <p>Note: Often multiple steps are needed to construct a fully usuable object instance. * Such a construction can be called assembly and thats why this exception was * named AssemblyException.</p> diff --git a/gnu/java/beans/decoder/BooleanHandler.java b/gnu/java/beans/decoder/BooleanHandler.java index a675e8c90..20aed9a3f 100644 --- a/gnu/java/beans/decoder/BooleanHandler.java +++ b/gnu/java/beans/decoder/BooleanHandler.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/beans/decoder/ByteHandler.java b/gnu/java/beans/decoder/ByteHandler.java index d6c33d14d..830bbc747 100644 --- a/gnu/java/beans/decoder/ByteHandler.java +++ b/gnu/java/beans/decoder/ByteHandler.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/beans/decoder/CharHandler.java b/gnu/java/beans/decoder/CharHandler.java index 1b31e5b05..114df8b79 100644 --- a/gnu/java/beans/decoder/CharHandler.java +++ b/gnu/java/beans/decoder/CharHandler.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/beans/decoder/ClassHandler.java b/gnu/java/beans/decoder/ClassHandler.java index 1dbdd63e7..c67a79a48 100644 --- a/gnu/java/beans/decoder/ClassHandler.java +++ b/gnu/java/beans/decoder/ClassHandler.java @@ -7,7 +7,7 @@ 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 @@ -56,11 +56,11 @@ class ClassHandler extends SimpleHandler { try { - return instantiateClass(characters); + return instantiateClass(characters); } catch (ClassNotFoundException cnfe) { - throw new AssemblyException(cnfe); + throw new AssemblyException(cnfe); } } } diff --git a/gnu/java/beans/decoder/ConstructorContext.java b/gnu/java/beans/decoder/ConstructorContext.java index 7838fb7e2..32365eef4 100644 --- a/gnu/java/beans/decoder/ConstructorContext.java +++ b/gnu/java/beans/decoder/ConstructorContext.java @@ -7,7 +7,7 @@ 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 @@ -57,7 +57,7 @@ class ConstructorContext extends AbstractCreatableObjectContext ConstructorContext(String id, Class newClass) { setId(id); - // sets superclass field + // sets superclass field klass = newClass; } @@ -76,27 +76,27 @@ class ConstructorContext extends AbstractCreatableObjectContext try { - Constructor constructor = MethodFinder.getConstructor(klass, args); + Constructor constructor = MethodFinder.getConstructor(klass, args); - // instantiates object (klass field gets re-set by superclass) - return constructor.newInstance(args); + // instantiates object (klass field gets re-set by superclass) + return constructor.newInstance(args); } catch (NoSuchMethodException nsme) { - throw new AssemblyException(nsme); + throw new AssemblyException(nsme); } catch (InvocationTargetException ite) { - throw new AssemblyException(ite.getCause()); + throw new AssemblyException(ite.getCause()); } catch (IllegalAccessException iae) { - throw new AssemblyException(iae); + throw new AssemblyException(iae); } catch (InstantiationException ie) { - throw new AssemblyException(ie); + throw new AssemblyException(ie); } } - + } diff --git a/gnu/java/beans/decoder/Context.java b/gnu/java/beans/decoder/Context.java index a2db09732..4bdbc9ce5 100644 --- a/gnu/java/beans/decoder/Context.java +++ b/gnu/java/beans/decoder/Context.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/beans/decoder/DecoderContext.java b/gnu/java/beans/decoder/DecoderContext.java index 69d84e576..174a3b71b 100644 --- a/gnu/java/beans/decoder/DecoderContext.java +++ b/gnu/java/beans/decoder/DecoderContext.java @@ -7,7 +7,7 @@ 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 @@ -113,12 +113,12 @@ public class DecoderContext extends AbstractContext } /** Returns an Iterator that retrieves the assembled objects. - * + * * @return An Iterator retrieving assembled objects. */ public Iterator iterator() { return objects.iterator(); } - + } diff --git a/gnu/java/beans/decoder/DoubleHandler.java b/gnu/java/beans/decoder/DoubleHandler.java index 8f6be7ec0..1a14fbabf 100644 --- a/gnu/java/beans/decoder/DoubleHandler.java +++ b/gnu/java/beans/decoder/DoubleHandler.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/beans/decoder/DummyContext.java b/gnu/java/beans/decoder/DummyContext.java index f3b24549d..03f209c8c 100644 --- a/gnu/java/beans/decoder/DummyContext.java +++ b/gnu/java/beans/decoder/DummyContext.java @@ -7,7 +7,7 @@ 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 @@ -60,7 +60,7 @@ public class DummyContext extends AbstractContext */ public void notifyStatement(Context outerContext) throws AssemblyException { - // intentionally ignored + // intentionally ignored } /* (non-Javadoc) @@ -69,7 +69,7 @@ public class DummyContext extends AbstractContext public Object endContext(Context outerContext) throws AssemblyException { fail(); - return null; + return null; } /* (non-Javadoc) @@ -78,7 +78,7 @@ public class DummyContext extends AbstractContext public boolean subContextFailed() { fail(); - return false; + return false; } /* (non-Javadoc) @@ -95,7 +95,7 @@ public class DummyContext extends AbstractContext public Object get(int index) throws AssemblyException { fail(); - return null; + return null; } /* (non-Javadoc) @@ -104,13 +104,13 @@ public class DummyContext extends AbstractContext public Object getResult() { fail(); - return null; + return null; } private void fail() { throw new InternalError("Invoking the DummyContext is not expected" - + " - Please file a bug report at" - + " http://www/gnu.org/software/classpath/."); + + " - Please file a bug report at" + + " http://www/gnu.org/software/classpath/."); } } diff --git a/gnu/java/beans/decoder/DummyHandler.java b/gnu/java/beans/decoder/DummyHandler.java index 880d76adc..f9c133e54 100644 --- a/gnu/java/beans/decoder/DummyHandler.java +++ b/gnu/java/beans/decoder/DummyHandler.java @@ -7,7 +7,7 @@ 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 @@ -89,7 +89,7 @@ class DummyHandler implements ElementHandler throws ClassNotFoundException { fail(); - return null; + return null; } /* (non-Javadoc) @@ -138,19 +138,19 @@ class DummyHandler implements ElementHandler public Object getObject(String objectId) { fail(); - return null; + return null; } public ElementHandler getParent() { fail(); - return null; + return null; } private void fail() { throw new InternalError("Invoking the DummyHandler is not expected" - + " - Please file a bug report at " - + " http://www.gnu.org/software/classpath/."); + + " - Please file a bug report at " + + " http://www.gnu.org/software/classpath/."); } } diff --git a/gnu/java/beans/decoder/ElementHandler.java b/gnu/java/beans/decoder/ElementHandler.java index e6ae60af8..12e945bbf 100644 --- a/gnu/java/beans/decoder/ElementHandler.java +++ b/gnu/java/beans/decoder/ElementHandler.java @@ -7,7 +7,7 @@ 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 @@ -72,19 +72,19 @@ interface ElementHandler /** Returns whether a subelement of the given name is allowed. The rules * for evaluating this are derived from the javabeans.dtd which can be found * here: <a href="http://java.sun.com/products/jfc/tsc/articles/persistence3">Java Persistence Article</a>. - * - * @param subElementName + * + * @param subElementName * @return */ boolean isSubelementAllowed(String subElementName); /** Provides the same functionality as Class.forName() but allows the decoder * to use a different class loader. - * + * * @param className * @return * @throws ClassNotFoundException - */ + */ Class instantiateClass(String className) throws ClassNotFoundException; /** Notifies the handler's Context that its child Context will not return @@ -104,21 +104,21 @@ interface ElementHandler boolean hasFailed(); /** Returns the Context instance this handler is working on. - * + * * @return The handler's Context instance. */ Context getContext(); /** Notifies the handler that its Context failed and starts a recursive * invocation of the parent handler if it is affected by that failure. - * + * * Although the method is a public API member it is only used internally. */ void notifyContextFailed(); /** Stores the object under the given id. The object is not stored if the * id is null. - * + * * @param objectId * @param o */ diff --git a/gnu/java/beans/decoder/FloatHandler.java b/gnu/java/beans/decoder/FloatHandler.java index 5f0e15cef..443f38f91 100644 --- a/gnu/java/beans/decoder/FloatHandler.java +++ b/gnu/java/beans/decoder/FloatHandler.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/beans/decoder/GrowableArrayContext.java b/gnu/java/beans/decoder/GrowableArrayContext.java index f24a60b4a..fb386d1d5 100644 --- a/gnu/java/beans/decoder/GrowableArrayContext.java +++ b/gnu/java/beans/decoder/GrowableArrayContext.java @@ -7,7 +7,7 @@ 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 @@ -46,11 +46,11 @@ import java.lang.reflect.Array; class GrowableArrayContext extends AbstractContext { private static final int INITIAL_SIZE = 16; - + private Class klass; private Object array; private int length; - + GrowableArrayContext(String id, Class newClass) { setId(id); @@ -69,7 +69,7 @@ class GrowableArrayContext extends AbstractContext System.arraycopy(array, 0, tmp, 0, length); array = tmp; } - + try { Array.set(array, length++, o); } catch(IllegalArgumentException iae) { @@ -97,7 +97,7 @@ class GrowableArrayContext extends AbstractContext System.arraycopy(array, 0, tmp, 0, length); array = tmp; } - + return array; } @@ -119,7 +119,7 @@ class GrowableArrayContext extends AbstractContext try { Array.set(array, index, o); } catch(IllegalArgumentException iae) { - throw new AssemblyException(iae); + throw new AssemblyException(iae); } } diff --git a/gnu/java/beans/decoder/IndexContext.java b/gnu/java/beans/decoder/IndexContext.java index 11f840cae..b5af9019f 100644 --- a/gnu/java/beans/decoder/IndexContext.java +++ b/gnu/java/beans/decoder/IndexContext.java @@ -7,7 +7,7 @@ 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 @@ -65,8 +65,8 @@ class IndexContext extends AbstractContext { if (! isSetter) { - argument = o; - isSetter = true; + argument = o; + isSetter = true; } else throw new AssemblyException(new IllegalStateException("More than one argument for indiced access is not possible.")); @@ -87,10 +87,10 @@ class IndexContext extends AbstractContext { if (isSetter) { - // setter - outerContext.set(index, argument); + // setter + outerContext.set(index, argument); - return null; + return null; } else // getter diff --git a/gnu/java/beans/decoder/IntHandler.java b/gnu/java/beans/decoder/IntHandler.java index a96f4a031..bbd3560d7 100644 --- a/gnu/java/beans/decoder/IntHandler.java +++ b/gnu/java/beans/decoder/IntHandler.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/beans/decoder/JavaHandler.java b/gnu/java/beans/decoder/JavaHandler.java index 3bc8c6028..c4b4f92c5 100644 --- a/gnu/java/beans/decoder/JavaHandler.java +++ b/gnu/java/beans/decoder/JavaHandler.java @@ -7,7 +7,7 @@ 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 @@ -69,7 +69,7 @@ public class JavaHandler extends AbstractElementHandler protected Context startElement(Attributes attributes, ExceptionListener exceptionListener) throws AssemblyException { - // may expect version and class attribute but it not used in JDK + // may expect version and class attribute but it not used in JDK // so we do either return context; } diff --git a/gnu/java/beans/decoder/LongHandler.java b/gnu/java/beans/decoder/LongHandler.java index d7bfa54e5..13e0a8dde 100644 --- a/gnu/java/beans/decoder/LongHandler.java +++ b/gnu/java/beans/decoder/LongHandler.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/beans/decoder/MethodContext.java b/gnu/java/beans/decoder/MethodContext.java index bad0a213f..84eead7a0 100644 --- a/gnu/java/beans/decoder/MethodContext.java +++ b/gnu/java/beans/decoder/MethodContext.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/beans/decoder/MethodFinder.java b/gnu/java/beans/decoder/MethodFinder.java index 3968b173a..82783fbde 100644 --- a/gnu/java/beans/decoder/MethodFinder.java +++ b/gnu/java/beans/decoder/MethodFinder.java @@ -7,7 +7,7 @@ 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 @@ -43,135 +43,135 @@ import java.util.HashMap; class MethodFinder { - /** Provides a mapping between a wrapper class and its corresponding primitive's type. */ - private static HashMap typeMapping = new HashMap(); - - static { - typeMapping.put(Byte.class, Byte.TYPE); - typeMapping.put(Short.class, Short.TYPE); - typeMapping.put(Integer.class, Integer.TYPE); - typeMapping.put(Long.class, Long.TYPE); - typeMapping.put(Float.class, Float.TYPE); - typeMapping.put(Double.class, Double.TYPE); - - typeMapping.put(Character.class, Character.TYPE); - typeMapping.put(Boolean.class, Boolean.TYPE); - } - - private MethodFinder() - { - } - - /** Searches a Method which can accept the given arguments. - * - * @param klass - * @param name - * @param arguments - * @return - * @throws NoSuchMethodException - */ - static Method getMethod(Class klass, String name, Object[] arguments) - throws NoSuchMethodException - { - // prepares array containing the types of the arguments - Class[] argumentTypes = getArgumentTypes(arguments); - - Method[] methods = klass.getMethods(); - - // iterates over all public methods - for (int i = 0; i < methods.length; i++) - { - if (methods[i].getName().equals(name)) - { - if (matchingArgumentTypes(methods[i].getParameterTypes(), - argumentTypes)) - return methods[i]; - } - } - - throw new NoSuchMethodException( - "Could not find a matching method named " - + name - + "() in class " - + klass); - } - - static Constructor getConstructor(Class klass, Object[] arguments) - throws NoSuchMethodException - { - Class[] argumentTypes = getArgumentTypes(arguments); - Constructor[] constructors = klass.getConstructors(); - - // iterates over all public methods - for (int i = 0; i < constructors.length; i++) - { - if (matchingArgumentTypes(constructors[i].getParameterTypes(), - argumentTypes)) - return constructors[i]; - } - - throw new NoSuchMethodException( - "Could not find a matching constructor in class " + klass); - } - - /** Transforms an array of argument objects into an array of argument types. - * For each argument being null the argument is null, too. An argument type - * being null means: Accepts everything (although this can be ambigous). - * - * @param arguments - * @return - */ - private static Class[] getArgumentTypes(Object[] arguments) - { - if (arguments == null) - return new Class[0]; - - // prepares array containing the types of the arguments - Class[] argumentTypes = new Class[arguments.length]; - for (int i = 0; i < arguments.length; i++) - argumentTypes[i] = - (arguments[i] == null) ? null : arguments[i].getClass(); - return argumentTypes; - } - - /** Tests whether the argument types supplied to the method argument types - * are assignable. In addition to the assignment specifications this method - * handles the primitive's wrapper classes as if they were of their - * primitive type (e.g Boolean.class equals Boolean.TYPE). - * When a supplied argument type is null it is assumed that no argument - * object was supplied for it and the test for this particular parameter will - * pass. - * - * @param methodArgTypes - * @param suppliedArgTypes - * @return - */ - private static boolean matchingArgumentTypes( - Class[] methodArgTypes, - Class[] suppliedArgTypes) - { - if (methodArgTypes.length != suppliedArgTypes.length) - return false; - - for (int i = 0; i < methodArgTypes.length; i++) - { - if (suppliedArgTypes[i] == null) - { - // by definition a non-existant argument type (null) can be converted to everything - continue; - } - else if (typeMapping.containsKey(suppliedArgTypes[i])) - { - Class primitiveType = - (Class) typeMapping.get(suppliedArgTypes[i]); - if (!(methodArgTypes[i].isAssignableFrom(suppliedArgTypes[i]) - || methodArgTypes[i].isAssignableFrom(primitiveType))) - return false; - } - else if (!methodArgTypes[i].isAssignableFrom(suppliedArgTypes[i])) - return false; - } - - return true; - } + /** Provides a mapping between a wrapper class and its corresponding primitive's type. */ + private static HashMap typeMapping = new HashMap(); + + static { + typeMapping.put(Byte.class, Byte.TYPE); + typeMapping.put(Short.class, Short.TYPE); + typeMapping.put(Integer.class, Integer.TYPE); + typeMapping.put(Long.class, Long.TYPE); + typeMapping.put(Float.class, Float.TYPE); + typeMapping.put(Double.class, Double.TYPE); + + typeMapping.put(Character.class, Character.TYPE); + typeMapping.put(Boolean.class, Boolean.TYPE); + } + + private MethodFinder() + { + } + + /** Searches a Method which can accept the given arguments. + * + * @param klass + * @param name + * @param arguments + * @return + * @throws NoSuchMethodException + */ + static Method getMethod(Class klass, String name, Object[] arguments) + throws NoSuchMethodException + { + // prepares array containing the types of the arguments + Class[] argumentTypes = getArgumentTypes(arguments); + + Method[] methods = klass.getMethods(); + + // iterates over all public methods + for (int i = 0; i < methods.length; i++) + { + if (methods[i].getName().equals(name)) + { + if (matchingArgumentTypes(methods[i].getParameterTypes(), + argumentTypes)) + return methods[i]; + } + } + + throw new NoSuchMethodException( + "Could not find a matching method named " + + name + + "() in class " + + klass); + } + + static Constructor getConstructor(Class klass, Object[] arguments) + throws NoSuchMethodException + { + Class[] argumentTypes = getArgumentTypes(arguments); + Constructor[] constructors = klass.getConstructors(); + + // iterates over all public methods + for (int i = 0; i < constructors.length; i++) + { + if (matchingArgumentTypes(constructors[i].getParameterTypes(), + argumentTypes)) + return constructors[i]; + } + + throw new NoSuchMethodException( + "Could not find a matching constructor in class " + klass); + } + + /** Transforms an array of argument objects into an array of argument types. + * For each argument being null the argument is null, too. An argument type + * being null means: Accepts everything (although this can be ambigous). + * + * @param arguments + * @return + */ + private static Class[] getArgumentTypes(Object[] arguments) + { + if (arguments == null) + return new Class[0]; + + // prepares array containing the types of the arguments + Class[] argumentTypes = new Class[arguments.length]; + for (int i = 0; i < arguments.length; i++) + argumentTypes[i] = + (arguments[i] == null) ? null : arguments[i].getClass(); + return argumentTypes; + } + + /** Tests whether the argument types supplied to the method argument types + * are assignable. In addition to the assignment specifications this method + * handles the primitive's wrapper classes as if they were of their + * primitive type (e.g Boolean.class equals Boolean.TYPE). + * When a supplied argument type is null it is assumed that no argument + * object was supplied for it and the test for this particular parameter will + * pass. + * + * @param methodArgTypes + * @param suppliedArgTypes + * @return + */ + private static boolean matchingArgumentTypes( + Class[] methodArgTypes, + Class[] suppliedArgTypes) + { + if (methodArgTypes.length != suppliedArgTypes.length) + return false; + + for (int i = 0; i < methodArgTypes.length; i++) + { + if (suppliedArgTypes[i] == null) + { + // by definition a non-existant argument type (null) can be converted to everything + continue; + } + else if (typeMapping.containsKey(suppliedArgTypes[i])) + { + Class primitiveType = + (Class) typeMapping.get(suppliedArgTypes[i]); + if (!(methodArgTypes[i].isAssignableFrom(suppliedArgTypes[i]) + || methodArgTypes[i].isAssignableFrom(primitiveType))) + return false; + } + else if (!methodArgTypes[i].isAssignableFrom(suppliedArgTypes[i])) + return false; + } + + return true; + } } diff --git a/gnu/java/beans/decoder/NullHandler.java b/gnu/java/beans/decoder/NullHandler.java index 549617db3..01c9727d4 100644 --- a/gnu/java/beans/decoder/NullHandler.java +++ b/gnu/java/beans/decoder/NullHandler.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/beans/decoder/ObjectContext.java b/gnu/java/beans/decoder/ObjectContext.java index cf88a2c2c..883c1d600 100644 --- a/gnu/java/beans/decoder/ObjectContext.java +++ b/gnu/java/beans/decoder/ObjectContext.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/beans/decoder/ObjectHandler.java b/gnu/java/beans/decoder/ObjectHandler.java index dc5b3290b..ececfbbe2 100644 --- a/gnu/java/beans/decoder/ObjectHandler.java +++ b/gnu/java/beans/decoder/ObjectHandler.java @@ -7,7 +7,7 @@ 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 @@ -90,78 +90,78 @@ public class ObjectHandler extends AbstractElementHandler // decides whether we are in a static (className present) or dynamic context if (className != null) { - try - { - Class klass = instantiateClass(className); - - // class name exists which means that we are in a static context. - // so we may want to ... - // access a static field if the fieldName exists - if (fieldName != null) - { - try - { - return new ObjectContext(id, - klass.getField(fieldName).get(null)); - } - catch (NoSuchFieldException nsfe) - { - throw new AssemblyException(nsfe); - } - catch (IllegalAccessException iae) - { - throw new AssemblyException(iae); - } - } - - // (falling through is important!) - // run a constructor if methodName is "new" or null - if (methodName == null || methodName.equals("new")) - return new ConstructorContext(id, klass); - - // (falling through is important!) - // run a static method on the given class (if methodName exists, which is implied already) - return new StaticMethodContext(id, klass, methodName); - // XXX: should fail if unexpected attributes are present? - } - catch (ClassNotFoundException cnfe) - { - throw new AssemblyException(cnfe); - } + try + { + Class klass = instantiateClass(className); + + // class name exists which means that we are in a static context. + // so we may want to ... + // access a static field if the fieldName exists + if (fieldName != null) + { + try + { + return new ObjectContext(id, + klass.getField(fieldName).get(null)); + } + catch (NoSuchFieldException nsfe) + { + throw new AssemblyException(nsfe); + } + catch (IllegalAccessException iae) + { + throw new AssemblyException(iae); + } + } + + // (falling through is important!) + // run a constructor if methodName is "new" or null + if (methodName == null || methodName.equals("new")) + return new ConstructorContext(id, klass); + + // (falling through is important!) + // run a static method on the given class (if methodName exists, which is implied already) + return new StaticMethodContext(id, klass, methodName); + // XXX: should fail if unexpected attributes are present? + } + catch (ClassNotFoundException cnfe) + { + throw new AssemblyException(cnfe); + } } else { - // className does not exist which means we are in the context of - // some object and want to ... - // access the get(int index) method if index != null - if (index != null) - { - try - { - // Note: http://java.sun.com/products/jfc/tsc/articles/persistence3/ says - // that <void index="4"/> will make up a get()-call. But this is wrong because - // <void/> tags never return values (to the surrounding context) - return new IndexContext(id, Integer.parseInt(index)); - } - catch (NumberFormatException nfe) - { - throw new AssemblyException(nfe); - } - } - - // access a method if methodName exists - if (methodName != null) - return new MethodContext(id, methodName); - - // (falling through is important!) - // access a property if a propertyName exists - if (propertyName != null && propertyName.length() > 0) - // this is reported as an ordinary method access where the propertyName is - // converted into a 'getter'-method name: convert first character of property name - // to upper case and prepend 'get' - // Note: This will be a getter-method because the <object> tag implies that a return - // value is expected. - return new PropertyContext(id, propertyName); + // className does not exist which means we are in the context of + // some object and want to ... + // access the get(int index) method if index != null + if (index != null) + { + try + { + // Note: http://java.sun.com/products/jfc/tsc/articles/persistence3/ says + // that <void index="4"/> will make up a get()-call. But this is wrong because + // <void/> tags never return values (to the surrounding context) + return new IndexContext(id, Integer.parseInt(index)); + } + catch (NumberFormatException nfe) + { + throw new AssemblyException(nfe); + } + } + + // access a method if methodName exists + if (methodName != null) + return new MethodContext(id, methodName); + + // (falling through is important!) + // access a property if a propertyName exists + if (propertyName != null && propertyName.length() > 0) + // this is reported as an ordinary method access where the propertyName is + // converted into a 'getter'-method name: convert first character of property name + // to upper case and prepend 'get' + // Note: This will be a getter-method because the <object> tag implies that a return + // value is expected. + return new PropertyContext(id, propertyName); } throw new AssemblyException(new IllegalArgumentException("Wrong or missing attributes for <object> tag.")); diff --git a/gnu/java/beans/decoder/PersistenceParser.java b/gnu/java/beans/decoder/PersistenceParser.java index 4eb37abef..c4c8866c3 100644 --- a/gnu/java/beans/decoder/PersistenceParser.java +++ b/gnu/java/beans/decoder/PersistenceParser.java @@ -62,424 +62,424 @@ import org.xml.sax.helpers.DefaultHandler; */ public class PersistenceParser extends DefaultHandler implements Context { - /** The ExceptionListener instance which is informed of non-critical parsing exceptions. - */ - private ExceptionListener exceptionListener; - - /** When an element was not usable all elements inside it should be skipped. - * This is done by skipping startElement() and endElement() invocations whenever - * this value is above 0. - */ - private int skipElement; - - /** Stores the Creator instances which can instantiate the appropriate handler implementation - * for a given element. - */ - private HashMap handlerCreators = new HashMap(); - - /** Denotes the current ElementHandler. To avoid checking for null-values it is pre-assigned - * with a DummyHandler instance which must not be used but acts as a root element. - */ - private ElementHandler currentHandler; - - /** The real root element that stores all objects created during parsing. - * Package-private to avoid an accessor method. - */ - JavaHandler javaHandler; - - /** Stores the decoded objects. */ - private List objects = new LinkedList(); - - /** The XMLDecoder instance that started this PersistenceParser */ - private XMLDecoder decoder; - - /** Creates a PersistenceParser which reads XML data from the given InputStream, reports - * exceptions to ExceptionListener instance, stores resulting object in the DecoderContext - * and uses the given ClassLoader to resolve classes. - * - * @param inputStream - * @param exceptionListener - * @param decoderContext - * @param cl - */ - public PersistenceParser( - InputStream inputStream, - ExceptionListener exceptionListener, - ClassLoader cl, - XMLDecoder decoder) - { - - this.exceptionListener = exceptionListener; - this.decoder = decoder; - - DummyHandler dummyHandler = new DummyHandler(); - currentHandler = dummyHandler; - javaHandler = new JavaHandler(dummyHandler, this, cl); - - SAXParserFactory factory = SAXParserFactory.newInstance(); - - SAXParser parser; - try - { - parser = factory.newSAXParser(); - } - catch (ParserConfigurationException pce) - { - // should not happen when a parser is available because we did - // not request any requirements on the XML parser - throw (InternalError) new InternalError( - "No SAX Parser available.").initCause( - pce); - } - catch (SAXException saxe) - { - // should not happen when a parser is available because we did - // not request any requirements on the XML parser - throw (InternalError) new InternalError( - "No SAX Parser available.").initCause( - saxe); - } - - // prepares a map of Creator instances which can instantiate a handler which is - // appropriate for the tag that is used as a key for the Creator - handlerCreators.put("java", new JavaHandlerCreator()); - - // calls methods (properties), constructors, access fields - handlerCreators.put("object", new ObjectHandlerCreator()); - handlerCreators.put("void", new VoidHandlerCreator()); - - handlerCreators.put("array", new ArrayHandlerCreator()); - - // these handler directly create an Object (or null) - handlerCreators.put("class", new ClassHandlerCreator()); - handlerCreators.put("null", new NullHandlerCreator()); - - handlerCreators.put("char", new CharHandlerCreator()); - handlerCreators.put("string", new StringHandlerCreator()); - handlerCreators.put("boolean", new BooleanHandlerCreator()); - handlerCreators.put("byte", new ByteHandlerCreator()); - handlerCreators.put("short", new ShortHandlerCreator()); - handlerCreators.put("int", new IntHandlerCreator()); - handlerCreators.put("long", new LongHandlerCreator()); - handlerCreators.put("float", new FloatHandlerCreator()); - handlerCreators.put("double", new DoubleHandlerCreator()); - - // parses the data and sends all exceptions to the ExceptionListener - try - { - parser.parse(inputStream, this); - } - catch (SAXException saxe) - { - exceptionListener.exceptionThrown( - new IllegalArgumentException("XML data not well-formed.")); - } - catch (IOException ioe) - { - exceptionListener.exceptionThrown(ioe); - } - } - - public void startElement( - String uri, - String localName, - String qName, - Attributes attributes) - throws SAXException - { - /* The element is skipped if - * a) the current handler has already failed or a previous error occured - * which makes all children obsolete - */ - if (currentHandler.hasFailed() || skipElement > 0) - { - exceptionListener.exceptionThrown( - new IllegalArgumentException( - "Element unusable due to previous error: " + qName)); - - skipElement++; - - return; - } - - /* b) Subelements are not allowed within the current ElementHandler. - */ - if (!currentHandler.isSubelementAllowed(qName)) - { - exceptionListener.exceptionThrown( - new IllegalArgumentException( - "Element is not allowed here: " + qName)); - - skipElement++; - - return; - } - - /* c) The tag name is not a key in the map of Creator instances. This means that - * either the XML data is of a newer version or simply contains a miss-spelled element. - */ - if (!handlerCreators.containsKey(qName)) - { - exceptionListener.exceptionThrown( - new IllegalArgumentException( - "Element unusable because tag is unknown: " + qName)); - - skipElement++; - - return; - } - - // creates a new handler for the new element - AbstractElementHandler handler = - ((Creator) handlerCreators.get(qName)).createHandler( - currentHandler); - - // makes it the current handler to receive character data - currentHandler = handler; - - // starts the handler - currentHandler.start(attributes, exceptionListener); - } - - public void endElement(String uri, String localName, String qName) - throws SAXException - { - // skips processing the current handler if we are parsing an element - // which was marked invalid (in startElement() ) - if (skipElement > 0) - { - skipElement--; - return; - } - - // invokes the handler's finishing method - currentHandler.end(exceptionListener); - - // removes the current handler and reactivates its parent - currentHandler = currentHandler.getParent(); - } - - /** Transfers character data to the current handler - */ - public void characters(char[] ch, int start, int length) - throws SAXException - { - // prevents sending character data of invalid elements - if (skipElement > 0) - return; - - currentHandler.characters(ch, start, length); - } - - /** Creator interface provided a mechanism to instantiate ElementHandler instances - * for the appropriate tag. - * - * @author Robert Schuster - */ - interface Creator - { - /** Creates an ElementHandler instance using the given ElementHandler as its parent. - * - * @param parent The parent ElementHandler of the result. - * @return A new ElementHandler instance. - */ - AbstractElementHandler createHandler(ElementHandler parent); - } - - class BooleanHandlerCreator implements Creator - { - public AbstractElementHandler createHandler(ElementHandler parent) - { - return new BooleanHandler(parent); - } - } - - class ByteHandlerCreator implements Creator - { - public AbstractElementHandler createHandler(ElementHandler parent) - { - return new ByteHandler(parent); - } - } - - class ShortHandlerCreator implements Creator - { - public AbstractElementHandler createHandler(ElementHandler parent) - { - return new ShortHandler(parent); - } - } - - class IntHandlerCreator implements Creator - { - public AbstractElementHandler createHandler(ElementHandler parent) - { - return new IntHandler(parent); - } - } - - class LongHandlerCreator implements Creator - { - public AbstractElementHandler createHandler(ElementHandler parent) - { - return new LongHandler(parent); - } - } - - class FloatHandlerCreator implements Creator - { - public AbstractElementHandler createHandler(ElementHandler parent) - { - return new FloatHandler(parent); - } - } - - class DoubleHandlerCreator implements Creator - { - public AbstractElementHandler createHandler(ElementHandler parent) - { - return new DoubleHandler(parent); - } - } - - class CharHandlerCreator implements Creator - { - public AbstractElementHandler createHandler(ElementHandler parent) - { - return new CharHandler(parent); - } - } - - class StringHandlerCreator implements Creator - { - public AbstractElementHandler createHandler(ElementHandler parent) - { - return new StringHandler(parent); - } - } - - class JavaHandlerCreator implements Creator - { - public AbstractElementHandler createHandler(ElementHandler parent) - { - return javaHandler; - } - } - - class ObjectHandlerCreator implements Creator - { - public AbstractElementHandler createHandler(ElementHandler parent) - { - return new ObjectHandler(parent); - } - } - - class VoidHandlerCreator implements Creator - { - public AbstractElementHandler createHandler(ElementHandler parent) - { - return new VoidHandler(parent); - } - } - - class ClassHandlerCreator implements Creator - { - public AbstractElementHandler createHandler(ElementHandler parent) - { - return new ClassHandler(parent); - } - } - - class NullHandlerCreator implements Creator - { - public AbstractElementHandler createHandler(ElementHandler parent) - { - return new NullHandler(parent); - } - } - - class ArrayHandlerCreator implements Creator - { - public AbstractElementHandler createHandler(ElementHandler parent) - { - return new ArrayHandler(parent); - } - } - - /** Adds a decoded object to the Context. */ - public void addParameterObject(Object o) throws AssemblyException - { - objects.add(o); - } - - public void notifyStatement(Context outerContext) throws AssemblyException - { - // can be ignored because theis Context does not react to statement and expressions - // differently - } - - public Object endContext(Context outerContext) throws AssemblyException - { - return null; - } - - public boolean subContextFailed() - { - // failing of subcontexts is no problem for the mother of all contexts - return false; - } - - public void set(int index, Object o) throws AssemblyException - { - // not supported - throw new AssemblyException( - new IllegalArgumentException("Set method is not allowed in decoder context.")); - } - - public Object get(int index) throws AssemblyException - { - // not supported - throw new AssemblyException( - new IllegalArgumentException("Get method is not allowed in decoder context.")); - } - - public Object getResult() - { - // returns the XMLDecoder instance which is requested by child contexts this way. - // That is needed to invoke methods on the decoder. - return decoder; - } - - public void setId(String id) - { - exceptionListener.exceptionThrown(new IllegalArgumentException("id attribute is not allowed for <java> tag.")); - } - - public String getId() - { - // appears to have no id - return null; - } - - public boolean isStatement() - { - // this context is a statement by definition because it never returns anything to a parent because - // there is no such parent (DummyContext does not count!) - return true; - } - - public void setStatement(boolean b) - { - // ignores that because this Context is always a statement - } - - /** Returns an Iterator instance which returns the decoded objects. - * - * This method is used by the XMLDecoder directly. - */ - public Iterator iterator() - { - return objects.iterator(); - } + /** The ExceptionListener instance which is informed of non-critical parsing exceptions. + */ + private ExceptionListener exceptionListener; + + /** When an element was not usable all elements inside it should be skipped. + * This is done by skipping startElement() and endElement() invocations whenever + * this value is above 0. + */ + private int skipElement; + + /** Stores the Creator instances which can instantiate the appropriate handler implementation + * for a given element. + */ + private HashMap handlerCreators = new HashMap(); + + /** Denotes the current ElementHandler. To avoid checking for null-values it is pre-assigned + * with a DummyHandler instance which must not be used but acts as a root element. + */ + private ElementHandler currentHandler; + + /** The real root element that stores all objects created during parsing. + * Package-private to avoid an accessor method. + */ + JavaHandler javaHandler; + + /** Stores the decoded objects. */ + private List objects = new LinkedList(); + + /** The XMLDecoder instance that started this PersistenceParser */ + private XMLDecoder decoder; + + /** Creates a PersistenceParser which reads XML data from the given InputStream, reports + * exceptions to ExceptionListener instance, stores resulting object in the DecoderContext + * and uses the given ClassLoader to resolve classes. + * + * @param inputStream + * @param exceptionListener + * @param decoderContext + * @param cl + */ + public PersistenceParser( + InputStream inputStream, + ExceptionListener exceptionListener, + ClassLoader cl, + XMLDecoder decoder) + { + + this.exceptionListener = exceptionListener; + this.decoder = decoder; + + DummyHandler dummyHandler = new DummyHandler(); + currentHandler = dummyHandler; + javaHandler = new JavaHandler(dummyHandler, this, cl); + + SAXParserFactory factory = SAXParserFactory.newInstance(); + + SAXParser parser; + try + { + parser = factory.newSAXParser(); + } + catch (ParserConfigurationException pce) + { + // should not happen when a parser is available because we did + // not request any requirements on the XML parser + throw (InternalError) new InternalError( + "No SAX Parser available.").initCause( + pce); + } + catch (SAXException saxe) + { + // should not happen when a parser is available because we did + // not request any requirements on the XML parser + throw (InternalError) new InternalError( + "No SAX Parser available.").initCause( + saxe); + } + + // prepares a map of Creator instances which can instantiate a handler which is + // appropriate for the tag that is used as a key for the Creator + handlerCreators.put("java", new JavaHandlerCreator()); + + // calls methods (properties), constructors, access fields + handlerCreators.put("object", new ObjectHandlerCreator()); + handlerCreators.put("void", new VoidHandlerCreator()); + + handlerCreators.put("array", new ArrayHandlerCreator()); + + // these handler directly create an Object (or null) + handlerCreators.put("class", new ClassHandlerCreator()); + handlerCreators.put("null", new NullHandlerCreator()); + + handlerCreators.put("char", new CharHandlerCreator()); + handlerCreators.put("string", new StringHandlerCreator()); + handlerCreators.put("boolean", new BooleanHandlerCreator()); + handlerCreators.put("byte", new ByteHandlerCreator()); + handlerCreators.put("short", new ShortHandlerCreator()); + handlerCreators.put("int", new IntHandlerCreator()); + handlerCreators.put("long", new LongHandlerCreator()); + handlerCreators.put("float", new FloatHandlerCreator()); + handlerCreators.put("double", new DoubleHandlerCreator()); + + // parses the data and sends all exceptions to the ExceptionListener + try + { + parser.parse(inputStream, this); + } + catch (SAXException saxe) + { + exceptionListener.exceptionThrown( + new IllegalArgumentException("XML data not well-formed.")); + } + catch (IOException ioe) + { + exceptionListener.exceptionThrown(ioe); + } + } + + public void startElement( + String uri, + String localName, + String qName, + Attributes attributes) + throws SAXException + { + /* The element is skipped if + * a) the current handler has already failed or a previous error occured + * which makes all children obsolete + */ + if (currentHandler.hasFailed() || skipElement > 0) + { + exceptionListener.exceptionThrown( + new IllegalArgumentException( + "Element unusable due to previous error: " + qName)); + + skipElement++; + + return; + } + + /* b) Subelements are not allowed within the current ElementHandler. + */ + if (!currentHandler.isSubelementAllowed(qName)) + { + exceptionListener.exceptionThrown( + new IllegalArgumentException( + "Element is not allowed here: " + qName)); + + skipElement++; + + return; + } + + /* c) The tag name is not a key in the map of Creator instances. This means that + * either the XML data is of a newer version or simply contains a miss-spelled element. + */ + if (!handlerCreators.containsKey(qName)) + { + exceptionListener.exceptionThrown( + new IllegalArgumentException( + "Element unusable because tag is unknown: " + qName)); + + skipElement++; + + return; + } + + // creates a new handler for the new element + AbstractElementHandler handler = + ((Creator) handlerCreators.get(qName)).createHandler( + currentHandler); + + // makes it the current handler to receive character data + currentHandler = handler; + + // starts the handler + currentHandler.start(attributes, exceptionListener); + } + + public void endElement(String uri, String localName, String qName) + throws SAXException + { + // skips processing the current handler if we are parsing an element + // which was marked invalid (in startElement() ) + if (skipElement > 0) + { + skipElement--; + return; + } + + // invokes the handler's finishing method + currentHandler.end(exceptionListener); + + // removes the current handler and reactivates its parent + currentHandler = currentHandler.getParent(); + } + + /** Transfers character data to the current handler + */ + public void characters(char[] ch, int start, int length) + throws SAXException + { + // prevents sending character data of invalid elements + if (skipElement > 0) + return; + + currentHandler.characters(ch, start, length); + } + + /** Creator interface provided a mechanism to instantiate ElementHandler instances + * for the appropriate tag. + * + * @author Robert Schuster + */ + interface Creator + { + /** Creates an ElementHandler instance using the given ElementHandler as its parent. + * + * @param parent The parent ElementHandler of the result. + * @return A new ElementHandler instance. + */ + AbstractElementHandler createHandler(ElementHandler parent); + } + + class BooleanHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new BooleanHandler(parent); + } + } + + class ByteHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new ByteHandler(parent); + } + } + + class ShortHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new ShortHandler(parent); + } + } + + class IntHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new IntHandler(parent); + } + } + + class LongHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new LongHandler(parent); + } + } + + class FloatHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new FloatHandler(parent); + } + } + + class DoubleHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new DoubleHandler(parent); + } + } + + class CharHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new CharHandler(parent); + } + } + + class StringHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new StringHandler(parent); + } + } + + class JavaHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return javaHandler; + } + } + + class ObjectHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new ObjectHandler(parent); + } + } + + class VoidHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new VoidHandler(parent); + } + } + + class ClassHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new ClassHandler(parent); + } + } + + class NullHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new NullHandler(parent); + } + } + + class ArrayHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new ArrayHandler(parent); + } + } + + /** Adds a decoded object to the Context. */ + public void addParameterObject(Object o) throws AssemblyException + { + objects.add(o); + } + + public void notifyStatement(Context outerContext) throws AssemblyException + { + // can be ignored because theis Context does not react to statement and expressions + // differently + } + + public Object endContext(Context outerContext) throws AssemblyException + { + return null; + } + + public boolean subContextFailed() + { + // failing of subcontexts is no problem for the mother of all contexts + return false; + } + + public void set(int index, Object o) throws AssemblyException + { + // not supported + throw new AssemblyException( + new IllegalArgumentException("Set method is not allowed in decoder context.")); + } + + public Object get(int index) throws AssemblyException + { + // not supported + throw new AssemblyException( + new IllegalArgumentException("Get method is not allowed in decoder context.")); + } + + public Object getResult() + { + // returns the XMLDecoder instance which is requested by child contexts this way. + // That is needed to invoke methods on the decoder. + return decoder; + } + + public void setId(String id) + { + exceptionListener.exceptionThrown(new IllegalArgumentException("id attribute is not allowed for <java> tag.")); + } + + public String getId() + { + // appears to have no id + return null; + } + + public boolean isStatement() + { + // this context is a statement by definition because it never returns anything to a parent because + // there is no such parent (DummyContext does not count!) + return true; + } + + public void setStatement(boolean b) + { + // ignores that because this Context is always a statement + } + + /** Returns an Iterator instance which returns the decoded objects. + * + * This method is used by the XMLDecoder directly. + */ + public Iterator iterator() + { + return objects.iterator(); + } } diff --git a/gnu/java/beans/decoder/PropertyContext.java b/gnu/java/beans/decoder/PropertyContext.java index 838ef814b..15751cdbc 100644 --- a/gnu/java/beans/decoder/PropertyContext.java +++ b/gnu/java/beans/decoder/PropertyContext.java @@ -7,7 +7,7 @@ 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 @@ -74,7 +74,7 @@ class PropertyContext extends AbstractObjectContext throw new AssemblyException(new IllegalArgumentException("Property attribut allows zero or one argument only.")); argument = o; - setStatement(true); + setStatement(true); prefix = "set"; } @@ -91,8 +91,8 @@ class PropertyContext extends AbstractObjectContext if (outerObject == null) throw new AssemblyException(new NullPointerException("No object to access property " - + propertyName)); - + + propertyName)); + // converts property name into a method name String methodName = prefix + propertyName.substring(0, 1).toUpperCase() @@ -103,23 +103,23 @@ class PropertyContext extends AbstractObjectContext try { - Method method = MethodFinder.getMethod(outerObject.getClass(), - methodName, args); + Method method = MethodFinder.getMethod(outerObject.getClass(), + methodName, args); - // stores the result whether it is available or not - setObject(method.invoke(outerObject, args)); + // stores the result whether it is available or not + setObject(method.invoke(outerObject, args)); } catch (NoSuchMethodException nsme) { - throw new AssemblyException(nsme); + throw new AssemblyException(nsme); } catch (InvocationTargetException ite) { - throw new AssemblyException(ite.getCause()); + throw new AssemblyException(ite.getCause()); } catch (IllegalAccessException iae) { - throw new AssemblyException(iae); + throw new AssemblyException(iae); } } diff --git a/gnu/java/beans/decoder/ShortHandler.java b/gnu/java/beans/decoder/ShortHandler.java index ab6ddbece..c5de50ab9 100644 --- a/gnu/java/beans/decoder/ShortHandler.java +++ b/gnu/java/beans/decoder/ShortHandler.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/beans/decoder/SimpleHandler.java b/gnu/java/beans/decoder/SimpleHandler.java index bc187e8a0..1c43bb0c7 100644 --- a/gnu/java/beans/decoder/SimpleHandler.java +++ b/gnu/java/beans/decoder/SimpleHandler.java @@ -7,7 +7,7 @@ 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 @@ -65,7 +65,7 @@ abstract class SimpleHandler extends AbstractElementHandler protected final Context startElement(Attributes attributes, ExceptionListener exceptionListener) throws AssemblyException { - + // note: simple elements should not have any attributes. We inform // the user of this syntactical but uncritical problem by sending // an IllegalArgumentException for each unneccessary attribute @@ -79,7 +79,7 @@ abstract class SimpleHandler extends AbstractElementHandler + "' discarded."); exceptionListener.exceptionThrown(e); } - + return context = new ObjectContext(); } @@ -89,11 +89,11 @@ abstract class SimpleHandler extends AbstractElementHandler // reports the number when the character data can be parsed try { - context.setObject(parse(characters)); + context.setObject(parse(characters)); } catch (NumberFormatException nfe) { - throw new AssemblyException(nfe); + throw new AssemblyException(nfe); } } diff --git a/gnu/java/beans/decoder/StaticMethodContext.java b/gnu/java/beans/decoder/StaticMethodContext.java index 959c949f7..b2cf0e602 100644 --- a/gnu/java/beans/decoder/StaticMethodContext.java +++ b/gnu/java/beans/decoder/StaticMethodContext.java @@ -7,7 +7,7 @@ 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 @@ -75,21 +75,21 @@ class StaticMethodContext extends AbstractCreatableObjectContext try { - Method method = MethodFinder.getMethod(klass, methodName, args); - return method.invoke(null, args); + Method method = MethodFinder.getMethod(klass, methodName, args); + return method.invoke(null, args); } catch (NoSuchMethodException nsme) { - throw new AssemblyException(nsme); + throw new AssemblyException(nsme); } catch (InvocationTargetException ite) { - // rethrows the reason for the InvocationTargetsException (ie. the exception in the called code) - throw new AssemblyException(ite.getCause()); + // rethrows the reason for the InvocationTargetsException (ie. the exception in the called code) + throw new AssemblyException(ite.getCause()); } catch (IllegalAccessException iae) { - throw new AssemblyException(iae); + throw new AssemblyException(iae); } } } diff --git a/gnu/java/beans/decoder/StringHandler.java b/gnu/java/beans/decoder/StringHandler.java index 6f2311a9e..97fc57efd 100644 --- a/gnu/java/beans/decoder/StringHandler.java +++ b/gnu/java/beans/decoder/StringHandler.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/beans/decoder/VoidHandler.java b/gnu/java/beans/decoder/VoidHandler.java index ca3664bbe..56f315639 100644 --- a/gnu/java/beans/decoder/VoidHandler.java +++ b/gnu/java/beans/decoder/VoidHandler.java @@ -7,7 +7,7 @@ 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 @@ -86,7 +86,7 @@ public class VoidHandler extends AbstractElementHandler return new ConstructorContext(id, klass); // (falling through is important!) - // run a static method on the given class (if methodName exists, which is implied already) + // run a static method on the given class (if methodName exists, which is implied already) return new StaticMethodContext(id, klass, methodName); } catch (ClassNotFoundException cnfe) diff --git a/gnu/java/beans/editors/ColorEditor.java b/gnu/java/beans/editors/ColorEditor.java index b099eb2f0..cb69344cb 100644 --- a/gnu/java/beans/editors/ColorEditor.java +++ b/gnu/java/beans/editors/ColorEditor.java @@ -7,7 +7,7 @@ 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 @@ -50,51 +50,51 @@ import java.beans.PropertyEditorSupport; **/ public class ColorEditor extends PropertyEditorSupport { - Color[] stdColors = {Color.black,Color.blue,Color.cyan, - Color.darkGray,Color.gray,Color.green, - Color.lightGray,Color.magenta,Color.orange, - Color.pink,Color.red,Color.white, - Color.yellow}; - String[] stdColorNames = {"black","blue","cyan", - "dark gray","gray","green", - "light gray","magenta","orange", - "pink","red","white", - "yellow"}; + Color[] stdColors = {Color.black,Color.blue,Color.cyan, + Color.darkGray,Color.gray,Color.green, + Color.lightGray,Color.magenta,Color.orange, + Color.pink,Color.red,Color.white, + Color.yellow}; + String[] stdColorNames = {"black","blue","cyan", + "dark gray","gray","green", + "light gray","magenta","orange", + "pink","red","white", + "yellow"}; - /** setAsText for Color checks for standard color names - ** and then checks for a #RRGGBB value or just RRGGBB, - ** both in hex. - **/ - public void setAsText(String val) throws IllegalArgumentException { - if(val.length() == 0) { - throw new IllegalArgumentException("Tried to set empty value!"); - } - for(int i=0;i<stdColorNames.length;i++) { - if(stdColorNames[i].equalsIgnoreCase(val)) { - setValue(stdColors[i]); - return; - } - } - if(val.charAt(0) == '#') { - setValue(new Color(Integer.parseInt(val.substring(1),16))); - } else { - setValue(new Color(Integer.parseInt(val,16))); - } - } + /** setAsText for Color checks for standard color names + ** and then checks for a #RRGGBB value or just RRGGBB, + ** both in hex. + **/ + public void setAsText(String val) throws IllegalArgumentException { + if(val.length() == 0) { + throw new IllegalArgumentException("Tried to set empty value!"); + } + for(int i=0;i<stdColorNames.length;i++) { + if(stdColorNames[i].equalsIgnoreCase(val)) { + setValue(stdColors[i]); + return; + } + } + if(val.charAt(0) == '#') { + setValue(new Color(Integer.parseInt(val.substring(1),16))); + } else { + setValue(new Color(Integer.parseInt(val,16))); + } + } - /** getAsText for Color turns the color into either one of the standard - ** colors or into an RGB hex value with # prepended. **/ - public String getAsText() { - for(int i=0;i<stdColors.length;i++) { - if(stdColors[i].equals(getValue())) { - return stdColorNames[i]; - } - } - return "#" + Integer.toHexString(((Color)getValue()).getRGB() & 0x00FFFFFF); - } + /** getAsText for Color turns the color into either one of the standard + ** colors or into an RGB hex value with # prepended. **/ + public String getAsText() { + for(int i=0;i<stdColors.length;i++) { + if(stdColors[i].equals(getValue())) { + return stdColorNames[i]; + } + } + return "#" + Integer.toHexString(((Color)getValue()).getRGB() & 0x00FFFFFF); + } - /** getTags for Color returns a list of standard colors. **/ - public String[] getTags() { - return stdColorNames; - } + /** getTags for Color returns a list of standard colors. **/ + public String[] getTags() { + return stdColorNames; + } } diff --git a/gnu/java/beans/editors/FontEditor.java b/gnu/java/beans/editors/FontEditor.java index 904f7bebf..dfccb4ede 100644 --- a/gnu/java/beans/editors/FontEditor.java +++ b/gnu/java/beans/editors/FontEditor.java @@ -7,7 +7,7 @@ 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 @@ -52,26 +52,26 @@ import java.beans.PropertyEditorSupport; **/ public class FontEditor extends PropertyEditorSupport { - /** setAsText for Font calls Font.decode(). **/ - public void setAsText(String val) throws IllegalArgumentException { - setValue(Font.decode(val)); - } + /** setAsText for Font calls Font.decode(). **/ + public void setAsText(String val) throws IllegalArgumentException { + setValue(Font.decode(val)); + } - /** getAsText for Font returns a value in the format - ** expected by Font.decode(). - **/ - public String getAsText() { - Font f = (Font)getValue(); - if(f.isBold()) { - if(f.isItalic()) { - return f.getName()+"-bolditalic-"+f.getSize(); - } else { - return f.getName()+"-bold-"+f.getSize(); - } - } else if(f.isItalic()) { - return f.getName()+"-italic-"+f.getSize(); - } else { - return f.getName()+"-"+f.getSize(); - } - } + /** getAsText for Font returns a value in the format + ** expected by Font.decode(). + **/ + public String getAsText() { + Font f = (Font)getValue(); + if(f.isBold()) { + if(f.isItalic()) { + return f.getName()+"-bolditalic-"+f.getSize(); + } else { + return f.getName()+"-bold-"+f.getSize(); + } + } else if(f.isItalic()) { + return f.getName()+"-italic-"+f.getSize(); + } else { + return f.getName()+"-"+f.getSize(); + } + } } diff --git a/gnu/java/beans/editors/NativeBooleanEditor.java b/gnu/java/beans/editors/NativeBooleanEditor.java index 3620cc174..1df94895a 100644 --- a/gnu/java/beans/editors/NativeBooleanEditor.java +++ b/gnu/java/beans/editors/NativeBooleanEditor.java @@ -7,7 +7,7 @@ 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 @@ -52,25 +52,25 @@ import java.beans.PropertyEditorSupport; **/ public class NativeBooleanEditor extends PropertyEditorSupport { - String[] tags = {"true","false"}; + String[] tags = {"true","false"}; - /** - * setAsText for boolean checks for true or false or t or f. - * "" also means false. - **/ - public void setAsText(String val) throws IllegalArgumentException { - if(val.equalsIgnoreCase("true") || val.equalsIgnoreCase("t")) { - setValue(Boolean.TRUE); - } else if(val.equalsIgnoreCase("false") || val.equalsIgnoreCase("f") || val.equals("")) { - setValue(Boolean.FALSE); - } else { - throw new IllegalArgumentException("Value must be true, false, t, f or empty."); - } - } + /** + * setAsText for boolean checks for true or false or t or f. + * "" also means false. + **/ + public void setAsText(String val) throws IllegalArgumentException { + if(val.equalsIgnoreCase("true") || val.equalsIgnoreCase("t")) { + setValue(Boolean.TRUE); + } else if(val.equalsIgnoreCase("false") || val.equalsIgnoreCase("f") || val.equals("")) { + setValue(Boolean.FALSE); + } else { + throw new IllegalArgumentException("Value must be true, false, t, f or empty."); + } + } - /** getAsText for boolean calls Boolean.toString(). **/ - public String getAsText() { - return getValue().toString(); - } + /** getAsText for boolean calls Boolean.toString(). **/ + public String getAsText() { + return getValue().toString(); + } } diff --git a/gnu/java/beans/editors/NativeByteEditor.java b/gnu/java/beans/editors/NativeByteEditor.java index f3ec5fa19..d427a9e3f 100644 --- a/gnu/java/beans/editors/NativeByteEditor.java +++ b/gnu/java/beans/editors/NativeByteEditor.java @@ -7,7 +7,7 @@ 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 @@ -49,13 +49,13 @@ import java.beans.PropertyEditorSupport; **/ public class NativeByteEditor extends PropertyEditorSupport { - /** setAsText for byte calls Byte.valueOf(). **/ - public void setAsText(String val) throws IllegalArgumentException { - setValue(Byte.valueOf(val)); - } - - /** getAsText for byte calls Byte.toString(). **/ - public String getAsText() { - return getValue().toString(); - } + /** setAsText for byte calls Byte.valueOf(). **/ + public void setAsText(String val) throws IllegalArgumentException { + setValue(Byte.valueOf(val)); + } + + /** getAsText for byte calls Byte.toString(). **/ + public String getAsText() { + return getValue().toString(); + } } diff --git a/gnu/java/beans/editors/NativeDoubleEditor.java b/gnu/java/beans/editors/NativeDoubleEditor.java index 8d8aae153..aa229fad7 100644 --- a/gnu/java/beans/editors/NativeDoubleEditor.java +++ b/gnu/java/beans/editors/NativeDoubleEditor.java @@ -7,7 +7,7 @@ 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 @@ -49,13 +49,13 @@ import java.beans.PropertyEditorSupport; **/ public class NativeDoubleEditor extends PropertyEditorSupport { - /** setAsText for double calls Double.valueOf(). **/ - public void setAsText(String val) throws IllegalArgumentException { - setValue(Double.valueOf(val)); - } - - /** getAsText for double calls Double.toString(). **/ - public String getAsText() { - return getValue().toString(); - } + /** setAsText for double calls Double.valueOf(). **/ + public void setAsText(String val) throws IllegalArgumentException { + setValue(Double.valueOf(val)); + } + + /** getAsText for double calls Double.toString(). **/ + public String getAsText() { + return getValue().toString(); + } } diff --git a/gnu/java/beans/editors/NativeFloatEditor.java b/gnu/java/beans/editors/NativeFloatEditor.java index 801377e7d..09f9d6b9c 100644 --- a/gnu/java/beans/editors/NativeFloatEditor.java +++ b/gnu/java/beans/editors/NativeFloatEditor.java @@ -7,7 +7,7 @@ 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 @@ -49,13 +49,13 @@ import java.beans.PropertyEditorSupport; **/ public class NativeFloatEditor extends PropertyEditorSupport { - /** setAsText for float calls Float.valueOf(). **/ - public void setAsText(String val) throws IllegalArgumentException { - setValue(Float.valueOf(val)); - } - - /** getAsText for float calls Float.toString(). **/ - public String getAsText() { - return getValue().toString(); - } + /** setAsText for float calls Float.valueOf(). **/ + public void setAsText(String val) throws IllegalArgumentException { + setValue(Float.valueOf(val)); + } + + /** getAsText for float calls Float.toString(). **/ + public String getAsText() { + return getValue().toString(); + } } diff --git a/gnu/java/beans/editors/NativeIntEditor.java b/gnu/java/beans/editors/NativeIntEditor.java index a6148841c..28b6a67d9 100644 --- a/gnu/java/beans/editors/NativeIntEditor.java +++ b/gnu/java/beans/editors/NativeIntEditor.java @@ -7,7 +7,7 @@ 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 @@ -49,13 +49,13 @@ import java.beans.PropertyEditorSupport; **/ public class NativeIntEditor extends PropertyEditorSupport { - /** setAsText for int calls Integer.valueOf(). **/ - public void setAsText(String val) throws IllegalArgumentException { - setValue(Integer.valueOf(val)); - } - - /** getAsText for int calls Integer.toString(). **/ - public String getAsText() { - return getValue().toString(); - } + /** setAsText for int calls Integer.valueOf(). **/ + public void setAsText(String val) throws IllegalArgumentException { + setValue(Integer.valueOf(val)); + } + + /** getAsText for int calls Integer.toString(). **/ + public String getAsText() { + return getValue().toString(); + } } diff --git a/gnu/java/beans/editors/NativeLongEditor.java b/gnu/java/beans/editors/NativeLongEditor.java index 95e9dc870..77223fbbc 100644 --- a/gnu/java/beans/editors/NativeLongEditor.java +++ b/gnu/java/beans/editors/NativeLongEditor.java @@ -7,7 +7,7 @@ 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 @@ -49,13 +49,13 @@ import java.beans.PropertyEditorSupport; **/ public class NativeLongEditor extends PropertyEditorSupport { - /** setAsText for long calls Long.valueOf(). **/ - public void setAsText(String val) throws IllegalArgumentException { - setValue(Long.valueOf(val)); - } - - /** getAsText for long calls Long.toString(). **/ - public String getAsText() { - return getValue().toString(); - } + /** setAsText for long calls Long.valueOf(). **/ + public void setAsText(String val) throws IllegalArgumentException { + setValue(Long.valueOf(val)); + } + + /** getAsText for long calls Long.toString(). **/ + public String getAsText() { + return getValue().toString(); + } } diff --git a/gnu/java/beans/editors/NativeShortEditor.java b/gnu/java/beans/editors/NativeShortEditor.java index ffaa26649..1d8845bde 100644 --- a/gnu/java/beans/editors/NativeShortEditor.java +++ b/gnu/java/beans/editors/NativeShortEditor.java @@ -7,7 +7,7 @@ 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 @@ -49,13 +49,13 @@ import java.beans.PropertyEditorSupport; **/ public class NativeShortEditor extends PropertyEditorSupport { - /** setAsText for short calls Short.valueOf(). **/ - public void setAsText(String val) throws IllegalArgumentException { - setValue(Short.valueOf(val)); - } - - /** getAsText for short calls Short.toString(). **/ - public String getAsText() { - return getValue().toString(); - } + /** setAsText for short calls Short.valueOf(). **/ + public void setAsText(String val) throws IllegalArgumentException { + setValue(Short.valueOf(val)); + } + + /** getAsText for short calls Short.toString(). **/ + public String getAsText() { + return getValue().toString(); + } } diff --git a/gnu/java/beans/editors/StringEditor.java b/gnu/java/beans/editors/StringEditor.java index 8242d5475..47fdce659 100644 --- a/gnu/java/beans/editors/StringEditor.java +++ b/gnu/java/beans/editors/StringEditor.java @@ -7,7 +7,7 @@ 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 @@ -49,13 +49,13 @@ import java.beans.PropertyEditorSupport; **/ public class StringEditor extends PropertyEditorSupport { - /** setAsText just sets the value. **/ - public void setAsText(String val) throws IllegalArgumentException { - setValue(val); - } - - /** getAsText just returns the value. **/ - public String getAsText() { - return (String)getValue(); - } + /** setAsText just sets the value. **/ + public void setAsText(String val) throws IllegalArgumentException { + setValue(val); + } + + /** getAsText just returns the value. **/ + public String getAsText() { + return (String)getValue(); + } } diff --git a/gnu/java/beans/encoder/ArrayPersistenceDelegate.java b/gnu/java/beans/encoder/ArrayPersistenceDelegate.java index 12d757e2d..52fc45796 100644 --- a/gnu/java/beans/encoder/ArrayPersistenceDelegate.java +++ b/gnu/java/beans/encoder/ArrayPersistenceDelegate.java @@ -7,7 +7,7 @@ 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 @@ -92,12 +92,12 @@ public class ArrayPersistenceDelegate extends PersistenceDelegate // Compares the array value against a prototypical // null value of the array's component type in order to skip // writing the default values of an array. - + // Note: I have no idea why the persistence delegate for arrays writes // an Expression that reads the value and then writes a Statement that sets // the value. However it turned out that object arrays work better with the // get-Expression and primitive array work fine with the set-Statement. - + type = type.getComponentType(); if (type.isPrimitive()) { @@ -113,7 +113,7 @@ public class ArrayPersistenceDelegate extends PersistenceDelegate new Object[] { oldInstance, Integer.valueOf(i), })); - + out.writeStatement(new Statement(Array.class, "set", new Object[] { oldInstance, @@ -122,7 +122,7 @@ public class ArrayPersistenceDelegate extends PersistenceDelegate })); } } - + } else { @@ -130,14 +130,14 @@ public class ArrayPersistenceDelegate extends PersistenceDelegate for (int i = 0; i < length; i++) { Object oldValue = Array.get(oldInstance, i); - + if (oldValue != null) { out.writeExpression(new Expression(Array.class, "get", new Object[] { oldInstance, Integer.valueOf(i), })); - + out.writeStatement(new Statement(Array.class, "set", new Object[] { oldInstance, @@ -147,7 +147,7 @@ public class ArrayPersistenceDelegate extends PersistenceDelegate } } } - + } } diff --git a/gnu/java/beans/encoder/ClassPersistenceDelegate.java b/gnu/java/beans/encoder/ClassPersistenceDelegate.java index 7b0656a5d..1430a6dbe 100644 --- a/gnu/java/beans/encoder/ClassPersistenceDelegate.java +++ b/gnu/java/beans/encoder/ClassPersistenceDelegate.java @@ -7,7 +7,7 @@ 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 @@ -43,7 +43,7 @@ import java.beans.PersistenceDelegate; /** <p>The <code>ClassPersistenceDelegate</code> creates * <code>Expression</code> instances which denote class resolutions.</p> - * + * * <p>The class resolution is always the last step when serializing a tree * of objects. Due to the recursive nature of the algorithm we need a way * to end the recursion. This is achieved by the implementation of this @@ -52,8 +52,8 @@ import java.beans.PersistenceDelegate; * we call <code>getClass()</code> on a <code>String.class</code> instance. * This in turn lead to the resolution of the String class which is always * encoded as <code>"".getClass()</code>. Finally the <code>Encoder</code> - * treats strings in a special way so that the recursion ends here. - * + * treats strings in a special way so that the recursion ends here. + * * @author Robert Schuster (robertschuster@fsfe.org) */ public class ClassPersistenceDelegate extends PersistenceDelegate @@ -62,7 +62,7 @@ public class ClassPersistenceDelegate extends PersistenceDelegate protected Expression instantiate(Object oldInstance, Encoder out) { Class oldClass = (Class) oldInstance; - + // Due to the special handling of String instances in the Encoder // this Expression does not lead to further class resolutions. if (oldClass == String.class) @@ -72,7 +72,7 @@ public class ClassPersistenceDelegate extends PersistenceDelegate if (oldClass == Class.class) return new Expression(oldClass, String.class, "getClass", null); - // This Expression will lead to the class resolution of Class.class. + // This Expression will lead to the class resolution of Class.class. return new Expression(oldClass, Class.class, "forName", new Object[] { oldClass.getName() }); } diff --git a/gnu/java/beans/encoder/CollectionPersistenceDelegate.java b/gnu/java/beans/encoder/CollectionPersistenceDelegate.java index f1375d2ec..bdf6fda62 100644 --- a/gnu/java/beans/encoder/CollectionPersistenceDelegate.java +++ b/gnu/java/beans/encoder/CollectionPersistenceDelegate.java @@ -7,7 +7,7 @@ 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 @@ -49,10 +49,10 @@ import java.util.Iterator; /** <p>A <code>PersistenceDelegate</code> implementation that calls * the no-argument constructor to create the Collection instance and * uses an iterator to add all the objects it reaches through it.</p> - * + * * <p>It is used for <code>Set</code> and <code>List</code> * implementations.</p> - * + * * @author Robert Schuster (robertschuster@fsfe.org) */ public class CollectionPersistenceDelegate extends PersistenceDelegate diff --git a/gnu/java/beans/encoder/Context.java b/gnu/java/beans/encoder/Context.java index 9126d496f..8acc4907b 100644 --- a/gnu/java/beans/encoder/Context.java +++ b/gnu/java/beans/encoder/Context.java @@ -41,20 +41,20 @@ package gnu.java.beans.encoder; /** A <code>Contect</code> object describes the current state * and the call number while processing the original object * tree in the {@link ScanEngine}. - * + * * <p>The class allows to distinguish the different calling states * and is neccessary for the child element skipping feature of - * the {@link GenericScannerState}.</p> - * + * the {@link GenericScannerState}.</p> + * * @author Robert Schuster (robertschuster@fsfe.org) * */ public class Context { private String state; - + private int call; - + Context(String newState, int newCall) { state = newState; @@ -66,21 +66,21 @@ public class Context int hc = 7; hc = 31 * hc + state.hashCode(); hc = 31 * hc + call; - + return hc; } - + public boolean equals(Object o) { if (!(o instanceof Context)) return false; - + Context that = (Context) o; - + return state.equals(that.state) && call == that.call; } - + public String toString() { return "Context [state=" + state + ", call=" + call + "]"; diff --git a/gnu/java/beans/encoder/GenericScannerState.java b/gnu/java/beans/encoder/GenericScannerState.java index 3c3f8a3d2..b07771dbe 100644 --- a/gnu/java/beans/encoder/GenericScannerState.java +++ b/gnu/java/beans/encoder/GenericScannerState.java @@ -60,12 +60,12 @@ import gnu.java.beans.encoder.elements.StringReference; * This class is a {@link ScannerState} implementation that creates * suitable {@link gnu.java.beans.encoder.elements.Element} instances * for each transition variant. - * + * * <p>Furthermore it can optionally skip a certain number of child - * elements. The algorithm can cope with the fact that one + * elements. The algorithm can cope with the fact that one * <code>GenericScannerState</code> instance may be called at * different levels of recursions.</p> - * + * * @author Robert Schuster (robertschuster@fsfe.org) */ class GenericScannerState extends ScannerState @@ -89,19 +89,19 @@ class GenericScannerState extends ScannerState if (skipElements > 0) skipValues = new HashMap(); } - + protected void enterImpl(Context ctx) { if (skipValues != null) { Integer skip = (Integer) skipValues.get(ctx); - + if (skip == null) { skip = Integer.valueOf(initialSkipElements); skipValues.put(ctx, skip); } - + skipElements = skip.intValue(); } } diff --git a/gnu/java/beans/encoder/IgnoringScannerState.java b/gnu/java/beans/encoder/IgnoringScannerState.java index 054f1f005..3ec78cdf9 100644 --- a/gnu/java/beans/encoder/IgnoringScannerState.java +++ b/gnu/java/beans/encoder/IgnoringScannerState.java @@ -40,7 +40,7 @@ package gnu.java.beans.encoder; /** A special {@link ScannerState} implementation that ignores all child * elements. - * + * * <p>Consider the call hierarchy: * <code> * methodInvocation @@ -50,16 +50,16 @@ package gnu.java.beans.encoder; * classResolution * </code> * </p> - * + * * <p>When the ignoring state is active one can filter the elements of * one level. One has to set up the state machine that a transition * via "class resolution" from a state that was reached via "object * instantation" reaches an <code>IgnoringScannerState</code>.</p> - * + * * <p>Setting the default successor of a <code>IgnoringScannerState</code> * to itself causes all elements of the call hierarchy to be skipped - * until another state is reached by going back.</p> - * + * until another state is reached by going back.</p> + * * @author Robert Schuster (robertschuster@fsfe.org) * */ @@ -125,9 +125,9 @@ class IgnoringScannerState extends ScannerState void objectReference(ObjectId id) { } - + void end() { } - + } diff --git a/gnu/java/beans/encoder/MapPersistenceDelegate.java b/gnu/java/beans/encoder/MapPersistenceDelegate.java index 84cdce94d..9ffdb5686 100644 --- a/gnu/java/beans/encoder/MapPersistenceDelegate.java +++ b/gnu/java/beans/encoder/MapPersistenceDelegate.java @@ -8,7 +8,7 @@ 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 diff --git a/gnu/java/beans/encoder/ObjectId.java b/gnu/java/beans/encoder/ObjectId.java index eca5c3da4..13d75d6bb 100644 --- a/gnu/java/beans/encoder/ObjectId.java +++ b/gnu/java/beans/encoder/ObjectId.java @@ -45,7 +45,7 @@ import java.util.HashMap; * ObjectId provides an object identification mechanism which gives each object * a name in the form <code><class><Nameindex></code>. * </p> - * + * * <p> * Each id can be in an unused state which means that only one instance of the * object is in use and a special id is not needed. Certain {@link @@ -57,7 +57,7 @@ import java.util.HashMap; * The second user should then invoke the {@link #init} method to generate the * identification string and bring the id in the 'used' state. * </p> - * + * * @author Robert Schuster (robertschuster@fsfe.org) */ public class ObjectId diff --git a/gnu/java/beans/encoder/PrimitivePersistenceDelegate.java b/gnu/java/beans/encoder/PrimitivePersistenceDelegate.java index 8cb3705b4..55626b512 100644 --- a/gnu/java/beans/encoder/PrimitivePersistenceDelegate.java +++ b/gnu/java/beans/encoder/PrimitivePersistenceDelegate.java @@ -8,7 +8,7 @@ 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 @@ -44,7 +44,7 @@ import java.beans.PersistenceDelegate; /** * A shared PersistenceDelegate implementation for all primitive types. - * + * * @author Robert Schuster (robertschuster@fsfe.org) */ public class PrimitivePersistenceDelegate extends PersistenceDelegate @@ -70,5 +70,5 @@ public class PrimitivePersistenceDelegate extends PersistenceDelegate out.writeExpression(new Expression(oldInstance, oldInstance.getClass(), "new", new Object[] { oldInstance.toString() })); } - + } diff --git a/gnu/java/beans/encoder/ReportingScannerState.java b/gnu/java/beans/encoder/ReportingScannerState.java index fb6e061ae..c91bb1567 100644 --- a/gnu/java/beans/encoder/ReportingScannerState.java +++ b/gnu/java/beans/encoder/ReportingScannerState.java @@ -42,7 +42,7 @@ package gnu.java.beans.encoder; * A <code>ScannerState</code> implementation that prints useful details * about its arguments. Use it when the XML encoding does not work correctly * and you want to find out how things relate to each other. - * + * * @author Robert Schuster (robertschuster@fsfe.org) */ class ReportingScannerState extends ScannerState @@ -50,12 +50,12 @@ class ReportingScannerState extends ScannerState void methodInvocation(String methodName) { - System.out.println("methodInvocation: " + methodName + "()"); + System.out.println("methodInvocation: " + methodName + "()"); } void staticMethodInvocation(String className, String methodName) { - System.out.println("staticMethodInvocation: " + className + "." + methodName + "()"); + System.out.println("staticMethodInvocation: " + className + "." + methodName + "()"); } void staticFieldAccess(String className, String fieldName) @@ -65,17 +65,17 @@ class ReportingScannerState extends ScannerState void classResolution(String className) { - System.out.println("classResolution: " + className); + System.out.println("classResolution: " + className); } void objectInstantiation(String className, ObjectId objectId) { - System.out.println("objectInstantiation: " + className); + System.out.println("objectInstantiation: " + className); } void primitiveInstantiation(String primitiveName, String valueAsString) { - System.out.println("primitiveInstantiation: (" + primitiveName + ") " + valueAsString); + System.out.println("primitiveInstantiation: (" + primitiveName + ") " + valueAsString); } void objectArrayInstantiation(String arrayClassName, String lengthAsString, ObjectId objectId) @@ -90,27 +90,27 @@ class ReportingScannerState extends ScannerState void arraySet(String indexAsString) { - System.out.println("arraySet: " + indexAsString); + System.out.println("arraySet: " + indexAsString); } void arrayGet(String indexAsString) { - System.out.println("arrayGet: " + indexAsString); + System.out.println("arrayGet: " + indexAsString); } void listGet() { - System.out.println("listGet"); + System.out.println("listGet"); } void listSet() { - System.out.println("listSet"); + System.out.println("listSet"); } void nullObject() { - System.out.println("nullObject"); + System.out.println("nullObject"); } void stringReference(String string) @@ -125,7 +125,7 @@ class ReportingScannerState extends ScannerState void end() { - System.out.println("-close"); + System.out.println("-close"); } - + } diff --git a/gnu/java/beans/encoder/Root.java b/gnu/java/beans/encoder/Root.java index f4eade193..a6410d716 100644 --- a/gnu/java/beans/encoder/Root.java +++ b/gnu/java/beans/encoder/Root.java @@ -46,14 +46,14 @@ import gnu.java.beans.encoder.elements.Element; /** <p><code>Root</code> provides a simple interface to a tree of * objects.</p> - * + * * <p>Using an instance of this class a logical representation of * the real object tree that is serialized can be built. When the * actual data should be written as XML <code>Root</code> and * {@link gnu.java.beans.encoder.elements.Element} class can provide * context information which is used to write the best fitting * XML representation.</p> - * + * * @author Robert Schuster (robertschuster@fsfe.org) */ public class Root @@ -61,7 +61,7 @@ public class Root private Stack parents = new Stack(); private Element rootElement, current; - + private boolean started; public Root() @@ -70,10 +70,10 @@ public class Root } /** <p>Adds another child element to the tree.</p> - * + * * <p>The new element automatically becomes the current * element.</p> - * + * * @param elem The new child element. */ public void addChild(Element elem) @@ -88,7 +88,7 @@ public class Root * <p>Marks that the end of the current element * is reached and that no more childs are added to * it.</p> - * + * * <p>The behavior is to return to the nearest parent * element.</p> */ @@ -100,7 +100,7 @@ public class Root /** * <p>Goes back to the nearest parent element but * deletes the just created child.</p> - * + * * <p>This is used if something went wrong while * processing the child element's {@link java.beans.Expression} * or {@link java.beans.Statement}.</p> @@ -117,9 +117,9 @@ public class Root * <p>Traverses the elements in the object tree * and creates their XML representation in the output * stream of the given {@link Writer}.</p> - * + * * <p>Finally the <code>Writer</code> is flushed.</p> - * + * * @param writer The Writer instance that generates the XML representation. */ public void traverse(Writer writer) @@ -130,16 +130,16 @@ public class Root rootElement.writeStart(writer); } started = true; - + traverse(writer, rootElement.iterator()); - + rootElement.clear(); - + writer.flush(); } /** Writes the closing element and closes the {@link Writer} - * + * * @param writer The Writer instance that generates the XML representation. */ public void close(Writer writer) @@ -149,7 +149,7 @@ public class Root } /** Recursively traverses the object tree. - * + * * @param writer The Writer instance that generates the XML representation. * @param ite An Iterator returning Element instances. */ @@ -163,19 +163,19 @@ public class Root traverse(writer, e.iterator()); e.writeEnd(writer); - + e.clear(); } } /** <p>A special Element implementation that represents the * encoder's context.</p> - * + * * <p>This element is written only once per Writer.</p> - * + * * <p>It is assumed that this element is never empty to simplify * the implementation.</p> - * + * * @author Robert Schuster (robertschuster@fsfe.org); * */ @@ -187,7 +187,7 @@ public class Root new String[] { System.getProperty("java.version"), XMLEncoder.class.getName() }, false); } - + public void writeEnd(Writer writer) { writer.writeEnd(false); diff --git a/gnu/java/beans/encoder/ScanEngine.java b/gnu/java/beans/encoder/ScanEngine.java index b78a81413..9ced143f0 100644 --- a/gnu/java/beans/encoder/ScanEngine.java +++ b/gnu/java/beans/encoder/ScanEngine.java @@ -1,4 +1,4 @@ -/* ScanEngine.java +/* ScanEngine.java -- Scans the input and generates an object tree that can be written as XML. Copyright (C) 2005 Free Software Foundation, Inc. @@ -54,7 +54,7 @@ import java.util.Stack; * {@link #writeObject} method and feeds it to a state machine. The * state machine then constructs and object tree which is finally * written as XML by a {@link Writer} implementation.</p> - * + * * <p>How does it work?</p> * <p>The <code>ScanEngine</code> sits below the {@link java.beans.XMLEncoder} * class and is called by it exclusively. The <code>XMLEncoder</code> sends @@ -65,7 +65,7 @@ import java.util.Stack; * Furthermore the meaning of certain <code>Expressions</code> differs * depending on the enclosing elements or the inner elements have to be * simply discarded.</p> - * + * * <p>To cope with this state dependant nature the <code>ScanEngine</code> * contains a state machine which is programmed statically (no adjustments are * needed, all <code>ScanEngine</code> engines use the same setup). The @@ -83,7 +83,7 @@ import java.util.Stack; * the current state and then the event method is called in the new current * state. The last step allows the state instance to do something meaningful * to the object tree.</p> - * + * * <p>The state machine knows the concept of returning to the previous * state. This is done using a stack of states which is popped every * time a call to <code>writeStatement</code>, <code>writeExpression</code> @@ -93,7 +93,7 @@ import java.util.Stack; * <code>ScanEngine</code> itself to decide when an expression or statement * ended. This can only be done in case of {@link #writeObject} calls because * they are not nested.</p> - * + * * <p>When the XML persistence mechanism reaches an object twice (and more) * it should generate an XML element using the "idref" attribute and add * an "id" attribute to its first instantiation. This complicates things a bit @@ -106,12 +106,12 @@ import java.util.Stack; * instance is stored in the <code>ScanEngine</code> and gets cleared whenever * the {@link #flush} method is called. This method also writes the currently * built object tree and generates the XML representation.</p> - * + * * @author Robert Schuster (robertschuster@fsfe.org) */ public class ScanEngine { - + /** Change this to true to let the ScanEngine print state transition * information. */ @@ -145,7 +145,7 @@ public class ScanEngine /** Stores the relationship between objects and their {@link ObjectId} instance. */ IdentityHashMap objects = new IdentityHashMap(); - + public ScanEngine(OutputStream os) { // TODO: Provide another Writer implementation (e.g. one that does not use @@ -182,7 +182,7 @@ public class ScanEngine "newObj0"); conf = register("newObj0", new GenericScannerState(root)); conf.setDefaultSuccessor("ignoreAll"); - + // Simply use the start state to encode method invocations inside of // objects. conf.putSuccessor(ScannerState.TRANSITION_METHOD_INVOCATION, "start"); @@ -203,14 +203,14 @@ public class ScanEngine conf.putSuccessor(ScannerState.TRANSITION_CLASS_RESOLUTION, "ignoreAll"); conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION, "ignoreAll"); - + // Get here when a value is set in the array. register("newOArrayGet", conf = new GenericScannerState(root)); - + conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION, "newOArrayGet_ignoreFirstInteger"); - + // "newArrayGet_ignoreFirstInteger" is set up mostly identical like the "start" // state. Otherwise things would not behave the same when done inside // arrays. @@ -223,21 +223,21 @@ public class ScanEngine "newPrimitiveArray"); conf.putSuccessor(ScannerState.TRANSITION_OBJECT_ARRAY_INSTANTIATION, "newObjectArray"); - + conf = register("newOArrayGet_ignoreFirstInteger", new GenericScannerState(root, 1)); - + // In non-int primitive arrays class resolutions can happen // but they should be ignored. conf.putSuccessor(ScannerState.TRANSITION_CLASS_RESOLUTION, "ignoreAll"); - + // Spurious object and string references occur when setting array // elements. This suppresses them. conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION, "ignoreAll"); conf.putSuccessor(ScannerState.TRANSITION_OBJECT_REFERENCE, "ignoreAll"); conf.putSuccessor(ScannerState.TRANSITION_STRING_REFERENCE, "ignoreAll"); - + conf.setDefaultSuccessor("start"); // Primitive arrays use the ARRAY_SET transition to create setting the @@ -252,11 +252,11 @@ public class ScanEngine conf.putSuccessor(ScannerState.TRANSITION_CLASS_RESOLUTION, "ignoreAll"); conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION, "ignoreAll"); - + conf = register("newPArraySet", new GenericScannerState(root)); conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION, "newPArraySet_ignoreFirstInteger"); - + // Primitive arrays ignore all kinds of non-primitive object information. conf.putSuccessor(ScannerState.TRANSITION_OBJECT_REFERENCE, "ignoreAll"); @@ -271,11 +271,11 @@ public class ScanEngine conf = register("newPArraySet_ignoreFirstInteger", new GenericScannerState(root, 1)); - + // In non-int primitive arrays class resolutions can happen // but they should be ignored. conf.putSuccessor(ScannerState.TRANSITION_CLASS_RESOLUTION, "ignoreAll"); - + // Spurious object and string references occur when setting array // elements. This suppresses them. conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION, @@ -287,7 +287,7 @@ public class ScanEngine } /** Registers a <code>ScannerState</code> under a certain name. - * + * * @param name Name of the state * @param state The <code>ScannerState</code> instance. * @return The second argument. @@ -295,26 +295,26 @@ public class ScanEngine private ScannerState register(String name, ScannerState state) { state.init(name); - + states.put(name, state); return state; } - + /** Generates or returns an id for the given object which can be activated * later if the object is suitable. - * + * * <p>Objects are unsuitable if they are an instance of a primitive wrapper * or String.</p> - * - * @param value The object to retrieve an id for. + * + * @param value The object to retrieve an id for. * @return The id for the object or <code>null</code>. */ private ObjectId retrieveId(Object value) { Class valueClass = value.getClass(); ObjectId id = null; - + // Although multiple accesses to Class objects are not handled // through ids we generate one for them, too. This allows us to detect // second time references to such objects in the writeObject method @@ -329,13 +329,13 @@ public class ScanEngine objects.put(value, id); } } - + return id; } /** Scans the argument and calls one of event methods. See * the introduction of this class for details. - * + * * @param expr The expression to serialize. */ public void writeExpression(Expression expr) @@ -344,7 +344,7 @@ public class ScanEngine Object[] args = expr.getArguments(); Object target = expr.getTarget(); Object value = null; - + try { value = expr.getValue(); @@ -366,9 +366,9 @@ public class ScanEngine if (methodName.equals("newInstance")) { id = retrieveId(value); - + Class ct = (Class) args[0]; - + if (ct.isPrimitive() || ct == Boolean.class || ct == Byte.class || ct == Short.class || ct == Integer.class || ct == Long.class || ct == Float.class || ct == Double.class) @@ -379,7 +379,7 @@ public class ScanEngine objectArrayInstantiation(ct.getName(), args[1].toString(), id); - + return; } else if (methodName.equals("get")) @@ -398,7 +398,7 @@ public class ScanEngine objectReference(id); end(); } - + return; } else if (methodName.equals("set")) @@ -407,7 +407,7 @@ public class ScanEngine return; } } - + id = retrieveId(value); if (target instanceof Class) @@ -517,7 +517,7 @@ public class ScanEngine /** Scans the argument and calls one of event methods. See * the introduction of this class for details. - * + * * @param stmt The statement to serialize. */ public void writeStatement(Statement stmt) @@ -553,7 +553,7 @@ public class ScanEngine /** Scans the argument and calls one of event methods. See * the introduction of this class for details. - * + * * @param o The object to serialize. */ public boolean writeObject(Object o) @@ -585,9 +585,9 @@ public class ScanEngine end(); return false; } - + // If our object has a corresponding ObjectId instance - // then generate an objectReference. This will + // then generate an objectReference. This will // initialize the id (= brings it in the "used" state) // when this is the first referal. objectReference(id); @@ -622,10 +622,10 @@ public class ScanEngine /** * Does a transition from one state to another using the given event. - * + * * <p>This involves saving the current state, retrieving it's * successor and setting it as the current state.</p> - * + * * @param transition One of {@link ScannerStates]'s transition constants. */ private void transition(int transition) @@ -633,7 +633,7 @@ public class ScanEngine parents.push(current); String stateName = current.getSuccessor(transition); - + if (DEBUG) { System.err.println("from state: " + current.getName() + "\n\troute: " @@ -641,9 +641,9 @@ public class ScanEngine + "\n\t\tto state: " + stateName); } - + ScannerState newState = (ScannerState) states.get(stateName); - + newState.enter(new Context(current.getName(), current.getCalls())); assert (newState != null) : "State '" + stateName + "' was not defined."; @@ -655,7 +655,7 @@ public class ScanEngine * * <p>More details about this method can be found in this * class' introduction.</p> - * + * * @param methodName The name of the method which is called. */ void methodInvocation(String methodName) @@ -669,7 +669,7 @@ public class ScanEngine * * <p>More details about this method can be found in this * class' introduction.</p> - * + * * @param methodName The name of the method which is called. * @param className The name of the class in which the method is called. */ @@ -684,7 +684,7 @@ public class ScanEngine * * <p>More details about this method can be found in this * class' introduction.</p> - * + * * @param fieldName The name of the field whose value is retrieved. * @param className The name of the class in which the method is called. */ @@ -699,7 +699,7 @@ public class ScanEngine * * <p>More details about this method can be found in this * class' introduction.</p> - * + * * @param className The name of the class in which the method is called. */ void classResolution(String className) @@ -713,7 +713,7 @@ public class ScanEngine * * <p>More details about this method can be found in this * class' introduction.</p> - * + * * @param className The name of the class in which the method is called. * @param objectId An ObjectId instance which can be activated later. */ @@ -728,7 +728,7 @@ public class ScanEngine * * <p>More details about this method can be found in this * class' introduction.</p> - * + * * @param primitiveName One of "boolean, "byte", "short", "int", "long" * , "float" or "double" * @param valueAsString The value of the primitive as a String. @@ -744,7 +744,7 @@ public class ScanEngine * * <p>More details about this method can be found in this * class' introduction.</p> - * + * * @param arrayClassName The array's class name. * @param objectId An ObjectId instance which can be activated later. * @param lengthAsString The array's length as String. @@ -761,7 +761,7 @@ public class ScanEngine * * <p>More details about this method can be found in this * class' introduction.</p> - * + * * @param arrayClassName The array's class name. * @param objectId An ObjectId instance which can be activated later. * @param lengthAsString The array's length as String. @@ -773,12 +773,12 @@ public class ScanEngine current.objectArrayInstantiation(arrayClassName, lengthAsString, objectId); } - + /** Event method that denotes the setting of a value in an array. * * <p>More details about this method can be found in this * class' introduction.</p> - * + * * @param indexAsString The index to as a String. */ void arraySet(String indexAsString) @@ -792,7 +792,7 @@ public class ScanEngine * * <p>More details about this method can be found in this * class' introduction.</p> - * + * * @param indexAsString The index to as a String. */ void arrayGet(String indexAsString) @@ -836,7 +836,7 @@ public class ScanEngine } /** Event method that denotes a string. - * + * * @param string The string that should be written. */ void stringReference(String string) @@ -847,7 +847,7 @@ public class ScanEngine } /** Event method that denotes a reference to an existing object. - * + * * @param id The ObjectId to be used. */ void objectReference(ObjectId id) diff --git a/gnu/java/beans/encoder/ScannerState.java b/gnu/java/beans/encoder/ScannerState.java index 888478a8e..14d63056e 100644 --- a/gnu/java/beans/encoder/ScannerState.java +++ b/gnu/java/beans/encoder/ScannerState.java @@ -42,12 +42,12 @@ import java.util.HashMap; /** <p>Provides the infrastructure for the state machine and the transition * mechanism.</p> - * + * * <p>Each states knows a set of successor. There can be one successor for * every transition variant. Furthermore a state knows about a default * successor which is taken when there is no special setup for a * transition.</p> - * + * * @author Robert Schuster (robertschuster@fsfe.org) * */ @@ -105,42 +105,42 @@ public abstract class ScannerState * transition->successor's state name. */ HashMap transitions = new HashMap(); - + int calls; - + Context context; - + String name; - + final void init(String newName) { assert (name == null); - + name = newName; } - + final String getName() { return name; } - + final void enter(Context ctx) { calls++; context = ctx; - + enterImpl(ctx); } - + protected void enterImpl(Context ctx) { } - + final Context context() { return context; } - + final int getCalls() { return calls; @@ -148,10 +148,10 @@ public abstract class ScannerState /** * <p>Stores a successor's state name for a certain transition.</p> - * + * * <p>This method is only used at the configuration time of the state * machine.</p> - * + * * @param transition One of the transition constants. * @param stateName The state name of the successor. */ @@ -165,10 +165,10 @@ public abstract class ScannerState /** <p>Retrieves a the state name of a successor for the given transition * constant.</p> - * + * * <p>Returns the default successor's state name if no special setup was * prepared.</p> - * + * * @param transition One of the transition constants. * @return The state name of the successor. */ @@ -181,7 +181,7 @@ public abstract class ScannerState /** * Sets the name for the default successor state. - * + * * @param newDefaultSuccessor The default successor's state name. */ final void setDefaultSuccessor(String newDefaultSuccessor) @@ -203,7 +203,7 @@ public abstract class ScannerState String valueAsString); abstract void objectArrayInstantiation(String arrayClassName, String lengthAsString, ObjectId objectId); - + abstract void primitiveArrayInstantiation(String arrayClassName, String lengthAsString, ObjectId objectId); abstract void arraySet(String indexAsString); @@ -222,7 +222,7 @@ public abstract class ScannerState /** * <p>A special event that does not provoke a direct transition.</p> - * + * * <p>Instead the transition is done by the <code>ScanEngine</code>: It goes * back to the previous state and just uses this method to inform the state * about this happening.</p> @@ -232,5 +232,5 @@ public abstract class ScannerState void enter() { } - + } diff --git a/gnu/java/beans/encoder/StAXWriter.java b/gnu/java/beans/encoder/StAXWriter.java index fdb5f7d45..da88c5361 100644 --- a/gnu/java/beans/encoder/StAXWriter.java +++ b/gnu/java/beans/encoder/StAXWriter.java @@ -45,7 +45,7 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; /** A {@link Writer} implementation based on the StAX API. - * + * * @author Robert Schuster (robertschuster@fsfe.org) * */ @@ -54,7 +54,7 @@ public class StAXWriter implements Writer XMLStreamWriter writer; int indent = 0; - + public StAXWriter(OutputStream os) { try @@ -71,7 +71,7 @@ public class StAXWriter implements Writer } } - + public void flush() { if (writer != null) @@ -138,7 +138,7 @@ public class StAXWriter implements Writer } } - + public void writeEndNoChildren() { try diff --git a/gnu/java/beans/encoder/Writer.java b/gnu/java/beans/encoder/Writer.java index 57203d23e..e08c786d8 100644 --- a/gnu/java/beans/encoder/Writer.java +++ b/gnu/java/beans/encoder/Writer.java @@ -40,20 +40,20 @@ package gnu.java.beans.encoder; /** A <code>Writer</code> represents a simplified interface to an XML * writer that is used for the XML persistence mechanism. - * + * * <p>Its sole purpose is to allow multiple backends which may remove * the need to have certain APIs in the classpath. Eg. it is possible * to write a stripped down XML Writer that does not rely on SAX, StAX * or DOM APIs.</p> - * + * * <p>The caller may assume that every action is done immediately. However * it is possible that the underlying implementation uses buffering streams. * To make sure the data is written call the {@link flush} method.</p> - * + * * <p>The <code>Writer</code> implementation should care about the formatting * of the XML stream making it possible to generate three types of formats using * a special method invocation chain.</p> - * + * * <p>Write * <code> * <element/> @@ -61,13 +61,13 @@ package gnu.java.beans.encoder; * by issuing <code>write("element", true)</code> (or any of the other * write-variants that allows specifying the <code>isEmpty</code> argument) * and <code>writeEnd(true)</code>.</p> - * + * * <p>Write * <code> * <element>body</element> * </code> * by issuing <code>writeNoChildren("element", "body")</code> and <code>writeNoChildrenEnd()</code>.</p> - * + * * <p> * Write * <code> @@ -80,7 +80,7 @@ package gnu.java.beans.encoder; * by issuing <code>write("element", false)</code> (or any of the other * write-variants that allows specifying the <code>isEmpty</code> argument) * and <code>writeEnd(false)</code>.</p> - * + * * <p>Note: It is important that the values of <code>isEmpty</code> and * <code>wasEmpty</code> match. Otherwise strange things might happen to * the layout.</p> @@ -90,40 +90,40 @@ package gnu.java.beans.encoder; */ public interface Writer { - // TODO: This interface's design is not the best. Feel free to + // TODO: This interface's design is not the best. Feel free to // improve it as you like. /** Writes the XML preamble. */ void writePreamble(); /** Writes the end of an XML tag. - * + * * <p>If your tag has not generated any body text or child * elements provide <code>true</code> as the argument to generate - * more space efficient variant of the tag.>/p> - * + * more space efficient variant of the tag.>/p> + * * @param wasEmpty Whether the tag was empty or not. */ void writeEnd(boolean wasEmpty); - /** Writes an XML tag without any attributes. - * + /** Writes an XML tag without any attributes. + * * @param tagName The name of the tag to write. * @param empty Whether the element has child elements. */ void write(String tagName, boolean empty); /** Writes an XML tag with one attribute name and value. - * + * * @param tagName The name of the tag to write. - * @param attributeName The name of attribute. + * @param attributeName The name of attribute. * @param attributeValue The attribute's value. * @param empty Whether the element has child elements. */ void write(String tagName, String attributeName, String attributeValue, boolean empty); /** Writes an XML tag with multiple attributes and a body text. - * + * * @param tagName The name of the tag to write. * @param value The element's body content. * @param attributeNames A set of attribute names. @@ -134,7 +134,7 @@ public interface Writer String[] attributeValues, boolean empty); /** Writes an XML tag with multiple attributes without a body text. - * + * * @param tagName The name of the tag to write. * @param attributeNames A set of attribute names. * @param attributeValues A set of attribute values. @@ -144,7 +144,7 @@ public interface Writer /** Writes an XML tag with no attributes but with a body text * that may have child elements. - * + * * @param tagName The name of the tag to write. * @param value The element's body content. */ @@ -152,14 +152,14 @@ public interface Writer /** Writes an XML tag with no attributes but with a body text * that does not have child elements. - * + * * @param tagName The name of the tag to write. * @param value The element's body content. */ void writeNoChildren(String tagName, String value); - + /** Writes the end of an XML tag that has no child elements. - * + * * <p>Must be used in combination with {@link writeNoChildren} only.</p> */ void writeEndNoChildren(); diff --git a/gnu/java/beans/encoder/elements/ArrayInstantiation.java b/gnu/java/beans/encoder/elements/ArrayInstantiation.java index a9aef89c7..51e00c361 100644 --- a/gnu/java/beans/encoder/elements/ArrayInstantiation.java +++ b/gnu/java/beans/encoder/elements/ArrayInstantiation.java @@ -42,7 +42,7 @@ import gnu.java.beans.encoder.ObjectId; import gnu.java.beans.encoder.Writer; /** Generates an XML element denoting the instantiation of an array. - * + * * @author Robert Schuster (robertschuster@fsfe.org) * */ diff --git a/gnu/java/beans/encoder/elements/Array_Get.java b/gnu/java/beans/encoder/elements/Array_Get.java index ca2ce0fa6..912ecebb5 100644 --- a/gnu/java/beans/encoder/elements/Array_Get.java +++ b/gnu/java/beans/encoder/elements/Array_Get.java @@ -42,7 +42,7 @@ import gnu.java.beans.encoder.Writer; /** * Generates an XML element denoting the retrieval of an array value. - * + * * @author Robert Schuster (robertschuster@fsfe.org) */ public class Array_Get extends Element diff --git a/gnu/java/beans/encoder/elements/ClassResolution.java b/gnu/java/beans/encoder/elements/ClassResolution.java index 8e640d183..cb736d5c0 100644 --- a/gnu/java/beans/encoder/elements/ClassResolution.java +++ b/gnu/java/beans/encoder/elements/ClassResolution.java @@ -41,7 +41,7 @@ package gnu.java.beans.encoder.elements; import gnu.java.beans.encoder.Writer; /** Generates an XML element denoting the resolution of a class. - * + * * @author Robert Schuster (robertschuster@fsfe.org) * */ @@ -58,7 +58,7 @@ public class ClassResolution extends Element { writer.writeNoChildren("class", className); } - + public void writeEnd(Writer writer) { writer.writeEndNoChildren(); diff --git a/gnu/java/beans/encoder/elements/Element.java b/gnu/java/beans/encoder/elements/Element.java index 5681d2b76..a8c0ecdf7 100644 --- a/gnu/java/beans/encoder/elements/Element.java +++ b/gnu/java/beans/encoder/elements/Element.java @@ -45,11 +45,11 @@ import gnu.java.beans.encoder.ObjectId; import gnu.java.beans.encoder.Writer; /** <code>Element</code> is the base class for the object tree elements. - * + * * <p>It provides the neccessary infrastructure every element subclass * needs in order to interact with the {@link gnu.java.beans.encoder.Root} * class.</p> - * + * * @author Robert Schuster (robertschuster@fsfe.org) */ public abstract class Element @@ -58,100 +58,100 @@ public abstract class Element * Stores the child elements. */ private LinkedList children = new LinkedList(); - + /** * An optional ObjectId instance which is needed for certain subclasses * only. */ private ObjectId objectId; - + /** Sets an {@link gnu.java.beans.encoder.ObjectId} instance in this * <code>Element</code>. - * + * * <p>This can only be done once.</p> - * + * * @param objectId An ObjectId instance. */ public final void initId(ObjectId objectId) { assert (this.objectId == null); assert (objectId != null); - + this.objectId = objectId; } /** Adds a child element to this <code>Element</code>. - * + * * @param elem The new child. */ public final void addChild(Element elem) { children.add(elem); } - + /** Removes the child element added last. */ public final void removeLast() { children.removeLast(); } - + /** Provides access to the child elements via an iterator. - * + * * @return An iterator for the child elements. */ public final Iterator iterator(){ return children.iterator(); } - + /** Clears all the stored child elements. - * + * */ public final void clear() { - children.clear(); + children.clear(); } - + /** Returns whether this element contains child elements. - * + * * <p>This method is useful to decide which formatting variant * for the XML element can be chosen.</p> - * + * * @return Whether the element has child elements. */ public final boolean isEmpty() { - return children.isEmpty(); + return children.isEmpty(); } - + /** Retrieves the element's {@link gnu.java.beans.encoder.ObjectId} instance * if it has one. - * + * * @return The ObjectId instance or <code>null</code>. */ public final ObjectId getId() { return objectId; } - + /** Writes the opening XML tag. - * + * * @param writer The writer to be used for XML writing. */ public abstract void writeStart(Writer writer); - + /** Writes the closing XML tag. - * + * * <p>By default this does <code>writer.writeEnd(children.isEmpty())</code>. * Override if neccessary, for example when using the * {@link gnu.java.beans.encoder.Writer#writeNoChildren}</code> method - * variants. - * + * variants. + * * @param writer The writer to be used for XML writing. */ public void writeEnd(Writer writer) { writer.writeEnd(children.isEmpty()); } - + } diff --git a/gnu/java/beans/encoder/elements/List_Get.java b/gnu/java/beans/encoder/elements/List_Get.java index e73afa8e9..c14ab91f9 100644 --- a/gnu/java/beans/encoder/elements/List_Get.java +++ b/gnu/java/beans/encoder/elements/List_Get.java @@ -41,7 +41,7 @@ package gnu.java.beans.encoder.elements; import gnu.java.beans.encoder.Writer; /** Generates an XML element denoting the retrieval of a list's element. - * + * * @author Robert Schuster (robertschuster@fsfe.org) * */ @@ -52,5 +52,5 @@ public class List_Get extends Element { writer.write("object", "get"); } - + } diff --git a/gnu/java/beans/encoder/elements/List_Set.java b/gnu/java/beans/encoder/elements/List_Set.java index 03c73fd20..3e7cca628 100644 --- a/gnu/java/beans/encoder/elements/List_Set.java +++ b/gnu/java/beans/encoder/elements/List_Set.java @@ -41,7 +41,7 @@ package gnu.java.beans.encoder.elements; import gnu.java.beans.encoder.Writer; /** Generates an XML element denoting the setting of a list's element. - * + * * @author Robert Schuster (robertschuster@fsfe.org) * */ @@ -52,5 +52,5 @@ public class List_Set extends Element { writer.write("object", "set"); } - + } diff --git a/gnu/java/beans/encoder/elements/MethodInvocation.java b/gnu/java/beans/encoder/elements/MethodInvocation.java index d5b317496..1de5bb62d 100644 --- a/gnu/java/beans/encoder/elements/MethodInvocation.java +++ b/gnu/java/beans/encoder/elements/MethodInvocation.java @@ -41,22 +41,22 @@ package gnu.java.beans.encoder.elements; import gnu.java.beans.encoder.Writer; /** Generates an XML element denoting a non-static method call. - * + * * @author Robert Schuster (robertschuster@fsfe.org) * */ public class MethodInvocation extends Element { final String methodName; - + public MethodInvocation(String newMethodName) { methodName = newMethodName; } - + public void writeStart(Writer writer) { writer.write("void", "method", methodName, isEmpty()); } - + } diff --git a/gnu/java/beans/encoder/elements/NullObject.java b/gnu/java/beans/encoder/elements/NullObject.java index 599c4d85f..211e2a74b 100644 --- a/gnu/java/beans/encoder/elements/NullObject.java +++ b/gnu/java/beans/encoder/elements/NullObject.java @@ -41,7 +41,7 @@ package gnu.java.beans.encoder.elements; import gnu.java.beans.encoder.Writer; /** Generates an XML element denoting the <code>null</code> value. - * + * * @author Robert Schuster (robertschuster@fsfe.org) * */ diff --git a/gnu/java/beans/encoder/elements/ObjectInstantiation.java b/gnu/java/beans/encoder/elements/ObjectInstantiation.java index 692227d59..98614809f 100644 --- a/gnu/java/beans/encoder/elements/ObjectInstantiation.java +++ b/gnu/java/beans/encoder/elements/ObjectInstantiation.java @@ -42,7 +42,7 @@ import gnu.java.beans.encoder.ObjectId; import gnu.java.beans.encoder.Writer; /** Generates an XML element denoting the instantiation of an object. - * + * * @author Robert Schuster (robertschuster@fsfe.org) * */ diff --git a/gnu/java/beans/encoder/elements/ObjectReference.java b/gnu/java/beans/encoder/elements/ObjectReference.java index a44c2ee60..13a597a58 100644 --- a/gnu/java/beans/encoder/elements/ObjectReference.java +++ b/gnu/java/beans/encoder/elements/ObjectReference.java @@ -42,7 +42,7 @@ import gnu.java.beans.encoder.ObjectId; import gnu.java.beans.encoder.Writer; /** Generates an XML element denoting referencing an existing object. - * + * * @author Robert Schuster (robertschuster@fsfe.org) * */ @@ -53,7 +53,7 @@ public class ObjectReference extends Element public ObjectReference(ObjectId newId) { id = newId; - + // Initializing the Id here is making sure it gets // actually used. This step modifies the Id instance // in other elements. @@ -64,5 +64,5 @@ public class ObjectReference extends Element { writer.write("object", "idref", id.toString(), isEmpty()); } - + } diff --git a/gnu/java/beans/encoder/elements/PrimitiveInstantiation.java b/gnu/java/beans/encoder/elements/PrimitiveInstantiation.java index db08edbf8..ae34b9dad 100644 --- a/gnu/java/beans/encoder/elements/PrimitiveInstantiation.java +++ b/gnu/java/beans/encoder/elements/PrimitiveInstantiation.java @@ -41,7 +41,7 @@ package gnu.java.beans.encoder.elements; import gnu.java.beans.encoder.Writer; /** Generates an XML element denoting a primitive data value. - * + * * @author Robert Schuster (robertschuster@fsfe.org) * */ diff --git a/gnu/java/beans/encoder/elements/StaticFieldAccess.java b/gnu/java/beans/encoder/elements/StaticFieldAccess.java index 7ed935d49..7fcbf5203 100644 --- a/gnu/java/beans/encoder/elements/StaticFieldAccess.java +++ b/gnu/java/beans/encoder/elements/StaticFieldAccess.java @@ -41,7 +41,7 @@ package gnu.java.beans.encoder.elements; import gnu.java.beans.encoder.Writer; /** Generates an XML element denoting a static method call. - * + * * @author Robert Schuster (robertschuster@fsfe.org) * */ diff --git a/gnu/java/beans/encoder/elements/StaticMethodInvocation.java b/gnu/java/beans/encoder/elements/StaticMethodInvocation.java index 40c46a534..92d49dc41 100644 --- a/gnu/java/beans/encoder/elements/StaticMethodInvocation.java +++ b/gnu/java/beans/encoder/elements/StaticMethodInvocation.java @@ -42,26 +42,26 @@ package gnu.java.beans.encoder.elements; import gnu.java.beans.encoder.Writer; /** - * + * * @author Robert Schuster (robertschuster@fsfe.org) * */ public class StaticMethodInvocation extends Element { final String className; - + final String methodName; - + public StaticMethodInvocation(String newClassName, String newMethodName) { className = newClassName; methodName = newMethodName; } - + public void writeStart(Writer writer) { writer.write("void", new String[] { "class", "method" }, new String[] { className, methodName }, isEmpty()); } - + } diff --git a/gnu/java/beans/encoder/elements/StringReference.java b/gnu/java/beans/encoder/elements/StringReference.java index c368e6528..7e6787da3 100644 --- a/gnu/java/beans/encoder/elements/StringReference.java +++ b/gnu/java/beans/encoder/elements/StringReference.java @@ -54,7 +54,7 @@ public class StringReference extends Element { writer.writeNoChildren("string", string); } - + public void writeEnd(Writer writer) { writer.writeEndNoChildren(); diff --git a/gnu/java/io/ASN1ParsingException.java b/gnu/java/io/ASN1ParsingException.java index 5d2c64ab5..9cf98abd3 100644 --- a/gnu/java/io/ASN1ParsingException.java +++ b/gnu/java/io/ASN1ParsingException.java @@ -7,7 +7,7 @@ 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 @@ -44,13 +44,13 @@ package gnu.java.io; public class ASN1ParsingException extends java.io.IOException { - public ASN1ParsingException() - { - super(); - } + public ASN1ParsingException() + { + super(); + } - public ASN1ParsingException(String msg) - { - super(msg); - } + public ASN1ParsingException(String msg) + { + super(msg); + } } diff --git a/gnu/java/io/Base64InputStream.java b/gnu/java/io/Base64InputStream.java index 1f5d220db..1105b6022 100644 --- a/gnu/java/io/Base64InputStream.java +++ b/gnu/java/io/Base64InputStream.java @@ -7,7 +7,7 @@ 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 @@ -57,7 +57,7 @@ public class Base64InputStream extends FilterInputStream // ------------------------------------------------------------------------ /** Base-64 digits. */ - private static final String BASE_64 = + private static final String BASE_64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /** Base-64 padding character. */ diff --git a/gnu/java/io/ClassLoaderObjectInputStream.java b/gnu/java/io/ClassLoaderObjectInputStream.java index 238ab26b1..e3f3d4c42 100644 --- a/gnu/java/io/ClassLoaderObjectInputStream.java +++ b/gnu/java/io/ClassLoaderObjectInputStream.java @@ -7,7 +7,7 @@ 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 @@ -52,22 +52,22 @@ import java.io.StreamCorruptedException; */ public class ClassLoaderObjectInputStream extends ObjectInputStream { - ClassLoader myClassLoader; + ClassLoader myClassLoader; - /** Create the new ClassLoaderObjectInputStream. - * @param in the InputStream to read the Objects from. - * @param myClassLoader the ClassLoader to load classes - * with. - */ - public ClassLoaderObjectInputStream(InputStream in, ClassLoader myClassLoader) throws IOException,StreamCorruptedException { - super(in); - this.myClassLoader = myClassLoader; - } + /** Create the new ClassLoaderObjectInputStream. + * @param in the InputStream to read the Objects from. + * @param myClassLoader the ClassLoader to load classes + * with. + */ + public ClassLoaderObjectInputStream(InputStream in, ClassLoader myClassLoader) throws IOException,StreamCorruptedException { + super(in); + this.myClassLoader = myClassLoader; + } - /** Overriden method to use the loadClass() method from - * the ClassLoader. - */ - public Class resolveClass(String name) throws IOException, ClassNotFoundException { - return myClassLoader.loadClass(name); - } + /** Overriden method to use the loadClass() method from + * the ClassLoader. + */ + public Class resolveClass(String name) throws IOException, ClassNotFoundException { + return myClassLoader.loadClass(name); + } } diff --git a/gnu/java/io/NullOutputStream.java b/gnu/java/io/NullOutputStream.java index 526bd26e8..603a2d3dd 100644 --- a/gnu/java/io/NullOutputStream.java +++ b/gnu/java/io/NullOutputStream.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/io/ObjectIdentityMap2Int.java b/gnu/java/io/ObjectIdentityMap2Int.java index 08f089d79..ed62e8381 100644 --- a/gnu/java/io/ObjectIdentityMap2Int.java +++ b/gnu/java/io/ObjectIdentityMap2Int.java @@ -7,7 +7,7 @@ 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 @@ -50,7 +50,7 @@ package gnu.java.io; * @author Fridtjof Siebert (siebert@aicas.com) */ public class ObjectIdentityMap2Int -{ +{ /** @@ -58,7 +58,7 @@ public class ObjectIdentityMap2Int * prime number since the delta used for conflict resulution must * not have any common divisors with the length. */ - private static final int[] PRIMES = { + private static final int[] PRIMES = { 0x1f, 0x3d, 0x7f, @@ -93,7 +93,7 @@ public class ObjectIdentityMap2Int */ private static final Object NIL = new Object(); - + /** * The objects in this map: * @@ -118,13 +118,13 @@ public class ObjectIdentityMap2Int * invariant * size < limit */ - private int size = 0; + private int size = 0; /** * The index in primes of the size of the tables. */ - private int cap = 0; + private int cap = 0; /** @@ -133,7 +133,7 @@ public class ObjectIdentityMap2Int * invariant * limit = PRIMES[cap] / 4 * 3; */ - private int limit = 0; + private int limit = 0; /** @@ -148,7 +148,7 @@ public class ObjectIdentityMap2Int /** * Helper function to alloc the object and int array for the given * capacity. Set limit, reset size to 0. - * + * * No elements will be stored in the newly allocated arrays. * * @param c the capacity: this is an index in PRIMES, PRIMES[c] @@ -161,8 +161,8 @@ public class ObjectIdentityMap2Int */ private void alloc(int c) { - if (c >= PRIMES.length) - throw new InternalError("Hash table size overflow"); + if (c >= PRIMES.length) + throw new InternalError("Hash table size overflow"); cap = c; int len = PRIMES[c]; @@ -170,7 +170,7 @@ public class ObjectIdentityMap2Int intTable = new int[len]; limit = len / 4 * 3; - size = 0; + size = 0; } @@ -180,7 +180,7 @@ public class ObjectIdentityMap2Int * ensures * (get(o) == i); * - * @param o object reference or null that is to be mapped. + * @param o object reference or null that is to be mapped. * * @param i the integer id to be associated with o * @@ -189,9 +189,9 @@ public class ObjectIdentityMap2Int * @throws InternalError if hash tables has grown to more then * 0x7fffffff entries (ie., size >= 0x7fffffff*3/4). */ - public void put(Object o, int i) + public void put(Object o, int i) { - if (i < 0) + if (i < 0) throw new IllegalArgumentException("int argument must be postive: "+i); o = (o == null) ? NIL : o; @@ -200,8 +200,8 @@ public class ObjectIdentityMap2Int intTable[s] = i; if (objectTable[s] == null) { - objectTable[s] = o; - size++; + objectTable[s] = o; + size++; if (size >= limit) { rehash(); @@ -219,14 +219,14 @@ public class ObjectIdentityMap2Int * * @param o an object, must not be null. * - * @return an index of o + * @return an index of o */ private int slot(Object o) { Object[] ot = objectTable; int hc = System.identityHashCode(o); int len = ot.length; - int result = hc % len; + int result = hc % len; result = result < 0 ? -result : result; int delta = 16 - (hc & 15); Object existing = ot[result]; @@ -249,9 +249,9 @@ public class ObjectIdentityMap2Int * ensure * (cap == \old cap+1); */ - private void rehash() + private void rehash() { - Object[] ot = objectTable; + Object[] ot = objectTable; int [] it = intTable; alloc(cap + 1); @@ -268,7 +268,7 @@ public class ObjectIdentityMap2Int * @return the corresponding integer id for o or -1 if o has not * been put into this map. */ - public int get(Object o) + public int get(Object o) { o = (o == null) ? NIL : o; int s = slot(o); @@ -281,10 +281,10 @@ public class ObjectIdentityMap2Int * ensures * ((size == 0) && \forall Object o: get(o) == -1) */ - public void clear() + public void clear() { - Object[] ot = objectTable; - size = 0; + Object[] ot = objectTable; + size = 0; for (int i = 0; i < ot.length; i++) ot[i] = null; } diff --git a/gnu/java/io/ObjectIdentityWrapper.java b/gnu/java/io/ObjectIdentityWrapper.java index 6db2e3a52..53c9943de 100644 --- a/gnu/java/io/ObjectIdentityWrapper.java +++ b/gnu/java/io/ObjectIdentityWrapper.java @@ -8,7 +8,7 @@ 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 diff --git a/gnu/java/io/PlatformHelper.java b/gnu/java/io/PlatformHelper.java index 96231e1be..545241110 100644 --- a/gnu/java/io/PlatformHelper.java +++ b/gnu/java/io/PlatformHelper.java @@ -7,7 +7,7 @@ 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 @@ -52,7 +52,7 @@ public class PlatformHelper public static final char pathSeparatorChar = pathSeparator.charAt(0); /** - * On most platforms 260 is equal or greater than a max path value, + * On most platforms 260 is equal or greater than a max path value, * so we can set the initial buffer size of StringBuffer to half of this value * to improve performance. */ @@ -106,7 +106,7 @@ public class PlatformHelper } /** - * This routine removes from input param "path" the tail separator if it exists, + * This routine removes from input param "path" the tail separator if it exists, * and return the remain part. */ public static final String removeTailSeparator(String path) @@ -118,7 +118,7 @@ public class PlatformHelper } /** - * This routine returns last index of separator in input param "path", + * This routine returns last index of separator in input param "path", * and return it. */ public static final int lastIndexOfSeparator(String path) diff --git a/gnu/java/lang/CPStringBuilder.java b/gnu/java/lang/CPStringBuilder.java index 27e7d2cc7..f42629d46 100644 --- a/gnu/java/lang/CPStringBuilder.java +++ b/gnu/java/lang/CPStringBuilder.java @@ -215,13 +215,13 @@ public final class CPStringBuilder /* If the StringBuffer's value just grew, then we know that value is newly allocated and the region between count and newLength is filled with '\0'. */ - count = newLength; + count = newLength; } else { - /* The StringBuffer's value doesn't need to grow. However, - we should clear out any cruft that may exist. */ - while (count < newLength) + /* The StringBuffer's value doesn't need to grow. However, + we should clear out any cruft that may exist. */ + while (count < newLength) value[count++] = '\0'; } } @@ -290,7 +290,7 @@ public final class CPStringBuilder * @see System#arraycopy(Object, int, Object, int, int) */ public void getChars(int srcOffset, int srcEnd, - char[] dst, int dstOffset) + char[] dst, int dstOffset) { if (srcOffset < 0 || srcEnd > count || srcEnd < srcOffset) throw new StringIndexOutOfBoundsException(); @@ -362,10 +362,10 @@ public final class CPStringBuilder return append("null"); synchronized (stringBuffer) { - int len = stringBuffer.length(); - ensureCapacity(count + len); - stringBuffer.getChars(0, len, value, count); - count += len; + int len = stringBuffer.length(); + ensureCapacity(count + len); + stringBuffer.getChars(0, len, value, count); + count += len; } return this; } @@ -466,9 +466,9 @@ public final class CPStringBuilder return append("null"); if (end - start > 0) { - ensureCapacity(count + end - start); - for (; start < end; ++start) - value[count++] = seq.charAt(start); + ensureCapacity(count + end - start); + for (; start < end; ++start) + value[count++] = seq.charAt(start); } return this; } @@ -979,23 +979,23 @@ public final class CPStringBuilder int count = 0; while (start < end) { - char base = value[start]; - if (base < Character.MIN_HIGH_SURROGATE - || base > Character.MAX_HIGH_SURROGATE - || start == end - || start == count - || value[start + 1] < Character.MIN_LOW_SURROGATE - || value[start + 1] > Character.MAX_LOW_SURROGATE) - { - // Nothing. - } - else - { - // Surrogate pair. - ++start; - } - ++start; - ++count; + char base = value[start]; + if (base < Character.MIN_HIGH_SURROGATE + || base > Character.MAX_HIGH_SURROGATE + || start == end + || start == count + || value[start + 1] < Character.MIN_LOW_SURROGATE + || value[start + 1] > Character.MAX_LOW_SURROGATE) + { + // Nothing. + } + else + { + // Surrogate pair. + ++start; + } + ++start; + ++count; } return count; } @@ -1015,22 +1015,22 @@ public final class CPStringBuilder { while (codePoints > 0) { - char base = value[start]; - if (base < Character.MIN_HIGH_SURROGATE - || base > Character.MAX_HIGH_SURROGATE - || start == count - || value[start + 1] < Character.MIN_LOW_SURROGATE - || value[start + 1] > Character.MAX_LOW_SURROGATE) - { - // Nothing. - } - else - { - // Surrogate pair. - ++start; - } - ++start; - --codePoints; + char base = value[start]; + if (base < Character.MIN_HIGH_SURROGATE + || base > Character.MAX_HIGH_SURROGATE + || start == count + || value[start + 1] < Character.MIN_LOW_SURROGATE + || value[start + 1] > Character.MAX_LOW_SURROGATE) + { + // Nothing. + } + else + { + // Surrogate pair. + ++start; + } + ++start; + --codePoints; } return start; } @@ -1040,7 +1040,7 @@ public final class CPStringBuilder * ensure that an expensive growing operation will not occur until either * <code>minimumCapacity</code> is reached or the array has been allocated. * The buffer is grown to either <code>minimumCapacity * 2</code>, if - * the array has been allocated or the larger of <code>minimumCapacity</code> and + * the array has been allocated or the larger of <code>minimumCapacity</code> and * <code>capacity() * 2 + 2</code>, if it is not already large enough. * * @param minimumCapacity the new capacity @@ -1050,14 +1050,14 @@ public final class CPStringBuilder { if (allocated || minimumCapacity > value.length) { - if (minimumCapacity > value.length) - { - int max = value.length * 2 + 2; - minimumCapacity = (minimumCapacity < max ? max : minimumCapacity); - } - else - minimumCapacity *= 2; - allocateArray(minimumCapacity); + if (minimumCapacity > value.length) + { + int max = value.length * 2 + 2; + minimumCapacity = (minimumCapacity < max ? max : minimumCapacity); + } + else + minimumCapacity *= 2; + allocateArray(minimumCapacity); } } @@ -1076,7 +1076,7 @@ public final class CPStringBuilder value = nb; allocated = false; } - + /** * Get the length of the <code>String</code> this <code>StringBuilder</code> * would create. Not to be confused with the <em>capacity</em> of the diff --git a/gnu/java/lang/CharData.java b/gnu/java/lang/CharData.java index a84d94da2..cb33035e6 100644 --- a/gnu/java/lang/CharData.java +++ b/gnu/java/lang/CharData.java @@ -58,7 +58,7 @@ package gnu.java.lang; * attribute tables are much smaller than 0xffff entries; as many characters * in Unicode share common attributes. Numbers that are too large to fit * into NUM_VALUE as 16 bit chars are stored in LARGENUMS and a number N is - * stored in NUM_VALUE such that (-N - 3) is the offset into LARGENUMS for + * stored in NUM_VALUE such that (-N - 3) is the offset into LARGENUMS for * the particular character. The DIRECTION table also contains a field for * detecting characters with multi-character uppercase expansions. * Next, there is a listing for <code>TITLE</code> exceptions (most characters @@ -81,7 +81,7 @@ public interface CharData /** * The character shift amount to look up the block offset. In other words, - * <code>(char) (BLOCKS.value[ch >> SHIFT[p]] + ch)</code> is the index + * <code>(char) (BLOCKS.value[ch >> SHIFT[p]] + ch)</code> is the index * where <code>ch</code> is described in <code>DATA</code> if <code>ch</code> * is in Unicode plane <code>p</code>. Note that <code>p</code> is simply * the integer division of ch and 0x10000. diff --git a/gnu/java/lang/InstrumentationImpl.java b/gnu/java/lang/InstrumentationImpl.java index 2425b35c8..a601baf55 100644 --- a/gnu/java/lang/InstrumentationImpl.java +++ b/gnu/java/lang/InstrumentationImpl.java @@ -66,7 +66,7 @@ public final class InstrumentationImpl implements Instrumentation private ArrayList<ClassFileTransformer> transformers = new ArrayList<ClassFileTransformer>(); - + InstrumentationImpl() { } @@ -76,7 +76,7 @@ public final class InstrumentationImpl implements Instrumentation * to the instrumentation. Each time a class is defined * or redefined, the <code>transform</code> method of the * <code>transformer</code> object is called. - * + * * @param transformer the transformer to add * @throws NullPointerException if transformer is null */ @@ -89,11 +89,11 @@ public final class InstrumentationImpl implements Instrumentation transformers.add(transformer); } } - + /** * Removes the given transformer from the set of transformers * this Instrumentation object has. - * + * * @param transformer the transformer to remove * @return true if the transformer was found and removed, false if * the transformer was not found @@ -103,8 +103,8 @@ public final class InstrumentationImpl implements Instrumentation { if (transformer == null) throw new NullPointerException(); - - boolean result; + + boolean result; synchronized (transformers) { result = transformers.remove(transformer); @@ -114,22 +114,22 @@ public final class InstrumentationImpl implements Instrumentation /** * Returns if the current JVM supports class redefinition - * + * * @return true if the current JVM supports class redefinition */ public boolean isRedefineClassesSupported() { return VMInstrumentationImpl.isRedefineClassesSupported(); } - + /** * Redefine classes present in the definitions array, with * the corresponding class files. * * @param definitions an array of classes to redefine - * - * @throws ClassNotFoundException if a class cannot be found - * @throws UnmodifiableClassException if a class cannot be modified + * + * @throws ClassNotFoundException if a class cannot be found + * @throws UnmodifiableClassException if a class cannot be modified * @throws UnsupportedOperationException if the JVM does not support * redefinition or the redefinition made unsupported changes * @throws ClassFormatError if a class file is not valid @@ -139,7 +139,7 @@ public final class InstrumentationImpl implements Instrumentation * are unsupported * @throws ClassCircularityError if circularity occured with the new * classes - * @throws LinkageError if a linkage error occurs + * @throws LinkageError if a linkage error occurs * @throws NullPointerException if the definitions array is null, or any * of its element * @@ -153,14 +153,14 @@ public final class InstrumentationImpl implements Instrumentation { if (!isRedefineClassesSupported()) throw new UnsupportedOperationException(); - + VMInstrumentationImpl.redefineClasses(this, definitions); } /** * Get all the classes loaded by the JVM. - * + * * @return an array containing all the classes loaded by the JVM. The array * is empty if no class is loaded. */ @@ -171,9 +171,9 @@ public final class InstrumentationImpl implements Instrumentation /** * Get all the classes loaded by a given class loader - * + * * @param loader the loader - * + * * @return an array containing all the classes loaded by the given loader. * The array is empty if no class was loaded by the loader. */ @@ -184,7 +184,7 @@ public final class InstrumentationImpl implements Instrumentation /** * Get the size of an object. - * + * * @param objectToSize the object * @return the size of the object * @throws NullPointerException if objectToSize is null. @@ -207,12 +207,12 @@ public final class InstrumentationImpl implements Instrumentation * @param protectionDomain the protection domain of the class being defined * or redefined * @param classfileBuffer the input byte buffer in class file format - * + * * @return the new class file */ public byte[] callTransformers(ClassLoader loader, String className, - Class<?> classBeingRedefined, ProtectionDomain protectionDomain, - byte[] classfileBuffer) + Class<?> classBeingRedefined, ProtectionDomain protectionDomain, + byte[] classfileBuffer) { byte[] newBuffer = null; byte[] oldBuffer = classfileBuffer; @@ -227,13 +227,13 @@ public final class InstrumentationImpl implements Instrumentation { newBuffer = current.transform(loader, className, classBeingRedefined, protectionDomain, oldBuffer); - } - catch (IllegalClassFormatException ignored) - { + } + catch (IllegalClassFormatException ignored) + { //IGNORED - } + } if (newBuffer != null) - oldBuffer = newBuffer; + oldBuffer = newBuffer; } } return oldBuffer; diff --git a/gnu/java/lang/MainThread.java b/gnu/java/lang/MainThread.java index 7ad70cd7c..a72956421 100644 --- a/gnu/java/lang/MainThread.java +++ b/gnu/java/lang/MainThread.java @@ -8,7 +8,7 @@ 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 @@ -58,7 +58,7 @@ public class MainThread throws ClassNotFoundException, NoSuchMethodException { Class found = Class.forName(classname, true, - ClassLoader.getSystemClassLoader()); + ClassLoader.getSystemClassLoader()); Class[] argTypes = new Class[1]; argTypes[0] = args.getClass(); mainMethod = found.getMethod("main", argTypes); @@ -69,15 +69,15 @@ public class MainThread { try { - mainMethod.invoke(null,(Object) args); + mainMethod.invoke(null,(Object) args); } catch(IllegalAccessException e) { - // Ignore. + // Ignore. } catch(InvocationTargetException e) { - // Ignore. + // Ignore. } } } diff --git a/gnu/java/lang/management/BeanImpl.java b/gnu/java/lang/management/BeanImpl.java index a651e3548..a7c2357b6 100644 --- a/gnu/java/lang/management/BeanImpl.java +++ b/gnu/java/lang/management/BeanImpl.java @@ -116,66 +116,66 @@ public class BeanImpl return; try { - MBeanAttributeInfo[] oldA = info.getAttributes(); - OpenMBeanAttributeInfo[] attribs = - new OpenMBeanAttributeInfoSupport[oldA.length]; - for (int a = 0; a < oldA.length; ++a) - { - OpenMBeanParameterInfo param = Translator.translate(oldA[a].getType()); - if (param.getMinValue() == null) - { - Object[] lv; - if (param.getLegalValues() == null) - lv = null; - else - lv = param.getLegalValues().toArray(); - attribs[a] = new OpenMBeanAttributeInfoSupport(oldA[a].getName(), - oldA[a].getDescription(), - ((OpenType<Object>) - param.getOpenType()), - oldA[a].isReadable(), - oldA[a].isWritable(), - oldA[a].isIs(), - param.getDefaultValue(), - lv); - } - else - attribs[a] = new OpenMBeanAttributeInfoSupport(oldA[a].getName(), - oldA[a].getDescription(), - ((OpenType<Object>) - param.getOpenType()), - oldA[a].isReadable(), - oldA[a].isWritable(), - oldA[a].isIs(), - param.getDefaultValue(), - ((Comparable<Object>) - param.getMinValue()), - ((Comparable<Object>) - param.getMaxValue())); - } - MBeanConstructorInfo[] oldC = info.getConstructors(); - OpenMBeanConstructorInfo[] cons = new OpenMBeanConstructorInfoSupport[oldC.length]; - for (int a = 0; a < oldC.length; ++a) - cons[a] = - new OpenMBeanConstructorInfoSupport(oldC[a].getName(), - oldC[a].getDescription(), - translateSignature(oldC[a].getSignature())); - MBeanOperationInfo[] oldO = info.getOperations(); - OpenMBeanOperationInfo[] ops = new OpenMBeanOperationInfoSupport[oldO.length]; - for (int a = 0; a < oldO.length; ++a) - ops[a] = - new OpenMBeanOperationInfoSupport(oldO[a].getName(), - oldO[a].getDescription(), - translateSignature(oldO[a].getSignature()), - Translator.translate(oldO[a].getReturnType()).getOpenType(), - oldO[a].getImpact()); - openInfo = new OpenMBeanInfoSupport(info.getClassName(), info.getDescription(), - attribs, cons, ops, info.getNotifications()); + MBeanAttributeInfo[] oldA = info.getAttributes(); + OpenMBeanAttributeInfo[] attribs = + new OpenMBeanAttributeInfoSupport[oldA.length]; + for (int a = 0; a < oldA.length; ++a) + { + OpenMBeanParameterInfo param = Translator.translate(oldA[a].getType()); + if (param.getMinValue() == null) + { + Object[] lv; + if (param.getLegalValues() == null) + lv = null; + else + lv = param.getLegalValues().toArray(); + attribs[a] = new OpenMBeanAttributeInfoSupport(oldA[a].getName(), + oldA[a].getDescription(), + ((OpenType<Object>) + param.getOpenType()), + oldA[a].isReadable(), + oldA[a].isWritable(), + oldA[a].isIs(), + param.getDefaultValue(), + lv); + } + else + attribs[a] = new OpenMBeanAttributeInfoSupport(oldA[a].getName(), + oldA[a].getDescription(), + ((OpenType<Object>) + param.getOpenType()), + oldA[a].isReadable(), + oldA[a].isWritable(), + oldA[a].isIs(), + param.getDefaultValue(), + ((Comparable<Object>) + param.getMinValue()), + ((Comparable<Object>) + param.getMaxValue())); + } + MBeanConstructorInfo[] oldC = info.getConstructors(); + OpenMBeanConstructorInfo[] cons = new OpenMBeanConstructorInfoSupport[oldC.length]; + for (int a = 0; a < oldC.length; ++a) + cons[a] = + new OpenMBeanConstructorInfoSupport(oldC[a].getName(), + oldC[a].getDescription(), + translateSignature(oldC[a].getSignature())); + MBeanOperationInfo[] oldO = info.getOperations(); + OpenMBeanOperationInfo[] ops = new OpenMBeanOperationInfoSupport[oldO.length]; + for (int a = 0; a < oldO.length; ++a) + ops[a] = + new OpenMBeanOperationInfoSupport(oldO[a].getName(), + oldO[a].getDescription(), + translateSignature(oldO[a].getSignature()), + Translator.translate(oldO[a].getReturnType()).getOpenType(), + oldO[a].getImpact()); + openInfo = new OpenMBeanInfoSupport(info.getClassName(), info.getDescription(), + attribs, cons, ops, info.getNotifications()); } catch (OpenDataException e) { - throw (InternalError) (new InternalError("A problem occurred creating the open type " + - "descriptors.").initCause(e)); + throw (InternalError) (new InternalError("A problem occurred creating the open type " + + "descriptors.").initCause(e)); } } @@ -195,7 +195,7 @@ public class BeanImpl public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, - ReflectionException + ReflectionException { Object value = super.getAttribute(attribute); if (value instanceof Enum) @@ -207,60 +207,60 @@ public class BeanImpl String[] allowedTypes = OpenType.ALLOWED_CLASSNAMES; for (int a = 0; a < allowedTypes.length; ++a) if (cName.equals(allowedTypes[a])) - return value; + return value; OpenMBeanInfo info = (OpenMBeanInfo) getMBeanInfo(); MBeanAttributeInfo[] attribs = (MBeanAttributeInfo[]) info.getAttributes(); OpenType type = null; for (int a = 0; a < attribs.length; ++a) if (attribs[a].getName().equals(attribute)) - type = ((OpenMBeanAttributeInfo) attribs[a]).getOpenType(); + type = ((OpenMBeanAttributeInfo) attribs[a]).getOpenType(); if (value instanceof List) { - try - { - Class e = - Class.forName(((ArrayType) type).getElementOpenType().getClassName()); - List l = (List) value; - Object[] array = (Object[]) Array.newInstance(e, l.size()); - return l.toArray(array); - } - catch (ClassNotFoundException e) - { - throw (InternalError) (new InternalError("The class of the list " + - "element type could not " + - "be created").initCause(e)); - } + try + { + Class e = + Class.forName(((ArrayType) type).getElementOpenType().getClassName()); + List l = (List) value; + Object[] array = (Object[]) Array.newInstance(e, l.size()); + return l.toArray(array); + } + catch (ClassNotFoundException e) + { + throw (InternalError) (new InternalError("The class of the list " + + "element type could not " + + "be created").initCause(e)); + } } if (value instanceof Map) { - TabularType ttype = (TabularType) type; - TabularData data = new TabularDataSupport(ttype); - Iterator it = ((Map) value).entrySet().iterator(); - while (it.hasNext()) - { - Map.Entry entry = (Map.Entry) it.next(); - try - { - data.put(new CompositeDataSupport(ttype.getRowType(), - new String[] { - "key", - "value" - }, - new Object[] { - entry.getKey(), - entry.getValue() - })); - } - catch (OpenDataException e) - { - throw (InternalError) (new InternalError("A problem occurred " + - "converting the map " + - "to a composite data " + - "structure.").initCause(e)); - } - } - return data; + TabularType ttype = (TabularType) type; + TabularData data = new TabularDataSupport(ttype); + Iterator it = ((Map) value).entrySet().iterator(); + while (it.hasNext()) + { + Map.Entry entry = (Map.Entry) it.next(); + try + { + data.put(new CompositeDataSupport(ttype.getRowType(), + new String[] { + "key", + "value" + }, + new Object[] { + entry.getKey(), + entry.getValue() + })); + } + catch (OpenDataException e) + { + throw (InternalError) (new InternalError("A problem occurred " + + "converting the map " + + "to a composite data " + + "structure.").initCause(e)); + } + } + return data; } CompositeType cType = (CompositeType) type; Set names = cType.keySet(); @@ -268,51 +268,51 @@ public class BeanImpl List values = new ArrayList(names.size()); while (it.hasNext()) { - String field = (String) it.next(); - Method getter = null; - try - { - getter = vClass.getMethod("get" + field); - } - catch (NoSuchMethodException e) - { - /* Ignored; the type tells us it's there. */ - } - try - { - values.add(getter.invoke(value)); - } - catch (IllegalAccessException e) - { - throw new ReflectionException(e, "Failed to retrieve " + field); - } - catch (IllegalArgumentException e) - { - throw new ReflectionException(e, "Failed to retrieve " + field); - } - catch (InvocationTargetException e) - { - throw new MBeanException((Exception) e.getCause(), - "The getter of " + field + - " threw an exception"); - } + String field = (String) it.next(); + Method getter = null; + try + { + getter = vClass.getMethod("get" + field); + } + catch (NoSuchMethodException e) + { + /* Ignored; the type tells us it's there. */ + } + try + { + values.add(getter.invoke(value)); + } + catch (IllegalAccessException e) + { + throw new ReflectionException(e, "Failed to retrieve " + field); + } + catch (IllegalArgumentException e) + { + throw new ReflectionException(e, "Failed to retrieve " + field); + } + catch (InvocationTargetException e) + { + throw new MBeanException((Exception) e.getCause(), + "The getter of " + field + + " threw an exception"); + } } try { - return new CompositeDataSupport(cType, - (String[]) - names.toArray(new String[names.size()]), - values.toArray()); + return new CompositeDataSupport(cType, + (String[]) + names.toArray(new String[names.size()]), + values.toArray()); } catch (OpenDataException e) { - throw (InternalError) (new InternalError("A problem occurred " + - "converting the value " + - "to a composite data " + - "structure.").initCause(e)); + throw (InternalError) (new InternalError("A problem occurred " + + "converting the value " + + "to a composite data " + + "structure.").initCause(e)); } } - + protected MBeanInfo getCachedMBeanInfo() { return (MBeanInfo) openInfo; @@ -322,15 +322,15 @@ public class BeanImpl * Override this method so as to prevent the description of a constructor's * parameter being @code{null}. Open MBeans can not have @code{null} descriptions, * but one will occur as the names of parameters aren't stored for reflection. - * + * * @param constructor the constructor whose parameter needs describing. * @param parameter the parameter to be described. * @param sequenceNo the number of the parameter to describe. * @return a description of the constructor's parameter. */ protected String getDescription(MBeanConstructorInfo constructor, - MBeanParameterInfo parameter, - int sequenceNo) + MBeanParameterInfo parameter, + int sequenceNo) { String desc = parameter.getDescription(); if (desc == null) @@ -343,15 +343,15 @@ public class BeanImpl * Override this method so as to prevent the description of an operation's * parameter being @code{null}. Open MBeans can not have @code{null} descriptions, * but one will occur as the names of parameters aren't stored for reflection. - * + * * @param operation the operation whose parameter needs describing. * @param parameter the parameter to be described. * @param sequenceNo the number of the parameter to describe. * @return a description of the operation's parameter. */ protected String getDescription(MBeanOperationInfo operation, - MBeanParameterInfo parameter, - int sequenceNo) + MBeanParameterInfo parameter, + int sequenceNo) { String desc = parameter.getDescription(); if (desc == null) @@ -364,15 +364,15 @@ public class BeanImpl * Override this method so as to prevent the name of a constructor's * parameter being @code{null}. Open MBeans can not have @code{null} names, * but one will occur as the names of parameters aren't stored for reflection. - * + * * @param constructor the constructor whose parameter needs a name. * @param parameter the parameter to be named. * @param sequenceNo the number of the parameter to name. * @return a description of the constructor's parameter. */ protected String getParameterName(MBeanConstructorInfo constructor, - MBeanParameterInfo parameter, - int sequenceNo) + MBeanParameterInfo parameter, + int sequenceNo) { String name = parameter.getName(); if (name == null) @@ -385,15 +385,15 @@ public class BeanImpl * Override this method so as to prevent the name of an operation's * parameter being @code{null}. Open MBeans can not have @code{null} names, * but one will occur as the names of parameters aren't stored for reflection. - * + * * @param operation the operation whose parameter needs a name. * @param parameter the parameter to be named. * @param sequenceNo the number of the parameter to name. * @return a description of the operation's parameter. */ protected String getParameterName(MBeanOperationInfo operation, - MBeanParameterInfo parameter, - int sequenceNo) + MBeanParameterInfo parameter, + int sequenceNo) { String name = parameter.getName(); if (name == null) @@ -414,31 +414,31 @@ public class BeanImpl OpenMBeanParameterInfo[] sig = new OpenMBeanParameterInfoSupport[oldS.length]; for (int a = 0; a < oldS.length; ++a) { - OpenMBeanParameterInfo param = Translator.translate(oldS[a].getType()); - if (param.getMinValue() == null) - { - Object[] lv; - if (param.getLegalValues() == null) - lv = null; - else - lv = param.getLegalValues().toArray(); - sig[a] = new OpenMBeanParameterInfoSupport(oldS[a].getName(), - oldS[a].getDescription(), - ((OpenType<Object>) - param.getOpenType()), - param.getDefaultValue(), - lv); - } - else - sig[a] = new OpenMBeanParameterInfoSupport(oldS[a].getName(), - oldS[a].getDescription(), - ((OpenType<Object>) - param.getOpenType()), - param.getDefaultValue(), - ((Comparable<Object>) - param.getMinValue()), - ((Comparable<Object>) - param.getMaxValue())); + OpenMBeanParameterInfo param = Translator.translate(oldS[a].getType()); + if (param.getMinValue() == null) + { + Object[] lv; + if (param.getLegalValues() == null) + lv = null; + else + lv = param.getLegalValues().toArray(); + sig[a] = new OpenMBeanParameterInfoSupport(oldS[a].getName(), + oldS[a].getDescription(), + ((OpenType<Object>) + param.getOpenType()), + param.getDefaultValue(), + lv); + } + else + sig[a] = new OpenMBeanParameterInfoSupport(oldS[a].getName(), + oldS[a].getDescription(), + ((OpenType<Object>) + param.getOpenType()), + param.getDefaultValue(), + ((Comparable<Object>) + param.getMinValue()), + ((Comparable<Object>) + param.getMaxValue())); } return sig; } diff --git a/gnu/java/lang/management/ClassLoadingMXBeanImpl.java b/gnu/java/lang/management/ClassLoadingMXBeanImpl.java index 92e68ae76..d98a39633 100644 --- a/gnu/java/lang/management/ClassLoadingMXBeanImpl.java +++ b/gnu/java/lang/management/ClassLoadingMXBeanImpl.java @@ -42,7 +42,7 @@ import java.lang.management.ClassLoadingMXBean; import javax.management.NotCompliantMBeanException; /** - * Provides access to information about the class loading + * Provides access to information about the class loading * behaviour of the current invocation of the virtual * machine. Instances of this bean are obtained by calling * {@link ManagementFactory#getClassLoadingMXBean()}. @@ -96,4 +96,3 @@ public final class ClassLoadingMXBeanImpl } } - diff --git a/gnu/java/lang/management/CompilationMXBeanImpl.java b/gnu/java/lang/management/CompilationMXBeanImpl.java index b3ad898b5..1b77edf5a 100644 --- a/gnu/java/lang/management/CompilationMXBeanImpl.java +++ b/gnu/java/lang/management/CompilationMXBeanImpl.java @@ -44,7 +44,7 @@ import java.lang.management.CompilationMXBean; import javax.management.NotCompliantMBeanException; /** - * Provides access to information about the JIT + * Provides access to information about the JIT * compiler of the virtual machine, if one exists. * Instances of this bean are obtained by calling * {@link ManagementFactory#getCompilationMXBean()}, @@ -66,7 +66,7 @@ public final class CompilationMXBeanImpl /** * Constant for compilation time support. */ - private static final String COMPILATION_TIME_SUPPORT = + private static final String COMPILATION_TIME_SUPPORT = "gnu.java.lang.management.CompilationTimeSupport"; /** @@ -87,7 +87,7 @@ public final class CompilationMXBeanImpl { return SystemProperties.getProperty(COMPILER_NAME); } - + public boolean isCompilationTimeMonitoringSupported() { return SystemProperties.getProperty(COMPILATION_TIME_SUPPORT) != null; @@ -99,7 +99,7 @@ public final class CompilationMXBeanImpl return VMCompilationMXBeanImpl.getTotalCompilationTime(); else throw new UnsupportedOperationException("Compilation time monitoring " - + "is not supported"); + + "is not supported"); } } diff --git a/gnu/java/lang/management/GarbageCollectorMXBeanImpl.java b/gnu/java/lang/management/GarbageCollectorMXBeanImpl.java index b752e6b86..7a2d762fa 100644 --- a/gnu/java/lang/management/GarbageCollectorMXBeanImpl.java +++ b/gnu/java/lang/management/GarbageCollectorMXBeanImpl.java @@ -42,7 +42,7 @@ import java.lang.management.GarbageCollectorMXBean; import javax.management.NotCompliantMBeanException; /** - * Provides access to information about one of the garbage + * Provides access to information about one of the garbage * collectors used by the current invocation of the * virtual machine. An instance of this bean for each garbage * collector is obtained by calling diff --git a/gnu/java/lang/management/MemoryMXBeanImpl.java b/gnu/java/lang/management/MemoryMXBeanImpl.java index 1e6c63afc..10e6522f1 100644 --- a/gnu/java/lang/management/MemoryMXBeanImpl.java +++ b/gnu/java/lang/management/MemoryMXBeanImpl.java @@ -63,7 +63,7 @@ import javax.management.openmbean.OpenType; import javax.management.openmbean.SimpleType; /** - * Provides access to information about the memory + * Provides access to information about the memory * management of the current invocation of the virtual * machine. Instances of this bean are obtained by calling * {@link ManagementFactory#getMemoryMXBean()}. @@ -88,39 +88,39 @@ public final class MemoryMXBeanImpl { try { - CompositeType usageType = - new CompositeType(MemoryUsage.class.getName(), - "Describes the usage levels of a pool", - new String[] { "init", "used", - "committed", "max" - }, - new String[] { "Initial level", - "Used level", - "Committed level", - "Maximum level" - }, - new OpenType[] { - SimpleType.LONG, SimpleType.LONG, - SimpleType.LONG, SimpleType.LONG - }); - CompositeType notifType = - new CompositeType(MemoryNotificationInfo.class.getName(), - "Provides the notification info on memory usage", - new String[] { "poolName", "usage", "count" }, - new String[] { "Name of the memory pool", - "Usage level of the memory pool", - "Number of times the threshold " + - "has been crossed" - }, - new OpenType[] { - SimpleType.STRING, usageType, SimpleType.LONG - }); - } - catch (OpenDataException e) - { - throw new IllegalStateException("Something went wrong in creating " + - "the composite data types.", e); - } + CompositeType usageType = + new CompositeType(MemoryUsage.class.getName(), + "Describes the usage levels of a pool", + new String[] { "init", "used", + "committed", "max" + }, + new String[] { "Initial level", + "Used level", + "Committed level", + "Maximum level" + }, + new OpenType[] { + SimpleType.LONG, SimpleType.LONG, + SimpleType.LONG, SimpleType.LONG + }); + CompositeType notifType = + new CompositeType(MemoryNotificationInfo.class.getName(), + "Provides the notification info on memory usage", + new String[] { "poolName", "usage", "count" }, + new String[] { "Name of the memory pool", + "Usage level of the memory pool", + "Number of times the threshold " + + "has been crossed" + }, + new OpenType[] { + SimpleType.STRING, usageType, SimpleType.LONG + }); + } + catch (OpenDataException e) + { + throw new IllegalStateException("Something went wrong in creating " + + "the composite data types.", e); + } } /** @@ -171,8 +171,8 @@ public final class MemoryMXBeanImpl } public void addNotificationListener(NotificationListener listener, - NotificationFilter filter, - Object passback) + NotificationFilter filter, + Object passback) { if (listener == null) throw new IllegalArgumentException("Null listener added to bean."); @@ -183,13 +183,13 @@ public final class MemoryMXBeanImpl { return new MBeanNotificationInfo[] { - new MBeanNotificationInfo(new String[] - { - MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED, - MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED - }, - Notification.class.getName(), - "Memory Usage Notifications") + new MBeanNotificationInfo(new String[] + { + MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED, + MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED + }, + Notification.class.getName(), + "Memory Usage Notifications") }; } @@ -200,82 +200,82 @@ public final class MemoryMXBeanImpl boolean foundOne = false; while (it.hasNext()) { - ListenerData data = (ListenerData) it.next(); - if (data.getListener() == listener) - { - it.remove(); - foundOne = true; - } + ListenerData data = (ListenerData) it.next(); + if (data.getListener() == listener) + { + it.remove(); + foundOne = true; + } } if (!foundOne) throw new ListenerNotFoundException("The specified listener, " + listener + - "is not registered with this bean."); + "is not registered with this bean."); } public void removeNotificationListener(NotificationListener listener, - NotificationFilter filter, - Object passback) + NotificationFilter filter, + Object passback) throws ListenerNotFoundException { if (!(listeners.remove(new ListenerData(listener, filter, passback)))) { - throw new ListenerNotFoundException("The specified listener, " + listener + - " with filter " + filter + - "and passback " + passback + - ", is not registered with this bean."); + throw new ListenerNotFoundException("The specified listener, " + listener + + " with filter " + filter + + "and passback " + passback + + ", is not registered with this bean."); } } void fireNotification(String type, String poolName, long init, long used, - long committed, long max, long count) + long committed, long max, long count) { Notification notif = new Notification(type, this, notificationCount); MemoryUsage usage = new MemoryUsage(init, used, committed, max); CompositeData data; try { - data = new CompositeDataSupport(notifType, - new String[] { - "poolName", "usage", "count" - }, - new Object[] { - poolName, usage, Long.valueOf(count) - }); + data = new CompositeDataSupport(notifType, + new String[] { + "poolName", "usage", "count" + }, + new Object[] { + poolName, usage, Long.valueOf(count) + }); } catch (OpenDataException e) { - throw new IllegalStateException("Something went wrong in creating " + - "the composite data instance.", e); + throw new IllegalStateException("Something went wrong in creating " + + "the composite data instance.", e); } notif.setUserData(data); Iterator it = listeners.iterator(); while (it.hasNext()) { - ListenerData ldata = (ListenerData) it.next(); - NotificationFilter filter = ldata.getFilter(); - if (filter == null || filter.isNotificationEnabled(notif)) - ldata.getListener().handleNotification(notif, ldata.getPassback()); + ListenerData ldata = (ListenerData) it.next(); + NotificationFilter filter = ldata.getFilter(); + if (filter == null || filter.isNotificationEnabled(notif)) + ldata.getListener().handleNotification(notif, ldata.getPassback()); } ++notificationCount; } void fireThresholdExceededNotification(String poolName, long init, - long used, long committed, - long max, long count) + long used, long committed, + long max, long count) { fireNotification(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED, - poolName, init, used, committed, max, count); + poolName, init, used, committed, max, count); } void fireCollectionThresholdExceededNotification(String poolName, - long init, - long used, - long committed, - long max, - long count) + long init, + long used, + long committed, + long max, + long count) { fireNotification(MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED, - poolName, init, used, committed, max, count); + poolName, init, used, committed, max, count); } } diff --git a/gnu/java/lang/management/MemoryManagerMXBeanImpl.java b/gnu/java/lang/management/MemoryManagerMXBeanImpl.java index 5766af9cc..51d0ed972 100644 --- a/gnu/java/lang/management/MemoryManagerMXBeanImpl.java +++ b/gnu/java/lang/management/MemoryManagerMXBeanImpl.java @@ -42,7 +42,7 @@ import java.lang.management.MemoryManagerMXBean; import javax.management.NotCompliantMBeanException; /** - * Provides access to information about one of the memory + * Provides access to information about one of the memory * managers used by the current invocation of the * virtual machine. An instance of this bean for each memory * manager is obtained by calling diff --git a/gnu/java/lang/management/MemoryPoolMXBeanImpl.java b/gnu/java/lang/management/MemoryPoolMXBeanImpl.java index e314ca164..d92e6703f 100644 --- a/gnu/java/lang/management/MemoryPoolMXBeanImpl.java +++ b/gnu/java/lang/management/MemoryPoolMXBeanImpl.java @@ -46,7 +46,7 @@ import java.lang.management.MemoryUsage; import javax.management.NotCompliantMBeanException; /** - * Provides access to information about one of the memory + * Provides access to information about one of the memory * resources or pools used by the current invocation of the * virtual machine. An instance of this bean for each memory * pool is obtained by calling @@ -68,13 +68,13 @@ public final class MemoryPoolMXBeanImpl /** * Constant for collection usage threshold. */ - private static final String COLLECTION_USAGE_THRESHOLD = + private static final String COLLECTION_USAGE_THRESHOLD = "gnu.java.lang.management.CollectionUsageThresholdSupport"; /** * Constant for thread time support. */ - private static final String USAGE_THRESHOLD = + private static final String USAGE_THRESHOLD = "gnu.java.lang.management.UsageThresholdSupport"; /** @@ -104,7 +104,7 @@ public final class MemoryPoolMXBeanImpl return VMMemoryPoolMXBeanImpl.getCollectionUsageThreshold(name); else throw new UnsupportedOperationException("A collection usage "+ - "threshold is not supported."); + "threshold is not supported."); } public long getCollectionUsageThresholdCount() @@ -113,7 +113,7 @@ public final class MemoryPoolMXBeanImpl return VMMemoryPoolMXBeanImpl.getCollectionUsageThresholdCount(name); else throw new UnsupportedOperationException("A collection usage "+ - "threshold is not supported."); + "threshold is not supported."); } public String[] getMemoryManagerNames() @@ -136,7 +136,7 @@ public final class MemoryPoolMXBeanImpl public MemoryType getType() { - return + return MemoryType.valueOf(VMMemoryPoolMXBeanImpl.getType(name)); } @@ -154,7 +154,7 @@ public final class MemoryPoolMXBeanImpl return VMMemoryPoolMXBeanImpl.getUsageThreshold(name); else throw new UnsupportedOperationException("A usage threshold " + - "is not supported."); + "is not supported."); } public long getUsageThresholdCount() @@ -163,7 +163,7 @@ public final class MemoryPoolMXBeanImpl return VMMemoryPoolMXBeanImpl.getUsageThresholdCount(name); else throw new UnsupportedOperationException("A usage threshold " + - "is not supported."); + "is not supported."); } public boolean isCollectionUsageThresholdExceeded() @@ -202,12 +202,12 @@ public final class MemoryPoolMXBeanImpl checkControlPermissions(); if (threshold < 0) throw new IllegalArgumentException("Threshold of " + threshold + - "is less than zero."); + "is less than zero."); if (isCollectionUsageThresholdSupported()) VMMemoryPoolMXBeanImpl.setCollectionUsageThreshold(name, threshold); else throw new UnsupportedOperationException("A collection usage "+ - "threshold is not supported."); + "threshold is not supported."); } public void setUsageThreshold(long threshold) @@ -215,13 +215,12 @@ public final class MemoryPoolMXBeanImpl checkControlPermissions(); if (threshold < 0) throw new IllegalArgumentException("Threshold of " + threshold + - "is less than zero."); + "is less than zero."); if (isUsageThresholdSupported()) VMMemoryPoolMXBeanImpl.setUsageThreshold(name, threshold); else throw new UnsupportedOperationException("A usage threshold " + - "is not supported."); + "is not supported."); } } - diff --git a/gnu/java/lang/management/OperatingSystemMXBeanImpl.java b/gnu/java/lang/management/OperatingSystemMXBeanImpl.java index 07fb7bf03..7f5a9586c 100644 --- a/gnu/java/lang/management/OperatingSystemMXBeanImpl.java +++ b/gnu/java/lang/management/OperatingSystemMXBeanImpl.java @@ -43,7 +43,7 @@ import javax.management.NotCompliantMBeanException; /** * Provides access to information about the underlying operating - * system. + * system. * * @author Andrew John Hughes (gnu_andrew@member.fsf.org) * @since 1.5 @@ -91,5 +91,5 @@ public final class OperatingSystemMXBeanImpl { return System.getProperty("os.version"); } - + } diff --git a/gnu/java/lang/management/RuntimeMXBeanImpl.java b/gnu/java/lang/management/RuntimeMXBeanImpl.java index e3ebd162e..8db943bb6 100644 --- a/gnu/java/lang/management/RuntimeMXBeanImpl.java +++ b/gnu/java/lang/management/RuntimeMXBeanImpl.java @@ -92,8 +92,8 @@ public final class RuntimeMXBeanImpl return bootClassPath; else throw - new UnsupportedOperationException("Retrieving the boot " + - "classpath is not supported."); + new UnsupportedOperationException("Retrieving the boot " + + "classpath is not supported."); } public String getClassPath() @@ -151,16 +151,16 @@ public final class RuntimeMXBeanImpl Iterator entries = props.entrySet().iterator(); while (entries.hasNext()) { - Map.Entry next = (Map.Entry) entries.next(); - Object key = next.getKey(); - Object value = next.getValue(); - if (key instanceof String && - value instanceof String) - map.put(key, value); + Map.Entry next = (Map.Entry) entries.next(); + Object key = next.getKey(); + Object value = next.getValue(); + if (key instanceof String && + value instanceof String) + map.put(key, value); } return map; } - + public long getUptime() { return new Date().getTime() - getStartTime(); @@ -185,11 +185,11 @@ public final class RuntimeMXBeanImpl { if (bootClassPath == null) { - bootClassPath = SystemProperties.getProperty(JAVA_BOOT_CLASS_PATH); - if (bootClassPath == null) - bootClassPath = SystemProperties.getProperty(SUN_BOOT_CLASS_PATH); - if (bootClassPath == null) - bootClassPathSupported = false; + bootClassPath = SystemProperties.getProperty(JAVA_BOOT_CLASS_PATH); + if (bootClassPath == null) + bootClassPath = SystemProperties.getProperty(SUN_BOOT_CLASS_PATH); + if (bootClassPath == null) + bootClassPathSupported = false; } return bootClassPathSupported; } diff --git a/gnu/java/lang/management/ThreadMXBeanImpl.java b/gnu/java/lang/management/ThreadMXBeanImpl.java index 5d0282301..97040997b 100644 --- a/gnu/java/lang/management/ThreadMXBeanImpl.java +++ b/gnu/java/lang/management/ThreadMXBeanImpl.java @@ -45,7 +45,7 @@ import java.lang.management.ThreadMXBean; import javax.management.NotCompliantMBeanException; /** - * Provides access to information about the threads + * Provides access to information about the threads * of the virtual machine. An instance of this bean is * obtained by calling * {@link ManagementFactory#getThreadMXBean()}. @@ -63,25 +63,25 @@ public final class ThreadMXBeanImpl /** * Constant for current thread time support. */ - private static final String CURRENT_THREAD_TIME_SUPPORT = + private static final String CURRENT_THREAD_TIME_SUPPORT = "gnu.java.lang.management.CurrentThreadTimeSupport"; /** * Constant for thread time support. */ - private static final String THREAD_TIME_SUPPORT = + private static final String THREAD_TIME_SUPPORT = "gnu.java.lang.management.ThreadTimeSupport"; /** * Constant for thread contention support. */ - private static final String CONTENTION_SUPPORT = + private static final String CONTENTION_SUPPORT = "gnu.java.lang.management.ThreadContentionSupport"; /** * Constant for initial value of thread time support. */ - private static final String TIME_ENABLED = + private static final String TIME_ENABLED = "gnu.java.lang.management.ThreadTimeInitallyEnabled"; /** @@ -125,10 +125,10 @@ public final class ThreadMXBeanImpl } public ThreadInfo[] dumpAllThreads(boolean lockedMonitors, - boolean lockedSynchronizers) + boolean lockedSynchronizers) { return getThreadInfo(getAllThreadIds(), lockedMonitors, - lockedSynchronizers); + lockedSynchronizers); } public long[] findDeadlockedThreads() @@ -136,8 +136,8 @@ public final class ThreadMXBeanImpl checkMonitorPermissions(); if (!isSynchronizerUsageSupported()) throw new UnsupportedOperationException("Ownable synchronizer usage " + - "monitoring is not provided " + - "by this VM."); + "monitoring is not provided " + + "by this VM."); return VMThreadMXBeanImpl.findDeadlockedThreads(); } @@ -157,7 +157,7 @@ public final class ThreadMXBeanImpl { if (!isCurrentThreadCpuTimeSupported()) throw new UnsupportedOperationException("Current thread CPU " + - "time not supported."); + "time not supported."); if (!timeEnabled) return -1; return VMThreadMXBeanImpl.getCurrentThreadCpuTime(); @@ -167,7 +167,7 @@ public final class ThreadMXBeanImpl { if (!isCurrentThreadCpuTimeSupported()) throw new UnsupportedOperationException("Current thread user " + - "time not supported."); + "time not supported."); if (!timeEnabled) return -1; return VMThreadMXBeanImpl.getCurrentThreadUserTime(); @@ -192,7 +192,7 @@ public final class ThreadMXBeanImpl { if (!isThreadCpuTimeSupported()) throw new UnsupportedOperationException("Thread CPU time not " + - "supported."); + "supported."); if (id <= 0) throw new IllegalArgumentException("Invalid thread id: " + id); if (!timeEnabled) @@ -228,32 +228,32 @@ public final class ThreadMXBeanImpl ThreadInfo[] infos = new ThreadInfo[ids.length]; for (int a = 0; a < ids.length; ++a) { - if (ids[a] <= 0) - throw new IllegalArgumentException("Invalid thread id " + a + - ": " + ids[a]); - infos[a] = VMThreadMXBeanImpl.getThreadInfoForId(ids[a], maxDepth); + if (ids[a] <= 0) + throw new IllegalArgumentException("Invalid thread id " + a + + ": " + ids[a]); + infos[a] = VMThreadMXBeanImpl.getThreadInfoForId(ids[a], maxDepth); } return infos; } public ThreadInfo[] getThreadInfo(long[] ids, boolean lockedMonitors, - boolean lockedSynchronizers) + boolean lockedSynchronizers) { checkMonitorPermissions(); if (lockedMonitors && !isObjectMonitorUsageSupported()) throw new UnsupportedOperationException("Monitor usage monitoring is " + - "not provided by this VM."); + "not provided by this VM."); if (lockedSynchronizers && !isSynchronizerUsageSupported()) throw new UnsupportedOperationException("Ownable synchronizer usage " + - "monitoring is not provided " + - "by this VM."); + "monitoring is not provided " + + "by this VM."); ThreadInfo[] infos = getThreadInfo(ids, Integer.MAX_VALUE); if (lockedMonitors) for (ThreadInfo info : infos) - VMThreadMXBeanImpl.getMonitorInfo(info); + VMThreadMXBeanImpl.getMonitorInfo(info); if (lockedSynchronizers) for (ThreadInfo info : infos) - VMThreadMXBeanImpl.getLockInfo(info); + VMThreadMXBeanImpl.getLockInfo(info); return infos; } @@ -261,7 +261,7 @@ public final class ThreadMXBeanImpl { if (!isThreadCpuTimeSupported()) throw new UnsupportedOperationException("Thread user time not " + - "supported."); + "supported."); if (id <= 0) throw new IllegalArgumentException("Invalid thread id: " + id); if (!timeEnabled) @@ -297,7 +297,7 @@ public final class ThreadMXBeanImpl return contentionEnabled; else throw new UnsupportedOperationException("Contention monitoring " + - "not supported."); + "not supported."); } public boolean isThreadContentionMonitoringSupported() @@ -308,13 +308,13 @@ public final class ThreadMXBeanImpl public boolean isThreadCpuTimeEnabled() { if (isThreadCpuTimeSupported() || - isCurrentThreadCpuTimeSupported()) + isCurrentThreadCpuTimeSupported()) return timeEnabled; else throw new UnsupportedOperationException("Thread time not " + - "supported."); + "supported."); } - + public boolean isThreadCpuTimeSupported() { return SystemProperties.getProperty(THREAD_TIME_SUPPORT) != null; @@ -325,7 +325,7 @@ public final class ThreadMXBeanImpl checkControlPermissions(); VMThreadMXBeanImpl.resetPeakThreadCount(); } - + public void setThreadContentionMonitoringEnabled(boolean enable) { checkControlPermissions(); @@ -333,19 +333,18 @@ public final class ThreadMXBeanImpl contentionEnabled = enable; else throw new UnsupportedOperationException("Contention monitoring " + - "not supported."); - } - + "not supported."); + } + public void setThreadCpuTimeEnabled(boolean enable) { checkControlPermissions(); if (isThreadCpuTimeSupported() || - isCurrentThreadCpuTimeSupported()) + isCurrentThreadCpuTimeSupported()) timeEnabled = enable; else throw new UnsupportedOperationException("Thread time not " + - "supported."); + "supported."); } } - diff --git a/gnu/java/lang/reflect/TypeSignature.java b/gnu/java/lang/reflect/TypeSignature.java index 612058dbf..c0a3ab0a5 100644 --- a/gnu/java/lang/reflect/TypeSignature.java +++ b/gnu/java/lang/reflect/TypeSignature.java @@ -176,7 +176,7 @@ public class TypeSignature * @see #getClassForEncoding(String, boolean) */ public static Class getClassForEncoding(String type_code, boolean descriptor, - ClassLoader loader) + ClassLoader loader) throws ClassNotFoundException { if (descriptor) diff --git a/gnu/java/locale/LocaleHelper.java b/gnu/java/locale/LocaleHelper.java index f3aabbdd9..8b108768d 100644 --- a/gnu/java/locale/LocaleHelper.java +++ b/gnu/java/locale/LocaleHelper.java @@ -85,7 +85,7 @@ public class LocaleHelper int uscore = variant.indexOf('_'); if (uscore != -1) return new Locale(language, country, - variant.substring(0, uscore)); + variant.substring(0, uscore)); if (!variant.isEmpty()) return new Locale(language, country, ""); if (!country.isEmpty()) @@ -95,7 +95,7 @@ public class LocaleHelper /** * Return an array of all the locales for which there is a - * {@link Collator} instance. A new array is returned each time. + * {@link Collator} instance. A new array is returned each time. */ public static Locale[] getCollatorLocales() { @@ -145,4 +145,3 @@ public class LocaleHelper return LocaleData.localeNames[n]; } } - diff --git a/gnu/java/math/Fixed.java b/gnu/java/math/Fixed.java index ed4150b10..6b210deda 100644 --- a/gnu/java/math/Fixed.java +++ b/gnu/java/math/Fixed.java @@ -45,7 +45,7 @@ public final class Fixed { /** - * Private constructor to avoid instantiation. + * Private constructor to avoid instantiation. */ private Fixed() { @@ -138,7 +138,7 @@ public final class Fixed /** * Returns the fixed point value <code>a</code> with <code>n</code> digits * as float. - * + * * @param n the number of digits * @param a the fixed point value * @@ -152,7 +152,7 @@ public final class Fixed /** * Returns the fixed point value <code>a</code> with <code>n</code> digits * as double. - * + * * @param n the number of digits * @param a the fixed point value * @@ -194,7 +194,7 @@ public final class Fixed /** * Returns the integer value of the specified fixed point value * <code>a</code>. This simply cuts of the digits (== floor(a)). - * + * * @param n the number of digits * @param a the fixed point value * diff --git a/gnu/java/math/GMP.java b/gnu/java/math/GMP.java index 6fb49363d..4df790a40 100644 --- a/gnu/java/math/GMP.java +++ b/gnu/java/math/GMP.java @@ -7,7 +7,7 @@ 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 @@ -47,11 +47,11 @@ public final class GMP { private Pointer native_ptr; private int refCount = 1; - + public GMP() { super(); - + natInitialize(); } @@ -59,30 +59,30 @@ public final class GMP { refCount++; } - + private synchronized void releaseRef() { refCount--; if (refCount == 0) { - natFinalize(); - native_ptr = null; + natFinalize(); + native_ptr = null; } } - + protected void finalize() { releaseRef(); } - - + + public void fromByteArray(byte[] v) { acquireRef(); natFromByteArray(v); releaseRef(); } - + public void fromBI(GMP x) { acquireRef(); @@ -91,14 +91,14 @@ public final class GMP x.releaseRef(); releaseRef(); } - + public void fromLong(long n) { acquireRef(); natFromLong(n); releaseRef(); } - + public int fromString(String s, int rdx) { acquireRef(); @@ -106,14 +106,14 @@ public final class GMP releaseRef(); return result; } - + public void fromSignedMagnitude(byte[] m, boolean isNegative) { acquireRef(); natFromSignedMagnitude(m, isNegative); releaseRef(); } - + public String toString(int b) { acquireRef(); @@ -121,14 +121,14 @@ public final class GMP releaseRef(); return result; } - + public void toByteArray(byte[] r) { acquireRef(); natToByteArray(r); releaseRef(); } - + public double doubleValue() { acquireRef(); @@ -136,7 +136,7 @@ public final class GMP releaseRef(); return result; } - + public int absIntValue() { acquireRef(); @@ -144,7 +144,7 @@ public final class GMP releaseRef(); return result; } - + public int compare(GMP x) { acquireRef(); @@ -154,7 +154,7 @@ public final class GMP releaseRef(); return result; } - + public void add(GMP x, GMP r) { acquireRef(); @@ -165,7 +165,7 @@ public final class GMP x.releaseRef(); releaseRef(); } - + public void subtract(GMP x, GMP r) { acquireRef(); @@ -176,7 +176,7 @@ public final class GMP x.releaseRef(); releaseRef(); } - + public void multiply(GMP x, GMP r) { acquireRef(); @@ -187,7 +187,7 @@ public final class GMP x.releaseRef(); releaseRef(); } - + public void quotient(GMP x, GMP r) { acquireRef(); @@ -198,7 +198,7 @@ public final class GMP x.releaseRef(); releaseRef(); } - + public void remainder(GMP x, GMP r) { acquireRef(); @@ -209,7 +209,7 @@ public final class GMP x.releaseRef(); releaseRef(); } - + public void quotientAndRemainder(GMP x, GMP q, GMP r) { acquireRef(); @@ -222,7 +222,7 @@ public final class GMP x.releaseRef(); releaseRef(); } - + public void modulo(GMP x, GMP r) { acquireRef(); @@ -233,7 +233,7 @@ public final class GMP x.releaseRef(); releaseRef(); } - + public void pow(int n, GMP r) { acquireRef(); @@ -242,7 +242,7 @@ public final class GMP r.releaseRef(); releaseRef(); } - + public void modPow(GMP e, GMP m, GMP r) { acquireRef(); @@ -255,7 +255,7 @@ public final class GMP e.releaseRef(); releaseRef(); } - + public void modInverse(GMP m, GMP r) { acquireRef(); @@ -277,7 +277,7 @@ public final class GMP x.releaseRef(); releaseRef(); } - + public void shiftLeft(int n, GMP r) { acquireRef(); @@ -286,7 +286,7 @@ public final class GMP r.releaseRef(); releaseRef(); } - + public void shiftRight(int n, GMP r) { acquireRef(); @@ -295,7 +295,7 @@ public final class GMP r.releaseRef(); releaseRef(); } - + public void abs(GMP r) { acquireRef(); @@ -304,7 +304,7 @@ public final class GMP r.releaseRef(); releaseRef(); } - + public void negate(GMP r) { acquireRef(); @@ -313,7 +313,7 @@ public final class GMP r.releaseRef(); releaseRef(); } - + public int bitLength() { acquireRef(); @@ -321,7 +321,7 @@ public final class GMP releaseRef(); return result; } - + public int bitCount() { acquireRef(); @@ -329,7 +329,7 @@ public final class GMP releaseRef(); return result; } - + public void and(GMP x, GMP r) { acquireRef(); @@ -340,7 +340,7 @@ public final class GMP x.releaseRef(); releaseRef(); } - + public void or(GMP x, GMP r) { acquireRef(); @@ -351,7 +351,7 @@ public final class GMP x.releaseRef(); releaseRef(); } - + public void xor(GMP x, GMP r) { acquireRef(); @@ -362,7 +362,7 @@ public final class GMP x.releaseRef(); releaseRef(); } - + public void andNot(GMP x, GMP r) { acquireRef(); @@ -373,7 +373,7 @@ public final class GMP x.releaseRef(); releaseRef(); } - + public void not(GMP r) { acquireRef(); @@ -382,7 +382,7 @@ public final class GMP r.releaseRef(); releaseRef(); } - + public void flipBit(int n, GMP r) { acquireRef(); @@ -399,7 +399,7 @@ public final class GMP releaseRef(); return result; } - + public void setBit(int n, boolean setIt, GMP r) { acquireRef(); @@ -408,7 +408,7 @@ public final class GMP r.releaseRef(); releaseRef(); } - + public int testPrimality(int certainty) { acquireRef(); @@ -416,7 +416,7 @@ public final class GMP releaseRef(); return result; } - + public int lowestSetBit() { acquireRef(); @@ -424,25 +424,25 @@ public final class GMP releaseRef(); return result; } - + // Native methods ......................................................... - + public static native void natInitializeLibrary(); - + private native void natInitialize(); private native void natFinalize(); - + private native void natFromLong(long n); private native void natFromBI(Pointer x); private native void natFromByteArray(byte[] v); private native int natFromString(String s, int rdx); private native void natFromSignedMagnitude(byte[] m, boolean isNegative); - + private native String natToString(int base); private native void natToByteArray(byte[] r); private native int natAbsIntValue(); private native double natDoubleValue(); - + private native int natCompare(Pointer y); private native void natAdd(Pointer x, Pointer r); private native void natSubtract(Pointer x, Pointer r); diff --git a/gnu/java/math/MPN.java b/gnu/java/math/MPN.java index 05491bb7e..9143ef03b 100644 --- a/gnu/java/math/MPN.java +++ b/gnu/java/math/MPN.java @@ -7,7 +7,7 @@ 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 @@ -59,9 +59,9 @@ public class MPN long carry = (long) y & 0xffffffffL; for (int i = 0; i < size; i++) { - carry += ((long) x[i] & 0xffffffffL); - dest[i] = (int) carry; - carry >>= 32; + carry += ((long) x[i] & 0xffffffffL); + dest[i] = (int) carry; + carry >>= 32; } return (int) carry; } @@ -77,10 +77,10 @@ public class MPN long carry = 0; for (int i = 0; i < len; i++) { - carry += ((long) x[i] & 0xffffffffL) - + ((long) y[i] & 0xffffffffL); - dest[i] = (int) carry; - carry >>>= 32; + carry += ((long) x[i] & 0xffffffffL) + + ((long) y[i] & 0xffffffffL); + dest[i] = (int) carry; + carry >>>= 32; } return (int) carry; } @@ -96,15 +96,15 @@ public class MPN int cy = 0; for (int i = 0; i < size; i++) { - int y = Y[i]; - int x = X[i]; - y += cy; /* add previous carry to subtrahend */ - // Invert the high-order bit, because: (unsigned) X > (unsigned) Y - // iff: (int) (X^0x80000000) > (int) (Y^0x80000000). - cy = (y^0x80000000) < (cy^0x80000000) ? 1 : 0; - y = x - y; - cy += (y^0x80000000) > (x ^ 0x80000000) ? 1 : 0; - dest[i] = y; + int y = Y[i]; + int x = X[i]; + y += cy; /* add previous carry to subtrahend */ + // Invert the high-order bit, because: (unsigned) X > (unsigned) Y + // iff: (int) (X^0x80000000) > (int) (Y^0x80000000). + cy = (y^0x80000000) < (cy^0x80000000) ? 1 : 0; + y = x - y; + cy += (y^0x80000000) > (x ^ 0x80000000) ? 1 : 0; + dest[i] = y; } return cy; } @@ -142,23 +142,23 @@ public class MPN * This function is basically the same gmp's mpn_mul. */ public static void mul (int[] dest, - int[] x, int xlen, - int[] y, int ylen) + int[] x, int xlen, + int[] y, int ylen) { dest[xlen] = MPN.mul_1 (dest, x, xlen, y[0]); for (int i = 1; i < ylen; i++) { - long yword = (long) y[i] & 0xffffffffL; - long carry = 0; - for (int j = 0; j < xlen; j++) - { - carry += ((long) x[j] & 0xffffffffL) * yword - + ((long) dest[i+j] & 0xffffffffL); - dest[i+j] = (int) carry; - carry >>>= 32; - } - dest[i+xlen] = (int) carry; + long yword = (long) y[i] & 0xffffffffL; + long carry = 0; + for (int j = 0; j < xlen; j++) + { + carry += ((long) x[j] & 0xffffffffL) * yword + + ((long) dest[i+j] & 0xffffffffL); + dest[i+j] = (int) carry; + carry >>>= 32; + } + dest[i+xlen] = (int) carry; } } @@ -174,71 +174,71 @@ public class MPN long a0 = N & 0xffffffffL; if (D >= 0) { - if (a1 < ((D - a1 - (a0 >>> 31)) & 0xffffffffL)) - { - /* dividend, divisor, and quotient are nonnegative */ - q = N / D; - r = N % D; - } - else - { - /* Compute c1*2^32 + c0 = a1*2^32 + a0 - 2^31*d */ - long c = N - ((long) D << 31); - /* Divide (c1*2^32 + c0) by d */ - q = c / D; - r = c % D; - /* Add 2^31 to quotient */ - q += 1 << 31; - } + if (a1 < ((D - a1 - (a0 >>> 31)) & 0xffffffffL)) + { + /* dividend, divisor, and quotient are nonnegative */ + q = N / D; + r = N % D; + } + else + { + /* Compute c1*2^32 + c0 = a1*2^32 + a0 - 2^31*d */ + long c = N - ((long) D << 31); + /* Divide (c1*2^32 + c0) by d */ + q = c / D; + r = c % D; + /* Add 2^31 to quotient */ + q += 1 << 31; + } } else { - long b1 = D >>> 1; /* d/2, between 2^30 and 2^31 - 1 */ - //long c1 = (a1 >> 1); /* A/2 */ - //int c0 = (a1 << 31) + (a0 >> 1); - long c = N >>> 1; - if (a1 < b1 || (a1 >> 1) < b1) - { - if (a1 < b1) - { - q = c / b1; - r = c % b1; - } - else /* c1 < b1, so 2^31 <= (A/2)/b1 < 2^32 */ - { - c = ~(c - (b1 << 32)); - q = c / b1; /* (A/2) / (d/2) */ - r = c % b1; - q = (~q) & 0xffffffffL; /* (A/2)/b1 */ - r = (b1 - 1) - r; /* r < b1 => new r >= 0 */ - } - r = 2 * r + (a0 & 1); - if ((D & 1) != 0) - { - if (r >= q) { - r = r - q; - } else if (q - r <= ((long) D & 0xffffffffL)) { + long b1 = D >>> 1; /* d/2, between 2^30 and 2^31 - 1 */ + //long c1 = (a1 >> 1); /* A/2 */ + //int c0 = (a1 << 31) + (a0 >> 1); + long c = N >>> 1; + if (a1 < b1 || (a1 >> 1) < b1) + { + if (a1 < b1) + { + q = c / b1; + r = c % b1; + } + else /* c1 < b1, so 2^31 <= (A/2)/b1 < 2^32 */ + { + c = ~(c - (b1 << 32)); + q = c / b1; /* (A/2) / (d/2) */ + r = c % b1; + q = (~q) & 0xffffffffL; /* (A/2)/b1 */ + r = (b1 - 1) - r; /* r < b1 => new r >= 0 */ + } + r = 2 * r + (a0 & 1); + if ((D & 1) != 0) + { + if (r >= q) { + r = r - q; + } else if (q - r <= ((long) D & 0xffffffffL)) { r = r - q + D; - q -= 1; - } else { + q -= 1; + } else { r = r - q + D + D; - q -= 2; - } - } - } - else /* Implies c1 = b1 */ - { /* Hence a1 = d - 1 = 2*b1 - 1 */ - if (a0 >= ((long)(-D) & 0xffffffffL)) - { - q = -1; - r = a0 + D; - } - else - { - q = -2; - r = a0 + D + D; - } - } + q -= 2; + } + } + } + else /* Implies c1 = b1 */ + { /* Hence a1 = d - 1 = 2*b1 - 1 */ + if (a0 >= ((long)(-D) & 0xffffffffL)) + { + q = -1; + r = a0 + D; + } + else + { + q = -2; + r = a0 + D + D; + } + } } return (r << 32) | (q & 0xFFFFFFFFl); @@ -251,7 +251,7 @@ public class MPN */ public static int divmod_1 (int[] quotient, int[] dividend, - int len, int divisor) + int len, int divisor) { int i = len - 1; long r = dividend[i]; @@ -259,16 +259,16 @@ public class MPN r = 0; else { - quotient[i--] = 0; - r <<= 32; + quotient[i--] = 0; + r <<= 32; } for (; i >= 0; i--) { - int n0 = dividend[i]; - r = (r & ~0xffffffffL) | (n0 & 0xffffffffL); - r = udiv_qrnnd (r, divisor); - quotient[i] = (int) r; + int n0 = dividend[i]; + r = (r & ~0xffffffffL) | (n0 & 0xffffffffL); + r = udiv_qrnnd (r, divisor); + quotient[i] = (int) r; } return (int)(r >> 32); } @@ -285,19 +285,19 @@ public class MPN int j = 0; do { - long prod = ((long) x[j] & 0xffffffffL) * yl; - int prod_low = (int) prod; - int prod_high = (int) (prod >> 32); - prod_low += carry; - // Invert the high-order bit, because: (unsigned) X > (unsigned) Y - // iff: (int) (X^0x80000000) > (int) (Y^0x80000000). - carry = ((prod_low ^ 0x80000000) < (carry ^ 0x80000000) ? 1 : 0) - + prod_high; - int x_j = dest[offset+j]; - prod_low = x_j - prod_low; - if ((prod_low ^ 0x80000000) > (x_j ^ 0x80000000)) - carry++; - dest[offset+j] = prod_low; + long prod = ((long) x[j] & 0xffffffffL) * yl; + int prod_low = (int) prod; + int prod_high = (int) (prod >> 32); + prod_low += carry; + // Invert the high-order bit, because: (unsigned) X > (unsigned) Y + // iff: (int) (X^0x80000000) > (int) (Y^0x80000000). + carry = ((prod_low ^ 0x80000000) < (carry ^ 0x80000000) ? 1 : 0) + + prod_high; + int x_j = dest[offset+j]; + prod_low = x_j - prod_low; + if ((prod_low ^ 0x80000000) > (x_j ^ 0x80000000)) + carry++; + dest[offset+j] = prod_low; } while (++j < len); return carry; @@ -328,37 +328,37 @@ public class MPN int j = nx; do { // loop over digits of quotient - // Knuth's j == our nx-j. - // Knuth's u[j:j+n] == our zds[j:j-ny]. - int qhat; // treated as unsigned - if (zds[j]==y[ny-1]) - qhat = -1; // 0xffffffff - else - { - long w = (((long)(zds[j])) << 32) + ((long)zds[j-1] & 0xffffffffL); - qhat = (int) udiv_qrnnd (w, y[ny-1]); - } - if (qhat != 0) - { - int borrow = submul_1 (zds, j - ny, y, ny, qhat); - int save = zds[j]; - long num = ((long)save&0xffffffffL) - ((long)borrow&0xffffffffL); + // Knuth's j == our nx-j. + // Knuth's u[j:j+n] == our zds[j:j-ny]. + int qhat; // treated as unsigned + if (zds[j]==y[ny-1]) + qhat = -1; // 0xffffffff + else + { + long w = (((long)(zds[j])) << 32) + ((long)zds[j-1] & 0xffffffffL); + qhat = (int) udiv_qrnnd (w, y[ny-1]); + } + if (qhat != 0) + { + int borrow = submul_1 (zds, j - ny, y, ny, qhat); + int save = zds[j]; + long num = ((long)save&0xffffffffL) - ((long)borrow&0xffffffffL); while (num != 0) - { - qhat--; - long carry = 0; - for (int i = 0; i < ny; i++) - { - carry += ((long) zds[j-ny+i] & 0xffffffffL) - + ((long) y[i] & 0xffffffffL); - zds[j-ny+i] = (int) carry; - carry >>>= 32; - } - zds[j] += carry; - num = carry - 1; - } - } - zds[j] = qhat; + { + qhat--; + long carry = 0; + for (int i = 0; i < ny; i++) + { + carry += ((long) zds[j-ny+i] & 0xffffffffL) + + ((long) y[i] & 0xffffffffL); + zds[j-ny+i] = (int) carry; + carry >>>= 32; + } + zds[j] += carry; + num = carry - 1; + } + } + zds[j] = qhat; } while (--j >= ny); } @@ -372,19 +372,19 @@ public class MPN { if (radix < 10) { - if (radix < 8) - { - if (radix <= 2) - return 32; - else if (radix == 3) - return 20; - else if (radix == 4) - return 16; - else - return 18 - radix; - } - else - return 10; + if (radix < 8) + { + if (radix <= 2) + return 32; + else if (radix == 3) + return 20; + else if (radix == 4) + return 16; + else + return 18 - radix; + } + else + return 10; } else if (radix < 12) return 9; @@ -410,9 +410,9 @@ public class MPN for (int k = 16; k > 0; k = k >> 1) { int j = i >>> k; if (j == 0) - count += k; + count += k; else - i = j; + i = j; } return count; } @@ -422,61 +422,61 @@ public class MPN int size = 0; if ((base & (base - 1)) == 0) { - // The base is a power of 2. Read the input string from - // least to most significant character/digit. */ - - int next_bitpos = 0; - int bits_per_indigit = 0; - for (int i = base; (i >>= 1) != 0; ) bits_per_indigit++; - int res_digit = 0; - - for (int i = str_len; --i >= 0; ) - { - int inp_digit = str[i]; - res_digit |= inp_digit << next_bitpos; - next_bitpos += bits_per_indigit; - if (next_bitpos >= 32) - { - dest[size++] = res_digit; - next_bitpos -= 32; - res_digit = inp_digit >> (bits_per_indigit - next_bitpos); - } - } - - if (res_digit != 0) - dest[size++] = res_digit; + // The base is a power of 2. Read the input string from + // least to most significant character/digit. */ + + int next_bitpos = 0; + int bits_per_indigit = 0; + for (int i = base; (i >>= 1) != 0; ) bits_per_indigit++; + int res_digit = 0; + + for (int i = str_len; --i >= 0; ) + { + int inp_digit = str[i]; + res_digit |= inp_digit << next_bitpos; + next_bitpos += bits_per_indigit; + if (next_bitpos >= 32) + { + dest[size++] = res_digit; + next_bitpos -= 32; + res_digit = inp_digit >> (bits_per_indigit - next_bitpos); + } + } + + if (res_digit != 0) + dest[size++] = res_digit; } else { - // General case. The base is not a power of 2. - int indigits_per_limb = MPN.chars_per_word (base); - int str_pos = 0; - - while (str_pos < str_len) - { - int chunk = str_len - str_pos; - if (chunk > indigits_per_limb) - chunk = indigits_per_limb; - int res_digit = str[str_pos++]; - int big_base = base; - - while (--chunk > 0) - { - res_digit = res_digit * base + str[str_pos++]; - big_base *= base; - } - - int cy_limb; - if (size == 0) - cy_limb = res_digit; - else - { - cy_limb = MPN.mul_1 (dest, dest, size, big_base); - cy_limb += MPN.add_1 (dest, dest, size, res_digit); - } - if (cy_limb != 0) - dest[size++] = cy_limb; - } + // General case. The base is not a power of 2. + int indigits_per_limb = MPN.chars_per_word (base); + int str_pos = 0; + + while (str_pos < str_len) + { + int chunk = str_len - str_pos; + if (chunk > indigits_per_limb) + chunk = indigits_per_limb; + int res_digit = str[str_pos++]; + int big_base = base; + + while (--chunk > 0) + { + res_digit = res_digit * base + str[str_pos++]; + big_base *= base; + } + + int cy_limb; + if (size == 0) + cy_limb = res_digit; + else + { + cy_limb = MPN.mul_1 (dest, dest, size, big_base); + cy_limb += MPN.add_1 (dest, dest, size, res_digit); + } + if (cy_limb != 0) + dest[size++] = cy_limb; + } } return size; } @@ -489,22 +489,22 @@ public class MPN { while (--size >= 0) { - int x_word = x[size]; - int y_word = y[size]; - if (x_word != y_word) - { - // Invert the high-order bit, because: - // (unsigned) X > (unsigned) Y iff - // (int) (X^0x80000000) > (int) (Y^0x80000000). - return (x_word ^ 0x80000000) > (y_word ^0x80000000) ? 1 : -1; - } + int x_word = x[size]; + int y_word = y[size]; + if (x_word != y_word) + { + // Invert the high-order bit, because: + // (unsigned) X > (unsigned) Y iff + // (int) (X^0x80000000) > (int) (Y^0x80000000). + return (x_word ^ 0x80000000) > (y_word ^0x80000000) ? 1 : -1; + } } return 0; } /** * Compare x[0:xlen-1] with y[0:ylen-1], treating them as unsigned integers. - * + * * @return -1, 0, or 1 depending on if x<y, x==y, or x>y. */ public static int cmp (int[] x, int xlen, int[] y, int ylen) @@ -521,7 +521,7 @@ public class MPN * Assumes: 0 < count < 32 */ public static int rshift (int[] dest, int[] x, int x_start, - int len, int count) + int len, int count) { int count_2 = 32 - count; int low_word = x[x_start]; @@ -529,9 +529,9 @@ public class MPN int i = 1; for (; i < len; i++) { - int high_word = x[x_start+i]; - dest[i-1] = (low_word >>> count) | (high_word << count_2); - low_word = high_word; + int high_word = x[x_start+i]; + dest[i-1] = (low_word >>> count) | (high_word << count_2); + low_word = high_word; } dest[i-1] = low_word >>> count; return retval; @@ -546,13 +546,13 @@ public class MPN * Same as rshift, but handles count==0 (and has no return value). */ public static void rshift0 (int[] dest, int[] x, int x_start, - int len, int count) + int len, int count) { if (count > 0) rshift(dest, x, x_start, len, count); else for (int i = 0; i < len; i++) - dest[i] = x[i + x_start]; + dest[i] = x[i + x_start]; } /** Return the long-truncated value of right shifting. @@ -571,10 +571,10 @@ public class MPN int w1 = wordno >= len ? sign : x[wordno]; if (count != 0) { - wordno++; - int w2 = wordno >= len ? sign : x[wordno]; - w0 = (w0 >>> count) | (w1 << (32-count)); - w1 = (w1 >>> count) | (w2 << (32-count)); + wordno++; + int w2 = wordno >= len ? sign : x[wordno]; + w0 = (w0 >>> count) | (w1 << (32-count)); + w1 = (w1 >>> count) | (w2 << (32-count)); } return ((long)w1 << 32) | ((long)w0 & 0xffffffffL); } @@ -587,7 +587,7 @@ public class MPN */ public static int lshift (int[] dest, int d_offset, - int[] x, int len, int count) + int[] x, int len, int count) { int count_2 = 32 - count; int i = len - 1; @@ -596,9 +596,9 @@ public class MPN d_offset++; while (--i >= 0) { - int low_word = x[i]; - dest[d_offset+i] = (high_word << count) | (low_word >>> count_2); - high_word = low_word; + int low_word = x[i]; + dest[d_offset+i] = (high_word << count) | (low_word >>> count_2); + high_word = low_word; } dest[d_offset+i] = high_word << count; return retval; @@ -611,13 +611,13 @@ public class MPN int i = 0; while ((word & 0xF) == 0) { - word >>= 4; - i += 4; + word >>= 4; + i += 4; } if ((word & 3) == 0) { - word >>= 2; - i += 2; + word >>= 2; + i += 2; } if ((word & 1) == 0) i += 1; @@ -630,8 +630,8 @@ public class MPN { for (int i = 0; ; i++) { - if (words[i] != 0) - return 32 * i + findLowestBit (words[i]); + if (words[i] != 0) + return 32 * i + findLowestBit (words[i]); } } @@ -646,12 +646,12 @@ public class MPN // Find sh such that both x and y are divisible by 2**sh. for (i = 0; ; i++) { - word = x[i] | y[i]; - if (word != 0) - { - // Must terminate, since x and y are non-zero. - break; - } + word = x[i] | y[i]; + if (word != 0) + { + // Must terminate, since x and y are non-zero. + break; + } } int initShiftWords = i; int initShiftBits = findLowestBit (word); @@ -666,69 +666,69 @@ public class MPN int[] other_arg; /* The other one can be even or odd. */ if ((x[0] & 1) != 0) { - odd_arg = x; - other_arg = y; + odd_arg = x; + other_arg = y; } else { - odd_arg = y; - other_arg = x; + odd_arg = y; + other_arg = x; } for (;;) { - // Shift other_arg until it is odd; this doesn't - // affect the gcd, since we divide by 2**k, which does not - // divide odd_arg. - for (i = 0; other_arg[i] == 0; ) i++; - if (i > 0) - { - int j; - for (j = 0; j < len-i; j++) - other_arg[j] = other_arg[j+i]; - for ( ; j < len; j++) - other_arg[j] = 0; - } - i = findLowestBit(other_arg[0]); - if (i > 0) - MPN.rshift (other_arg, other_arg, 0, len, i); - - // Now both odd_arg and other_arg are odd. - - // Subtract the smaller from the larger. - // This does not change the result, since gcd(a-b,b)==gcd(a,b). - i = MPN.cmp(odd_arg, other_arg, len); - if (i == 0) - break; - if (i > 0) - { // odd_arg > other_arg - MPN.sub_n (odd_arg, odd_arg, other_arg, len); - // Now odd_arg is even, so swap with other_arg; - int[] tmp = odd_arg; odd_arg = other_arg; other_arg = tmp; - } - else - { // other_arg > odd_arg - MPN.sub_n (other_arg, other_arg, odd_arg, len); - } - while (odd_arg[len-1] == 0 && other_arg[len-1] == 0) - len--; + // Shift other_arg until it is odd; this doesn't + // affect the gcd, since we divide by 2**k, which does not + // divide odd_arg. + for (i = 0; other_arg[i] == 0; ) i++; + if (i > 0) + { + int j; + for (j = 0; j < len-i; j++) + other_arg[j] = other_arg[j+i]; + for ( ; j < len; j++) + other_arg[j] = 0; + } + i = findLowestBit(other_arg[0]); + if (i > 0) + MPN.rshift (other_arg, other_arg, 0, len, i); + + // Now both odd_arg and other_arg are odd. + + // Subtract the smaller from the larger. + // This does not change the result, since gcd(a-b,b)==gcd(a,b). + i = MPN.cmp(odd_arg, other_arg, len); + if (i == 0) + break; + if (i > 0) + { // odd_arg > other_arg + MPN.sub_n (odd_arg, odd_arg, other_arg, len); + // Now odd_arg is even, so swap with other_arg; + int[] tmp = odd_arg; odd_arg = other_arg; other_arg = tmp; + } + else + { // other_arg > odd_arg + MPN.sub_n (other_arg, other_arg, odd_arg, len); + } + while (odd_arg[len-1] == 0 && other_arg[len-1] == 0) + len--; } if (initShiftWords + initShiftBits > 0) { - if (initShiftBits > 0) - { - int sh_out = MPN.lshift (x, initShiftWords, x, len, initShiftBits); - if (sh_out != 0) - x[(len++)+initShiftWords] = sh_out; - } - else - { - for (i = len; --i >= 0;) - x[i+initShiftWords] = x[i]; - } - for (i = initShiftWords; --i >= 0; ) - x[i] = 0; - len += initShiftWords; + if (initShiftBits > 0) + { + int sh_out = MPN.lshift (x, initShiftWords, x, len, initShiftBits); + if (sh_out != 0) + x[(len++)+initShiftWords] = sh_out; + } + else + { + for (i = len; --i >= 0;) + x[i+initShiftWords] = x[i]; + } + for (i = initShiftWords; --i >= 0; ) + x[i] = 0; + len += initShiftWords; } return len; } @@ -761,9 +761,9 @@ public class MPN ps.print('('); for (int i = 0; i < len; i++) { - if (i > 0) - ps.print (' '); - ps.print ("#x" + Long.toString ((long) x[i] & 0xffffffffL, 16)); + if (i > 0) + ps.print (' '); + ps.print ("#x" + Long.toString ((long) x[i] & 0xffffffffL, 16)); } ps.print(')'); } diff --git a/gnu/java/net/CRLFInputStream.java b/gnu/java/net/CRLFInputStream.java index ac3482679..5e394ae2c 100644 --- a/gnu/java/net/CRLFInputStream.java +++ b/gnu/java/net/CRLFInputStream.java @@ -7,7 +7,7 @@ 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 @@ -64,7 +64,7 @@ public class CRLFInputStream * The underlying input stream. */ protected InputStream in; - + private boolean doReset; /** @@ -100,7 +100,7 @@ public class CRLFInputStream } return c; } - + /** * Reads up to b.length bytes of data from this input stream into * an array of bytes. @@ -176,4 +176,3 @@ public class CRLFInputStream } } - diff --git a/gnu/java/net/CRLFOutputStream.java b/gnu/java/net/CRLFOutputStream.java index f27e0f218..0e9428373 100644 --- a/gnu/java/net/CRLFOutputStream.java +++ b/gnu/java/net/CRLFOutputStream.java @@ -7,7 +7,7 @@ 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 @@ -43,7 +43,7 @@ import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; -/** +/** * An output stream that filters LFs into CR/LF pairs. * * @author Chris Burdess (dog@gnu.org) @@ -105,7 +105,7 @@ public class CRLFOutputStream } last = ch; } - + /** * Writes a byte array to the underlying stream. * @exception IOException if an I/O error occurred @@ -150,7 +150,7 @@ public class CRLFOutputStream out.write (b, d, len - d); } } - + /** * Writes the specified ASCII string to the underlying stream. * @exception IOException if an I/O error occurred @@ -180,4 +180,3 @@ public class CRLFOutputStream out.write(CRLF, 0, 2); } } - diff --git a/gnu/java/net/DefaultContentHandlerFactory.java b/gnu/java/net/DefaultContentHandlerFactory.java index e3d1b8e5a..1d113b935 100644 --- a/gnu/java/net/DefaultContentHandlerFactory.java +++ b/gnu/java/net/DefaultContentHandlerFactory.java @@ -7,7 +7,7 @@ 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 @@ -49,7 +49,7 @@ import java.util.HashSet; class ImageHandler extends ContentHandler { static ImageHandler instance = new ImageHandler(); - + public Object getContent(URLConnection urlc) throws IOException { // FIXME: implement using ImageIO @@ -80,7 +80,7 @@ public class DefaultContentHandlerFactory implements ContentHandlerFactory "image/x-xbitmap", "image/x-xpixmap" }; - + private static HashSet<String> imageTypes = new HashSet<String>(Arrays.asList(known_image_types)); diff --git a/gnu/java/net/DefaultProxySelector.java b/gnu/java/net/DefaultProxySelector.java index 31f861e87..f0215a054 100644 --- a/gnu/java/net/DefaultProxySelector.java +++ b/gnu/java/net/DefaultProxySelector.java @@ -7,7 +7,7 @@ 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 @@ -50,13 +50,13 @@ public final class DefaultProxySelector extends ProxySelector { private static final List<Proxy> proxies = new ArrayList<Proxy>(); - + static { // The default proxy selector supports only direct connections. proxies.add(Proxy.NO_PROXY); } - + public DefaultProxySelector() { // Do nothing by default. @@ -69,7 +69,7 @@ public final class DefaultProxySelector // Do nothing by default. } - + public List<Proxy> select(URI uri) { if (uri == null) diff --git a/gnu/java/net/EmptyX509TrustManager.java b/gnu/java/net/EmptyX509TrustManager.java index b8faf41ad..466b49ef8 100644 --- a/gnu/java/net/EmptyX509TrustManager.java +++ b/gnu/java/net/EmptyX509TrustManager.java @@ -7,7 +7,7 @@ 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 @@ -67,4 +67,3 @@ public class EmptyX509TrustManager return new X509Certificate[0]; } } - diff --git a/gnu/java/net/GetLocalHostAction.java b/gnu/java/net/GetLocalHostAction.java index fa7601555..1e18877de 100644 --- a/gnu/java/net/GetLocalHostAction.java +++ b/gnu/java/net/GetLocalHostAction.java @@ -7,7 +7,7 @@ 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 @@ -62,4 +62,3 @@ public class GetLocalHostAction } } } - diff --git a/gnu/java/net/HeaderFieldHelper.java b/gnu/java/net/HeaderFieldHelper.java index a8d13ce15..ca3b9d2dd 100644 --- a/gnu/java/net/HeaderFieldHelper.java +++ b/gnu/java/net/HeaderFieldHelper.java @@ -1,4 +1,4 @@ -/* HeaderFieldHelper.java -- Helps manage headers fields +/* HeaderFieldHelper.java -- Helps manage headers fields Copyright (C) 1998, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -7,7 +7,7 @@ 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 @@ -105,12 +105,12 @@ public class HeaderFieldHelper try { - value = headerFieldValues.elementAt(headerFieldKeys.indexOf(key)); + value = headerFieldValues.elementAt(headerFieldKeys.indexOf(key)); } catch (ArrayIndexOutOfBoundsException e) { } - + return value; } @@ -121,8 +121,8 @@ public class HeaderFieldHelper for (int index = 0; index < max; index++) { - headers.put(headerFieldKeys.elementAt(index), - headerFieldValues.elementAt(index)); + headers.put(headerFieldKeys.elementAt(index), + headerFieldValues.elementAt(index)); } return headers; @@ -134,4 +134,3 @@ public class HeaderFieldHelper } } // class HeaderFieldHelper - diff --git a/gnu/java/net/IndexListParser.java b/gnu/java/net/IndexListParser.java index 2d90ceb64..bf274b172 100644 --- a/gnu/java/net/IndexListParser.java +++ b/gnu/java/net/IndexListParser.java @@ -1,4 +1,4 @@ -/* IndexListParser.java -- +/* IndexListParser.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -47,11 +47,11 @@ import java.util.Set; import java.util.jar.JarFile; /** - * The INDEX.LIST file contains sections each separated by a blank line. + * The INDEX.LIST file contains sections each separated by a blank line. * Each section defines the content of a jar, with a * header defining the jar file path name, followed by a list of paths. * The jar file paths are relative to the codebase of the root jar. - * + * Specification index file : version-info blankline section* version-info : JarIndex-Version: version-number @@ -60,7 +60,7 @@ import java.util.jar.JarFile; body : header name* header : char+.jar newline name : char+ newline - + * @author langel at redhat dot com */ public class IndexListParser @@ -73,10 +73,10 @@ public class IndexListParser // This is intentionally kept in insertion order. LinkedHashMap<URL, Set<String>> prefixes = new LinkedHashMap<URL, Set<String>>(); - + /** * Parses the given jarfile's INDEX.LIST file if it exists. - * + * * @param jarfile - the given jar file * @param baseJarURL - the codebase of the jar file * @param baseURL - the base url for the headers @@ -90,13 +90,13 @@ public class IndexListParser { BufferedReader br = new BufferedReader(new InputStreamReader(new URL(baseJarURL, JAR_INDEX_FILE).openStream())); - + // Must start with version info String line = br.readLine(); if (!line.startsWith(JAR_INDEX_VERSION_KEY)) return; versionNumber = Double.parseDouble(line.substring(JAR_INDEX_VERSION_KEY.length()).trim()); - + // Blank line must be next line = br.readLine(); if (! "".equals(line)) @@ -104,13 +104,13 @@ public class IndexListParser clearAll(); return; } - + // May contain sections. while ((line = br.readLine()) != null) { URL jarURL = new URL(baseURL, line); HashSet<String> values = new HashSet<String>(); - + // Read the names in the section. while ((line = br.readLine()) != null) { @@ -138,7 +138,7 @@ public class IndexListParser clearAll(); } } - + /** * Clears all the variables. This is called when parsing fails. */ @@ -147,33 +147,33 @@ public class IndexListParser versionNumber = 0; prefixes = null; } - + /** * Gets the version info for the file. - * + * * @return the version info. */ public String getVersionInfo() { return JAR_INDEX_VERSION_KEY + getVersionNumber(); } - + /** * Gets the version number of the file. - * + * * @return the version number. */ public double getVersionNumber() { return versionNumber; } - + /** * Gets the map of all the headers found in the file. * The keys in the map are URLs of jars. The values in the map * are Sets of package prefixes (and top-level file names), as * specifed in INDEX.LIST. - * + * * @return an map of all the headers, or null if no INDEX.LIST was found */ public LinkedHashMap<URL, Set<String>> getHeaders() diff --git a/gnu/java/net/LineInputStream.java b/gnu/java/net/LineInputStream.java index da307dbdd..8bd4b69cd 100644 --- a/gnu/java/net/LineInputStream.java +++ b/gnu/java/net/LineInputStream.java @@ -7,7 +7,7 @@ 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 @@ -56,7 +56,7 @@ public class LineInputStream * The underlying input stream. */ protected InputStream in; - + /* * Line buffer. */ @@ -112,7 +112,7 @@ public class LineInputStream { return in.read(buf); } - + public int read(byte[] buf, int off, int len) throws IOException { @@ -221,4 +221,3 @@ public class LineInputStream return -1; } } - diff --git a/gnu/java/net/PlainDatagramSocketImpl.java b/gnu/java/net/PlainDatagramSocketImpl.java index a84525e18..639c9ff55 100644 --- a/gnu/java/net/PlainDatagramSocketImpl.java +++ b/gnu/java/net/PlainDatagramSocketImpl.java @@ -7,7 +7,7 @@ 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 @@ -69,19 +69,19 @@ import java.nio.ByteBuffer; public final class PlainDatagramSocketImpl extends DatagramSocketImpl { private final VMChannel channel; - + /** * The platform-specific socket implementation. */ private final VMPlainSocketImpl impl; - + /** - * Lock object to serialize threads wanting to receive + * Lock object to serialize threads wanting to receive */ private final Object RECEIVE_LOCK = new Object(); - + /** - * Lock object to serialize threads wanting to send + * Lock object to serialize threads wanting to send */ private final Object SEND_LOCK = new Object(); @@ -99,7 +99,7 @@ public final class PlainDatagramSocketImpl extends DatagramSocketImpl synchronized (this) { if (channel.getState().isValid()) - close(); + close(); } super.finalize(); }*/ diff --git a/gnu/java/net/PlainSocketImpl.java b/gnu/java/net/PlainSocketImpl.java index 5bda0a5e9..72db53186 100644 --- a/gnu/java/net/PlainSocketImpl.java +++ b/gnu/java/net/PlainSocketImpl.java @@ -8,7 +8,7 @@ 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 @@ -93,13 +93,13 @@ public class PlainSocketImpl extends SocketImpl * is being invoked on this socket. */ private boolean inChannelOperation; - + /** * The socket channel we use for IO operation. Package-private for * use by inner classes. */ SocketChannelImpl channel; - + /** * Indicates whether we should ignore whether any associated * channel is set to non-blocking mode. Certain operations @@ -111,7 +111,7 @@ public class PlainSocketImpl extends SocketImpl { return inChannelOperation; } - + /** * Sets our indicator of whether an I/O operation is being * initiated by a channel. @@ -120,7 +120,7 @@ public class PlainSocketImpl extends SocketImpl { inChannelOperation = b; } - + /** * Default do nothing constructor. */ @@ -149,7 +149,7 @@ public class PlainSocketImpl extends SocketImpl case SO_BROADCAST: case SO_KEEPALIVE: case SO_OOBINLINE: - case TCP_NODELAY: + case TCP_NODELAY: case IP_TOS: case SO_RCVBUF: case SO_SNDBUF: @@ -188,7 +188,7 @@ public class PlainSocketImpl extends SocketImpl throw se; } } - + // This filters options which are invalid for TCP. switch (optionId) { @@ -197,7 +197,7 @@ public class PlainSocketImpl extends SocketImpl case SO_BROADCAST: case SO_KEEPALIVE: case SO_OOBINLINE: - case TCP_NODELAY: + case TCP_NODELAY: case IP_TOS: case SO_RCVBUF: case SO_SNDBUF: @@ -207,7 +207,7 @@ public class PlainSocketImpl extends SocketImpl default: throw new SocketException("Unrecognized TCP option: " + optionId); } - + } public void shutdownInput() throws IOException @@ -281,10 +281,10 @@ public class PlainSocketImpl extends SocketImpl boolean connected = channel.connect(address, timeout); if (!connected) throw new SocketTimeoutException("connect timed out"); - + // Using the given SocketAddress is important to preserve // hostnames given by the caller. - InetSocketAddress addr = (InetSocketAddress) address; + InetSocketAddress addr = (InetSocketAddress) address; this.address = addr.getAddress(); this.port = addr.getPort(); } @@ -314,7 +314,7 @@ public class PlainSocketImpl extends SocketImpl * number, additional connections will be refused. * * @param queuelen The length of the pending connection queue - * + * * @throws IOException If an error occurs */ protected synchronized void listen(int queuelen) @@ -324,7 +324,7 @@ public class PlainSocketImpl extends SocketImpl } /** - * Accepts a new connection on this socket and returns in in the + * Accepts a new connection on this socket and returns in in the * passed in SocketImpl. * * @param impl The SocketImpl object to accept this connection. @@ -349,7 +349,7 @@ public class PlainSocketImpl extends SocketImpl /** * Returns the number of bytes that the caller can read from this socket - * without blocking. + * without blocking. * * @return the number of readable bytes before blocking * @@ -377,7 +377,7 @@ public class PlainSocketImpl extends SocketImpl { if (impl.getState().isValid()) impl.close(); - + address = null; port = -1; } @@ -418,7 +418,7 @@ public class PlainSocketImpl extends SocketImpl return out; } - + public VMChannel getVMChannel() { if (channel == null) @@ -433,7 +433,7 @@ public class PlainSocketImpl extends SocketImpl { if (channel == null) return null; - + try { InetSocketAddress remote = channel.getVMChannel().getPeerAddress(); @@ -444,7 +444,7 @@ public class PlainSocketImpl extends SocketImpl // was created by the native layer (this preserves exact hostnames). if (address != null) return address; - + return remote.getAddress(); } catch (IOException ioe) @@ -472,7 +472,7 @@ public class PlainSocketImpl extends SocketImpl return -1; } } - + public InetSocketAddress getLocalAddress() { if (channel == null) @@ -494,7 +494,7 @@ public class PlainSocketImpl extends SocketImpl { if (channel == null) return -1; - + try { InetSocketAddress remote = channel.getVMChannel().getPeerAddress(); @@ -509,7 +509,7 @@ public class PlainSocketImpl extends SocketImpl } /** - * This class contains an implementation of <code>InputStream</code> for + * This class contains an implementation of <code>InputStream</code> for * sockets. It in an internal only class used by <code>PlainSocketImpl</code>. * * @author Nic Ferrier <nferrier@tapsellferrier.co.uk> @@ -536,7 +536,7 @@ public class PlainSocketImpl extends SocketImpl } /** - * Reads the next byte of data and returns it as an int. + * Reads the next byte of data and returns it as an int. * * @return The byte read (as an int) or -1 if end of stream); * @@ -599,8 +599,8 @@ public class PlainSocketImpl extends SocketImpl } /** - * This class is used internally by <code>PlainSocketImpl</code> to be the - * <code>OutputStream</code> subclass returned by its + * This class is used internally by <code>PlainSocketImpl</code> to be the + * <code>OutputStream</code> subclass returned by its * <code>getOutputStream method</code>. It expects only to be used in that * context. * @@ -623,7 +623,7 @@ public class PlainSocketImpl extends SocketImpl /** * Writes a byte (passed in as an int) to the given output stream - * + * * @param b The byte to write * * @exception IOException If an error occurs diff --git a/gnu/java/net/loader/FileResource.java b/gnu/java/net/loader/FileResource.java index 8071bbf91..471584023 100644 --- a/gnu/java/net/loader/FileResource.java +++ b/gnu/java/net/loader/FileResource.java @@ -79,4 +79,4 @@ public final class FileResource extends Resource throw ie; } } -}
\ No newline at end of file +} diff --git a/gnu/java/net/loader/FileURLLoader.java b/gnu/java/net/loader/FileURLLoader.java index 39d33a4e4..58b6dcf05 100644 --- a/gnu/java/net/loader/FileURLLoader.java +++ b/gnu/java/net/loader/FileURLLoader.java @@ -66,7 +66,7 @@ public final class FileURLLoader extends URLLoader /** get resource with the name "name" in the file url */ public Resource getResource(String name) { - try + try { // Make sure that all components in name are valid by walking through // them @@ -91,7 +91,7 @@ public final class FileURLLoader extends URLLoader * directory or a non directory component (plain file, symbolic link, ...). * An empty or null path is valid. Pathnames components are separated by * <code>File.separatorChar</code> - * + * * @param resourceFileName the name to be checked for validity. * @return the canonical file pointed by the resourceFileName or null if the * walking failed @@ -108,30 +108,30 @@ public final class FileURLLoader extends URLLoader for (int i = 0; i < tokenCount - 1; i++) { String currentToken = stringTokenizer.nextToken(); - + // If we are at the root directory and trying to go up, the walking is // finished with an error if ("..".equals(currentToken) && currentFile.equals(dir)) return null; - + currentFile = new File(currentFile, currentToken); // If the current file doesn't exist or is not a directory, the walking is // finished with an error if (! (currentFile.exists() && currentFile.isDirectory())) return null; - + } - + // Treat the last token differently, if it exists, because it does not need // to be a directory if (tokenCount > 0) { String currentToken = stringTokenizer.nextToken(); - + if ("..".equals(currentToken) && currentFile.equals(dir)) return null; - + currentFile = new File(currentFile, currentToken); // If the current file doesn't exist, the walking is @@ -139,7 +139,7 @@ public final class FileURLLoader extends URLLoader if (! currentFile.exists()) return null; } - + return currentFile.getCanonicalFile(); } -}
\ No newline at end of file +} diff --git a/gnu/java/net/loader/JarURLLoader.java b/gnu/java/net/loader/JarURLLoader.java index 40194be79..6f06ad3b2 100644 --- a/gnu/java/net/loader/JarURLLoader.java +++ b/gnu/java/net/loader/JarURLLoader.java @@ -83,7 +83,7 @@ public final class JarURLLoader extends URLLoader { jarfile = ((JarURLConnection) baseJarURL.openConnection()).getJarFile(); - + Manifest manifest; Attributes attributes; String classPathString; @@ -124,12 +124,12 @@ public final class JarURLLoader extends URLLoader else if ((manifest = jarfile.getManifest()) != null && (attributes = manifest.getMainAttributes()) != null && ((classPathString - = attributes.getValue(Attributes.Name.CLASS_PATH)) + = attributes.getValue(Attributes.Name.CLASS_PATH)) != null)) { this.classPath = new ArrayList<URLLoader>(); StringTokenizer st = new StringTokenizer(classPathString, " "); - while (st.hasMoreElements ()) + while (st.hasMoreElements ()) { String e = st.nextToken (); try diff --git a/gnu/java/net/loader/JarURLResource.java b/gnu/java/net/loader/JarURLResource.java index a9db5ce0b..1dec92fd3 100644 --- a/gnu/java/net/loader/JarURLResource.java +++ b/gnu/java/net/loader/JarURLResource.java @@ -91,4 +91,4 @@ public final class JarURLResource extends Resource throw ie; } } -}
\ No newline at end of file +} diff --git a/gnu/java/net/loader/RemoteResource.java b/gnu/java/net/loader/RemoteResource.java index f18031581..dc33b6636 100644 --- a/gnu/java/net/loader/RemoteResource.java +++ b/gnu/java/net/loader/RemoteResource.java @@ -75,4 +75,4 @@ public final class RemoteResource extends Resource { return url; } -}
\ No newline at end of file +} diff --git a/gnu/java/net/loader/RemoteURLLoader.java b/gnu/java/net/loader/RemoteURLLoader.java index f044740fa..81ef34f9e 100644 --- a/gnu/java/net/loader/RemoteURLLoader.java +++ b/gnu/java/net/loader/RemoteURLLoader.java @@ -98,4 +98,4 @@ public final class RemoteURLLoader extends URLLoader return null; } } -}
\ No newline at end of file +} diff --git a/gnu/java/net/loader/Resource.java b/gnu/java/net/loader/Resource.java index e367a3388..53720b039 100644 --- a/gnu/java/net/loader/Resource.java +++ b/gnu/java/net/loader/Resource.java @@ -107,4 +107,4 @@ public abstract class Resource * this resource can be loaded. */ public abstract InputStream getInputStream() throws IOException; -}
\ No newline at end of file +} diff --git a/gnu/java/net/loader/URLLoader.java b/gnu/java/net/loader/URLLoader.java index 5b9b6748b..337564f6a 100644 --- a/gnu/java/net/loader/URLLoader.java +++ b/gnu/java/net/loader/URLLoader.java @@ -145,4 +145,4 @@ public abstract class URLLoader { return null; } -}
\ No newline at end of file +} diff --git a/gnu/java/net/protocol/file/Connection.java b/gnu/java/net/protocol/file/Connection.java index 04278d46a..80155af0d 100644 --- a/gnu/java/net/protocol/file/Connection.java +++ b/gnu/java/net/protocol/file/Connection.java @@ -7,7 +7,7 @@ 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 @@ -89,7 +89,7 @@ public class Connection extends URLConnection SystemProperties.getProperty("line.separator"); } - + /** * This is a File object for this connection */ @@ -109,7 +109,7 @@ public class Connection extends URLConnection * OutputStream if we are writing to the file */ private OutputStream outputStream; - + /** * FilePermission to read the file */ @@ -124,7 +124,7 @@ public class Connection extends URLConnection permission = new FilePermission(getURL().getFile(), DEFAULT_PERMISSION); } - + /** * Unquote "%" + hex quotes characters * @@ -146,38 +146,38 @@ public class Connection extends URLConnection int pos = 0; for (int i = 0; i < str.length(); i++) { - char c = str.charAt(i); - if (c == '%') - { - if (i + 2 >= str.length()) - throw new MalformedURLException(str + " : Invalid quoted character"); - int hi = Character.digit(str.charAt(++i), 16); - int lo = Character.digit(str.charAt(++i), 16); - if (lo < 0 || hi < 0) - throw new MalformedURLException(str + " : Invalid quoted character"); - buf[pos++] = (byte) (hi * 16 + lo); - } - else if (c > 127) { - try { - byte [] c_as_bytes = Character.toString(c).getBytes("utf-8"); - final int c_length = c_as_bytes.length; - System.arraycopy(c_as_bytes, 0, buf, pos, c_length); - pos += c_length; - } - catch (java.io.UnsupportedEncodingException x2) { - throw (Error) new InternalError().initCause(x2); - } - } - else - buf[pos++] = (byte) c; + char c = str.charAt(i); + if (c == '%') + { + if (i + 2 >= str.length()) + throw new MalformedURLException(str + " : Invalid quoted character"); + int hi = Character.digit(str.charAt(++i), 16); + int lo = Character.digit(str.charAt(++i), 16); + if (lo < 0 || hi < 0) + throw new MalformedURLException(str + " : Invalid quoted character"); + buf[pos++] = (byte) (hi * 16 + lo); + } + else if (c > 127) { + try { + byte [] c_as_bytes = Character.toString(c).getBytes("utf-8"); + final int c_length = c_as_bytes.length; + System.arraycopy(c_as_bytes, 0, buf, pos, c_length); + pos += c_length; + } + catch (java.io.UnsupportedEncodingException x2) { + throw (Error) new InternalError().initCause(x2); + } + } + else + buf[pos++] = (byte) c; } try { - return new String(buf, 0, pos, "utf-8"); + return new String(buf, 0, pos, "utf-8"); } catch (java.io.UnsupportedEncodingException x2) { - throw (Error) new InternalError().initCause(x2); + throw (Error) new InternalError().initCause(x2); } } @@ -189,30 +189,30 @@ public class Connection extends URLConnection // Call is ignored if already connected. if (connected) return; - + // If not connected, then file needs to be openned. file = new File (unquote(getURL().getFile())); if (! file.isDirectory()) { - if (doInput) - inputStream = new BufferedInputStream(new FileInputStream(file)); - - if (doOutput) - outputStream = new BufferedOutputStream(new FileOutputStream(file)); + if (doInput) + inputStream = new BufferedInputStream(new FileInputStream(file)); + + if (doOutput) + outputStream = new BufferedOutputStream(new FileOutputStream(file)); } else { - if (doInput) - { + if (doInput) + { inputStream = new ByteArrayInputStream(getDirectoryListing()); - } + } - if (doOutput) - throw new ProtocolException - ("file: protocol does not support output on directories"); + if (doOutput) + throw new ProtocolException + ("file: protocol does not support output on directories"); } - + connected = true; } @@ -228,9 +228,9 @@ public class Connection extends URLConnection ByteArrayOutputStream sink = new ByteArrayOutputStream(); // NB uses default character encoding for this system Writer writer = new OutputStreamWriter(sink); - + String[] files = file.list(); - + for (int i = 0; i < files.length; i++) { writer.write(files[i]); @@ -239,9 +239,9 @@ public class Connection extends URLConnection directoryListing = sink.toByteArray(); } - return directoryListing; + return directoryListing; } - + /** * Opens the file for reading and returns a stream for it. * @@ -254,10 +254,10 @@ public class Connection extends URLConnection { if (!doInput) throw new ProtocolException("Can't open InputStream if doInput is false"); - + if (!connected) connect(); - + return inputStream; } @@ -273,11 +273,11 @@ public class Connection extends URLConnection { if (!doOutput) throw new - ProtocolException("Can't open OutputStream if doOutput is false"); + ProtocolException("Can't open OutputStream if doOutput is false"); if (!connected) connect(); - + return outputStream; } @@ -290,30 +290,30 @@ public class Connection extends URLConnection { try { - if (!connected) - connect(); + if (!connected) + connect(); - return file.lastModified(); + return file.lastModified(); } catch (IOException e) { - return -1; + return -1; } } - + /** - * Get an http-style header field. Just handle a few common ones. + * Get an http-style header field. Just handle a few common ones. */ public String getHeaderField(String field) { try { - if (!connected) - connect(); + if (!connected) + connect(); - if (field.equals("content-type")) + if (field.equals("content-type")) return guessContentTypeFromName(file.getName()); - else if (field.equals("content-length")) + else if (field.equals("content-length")) { if (file.isDirectory()) { @@ -321,14 +321,14 @@ public class Connection extends URLConnection } return Long.toString(file.length()); } - else if (field.equals("last-modified")) - { - synchronized (StaticData.dateFormat) - { - return StaticData.dateFormat.format( + else if (field.equals("last-modified")) + { + synchronized (StaticData.dateFormat) + { + return StaticData.dateFormat.format( new Date(file.lastModified())); - } - } + } + } } catch (IOException e) { @@ -346,21 +346,21 @@ public class Connection extends URLConnection { try { - if (!connected) - connect(); - + if (!connected) + connect(); + if (file.isDirectory()) { return getDirectoryListing().length; } - return (int) file.length(); + return (int) file.length(); } catch (IOException e) { - return -1; + return -1; } } - + /** * This method returns a <code>Permission</code> object representing the * permissions required to access this URL. This method returns a diff --git a/gnu/java/net/protocol/file/Handler.java b/gnu/java/net/protocol/file/Handler.java index fc560491d..58ebe4c46 100644 --- a/gnu/java/net/protocol/file/Handler.java +++ b/gnu/java/net/protocol/file/Handler.java @@ -76,14 +76,14 @@ public class Handler extends URLStreamHandler String host = url.getHost(); if ((host != null) && (! host.equals(""))) { - // Reset the protocol (and implicitly the handler) for this URL. - // Then have the URL attempt the connection again, as it will - // get the changed handler the next time around. - // If the ftp protocol handler is not installed, an - // exception will be thrown from the new openConnection() call. - setURL (url, "ftp", url.getHost(), url.getPort(), url.getFile(), - url.getRef()); - return url.openConnection(); + // Reset the protocol (and implicitly the handler) for this URL. + // Then have the URL attempt the connection again, as it will + // get the changed handler the next time around. + // If the ftp protocol handler is not installed, an + // exception will be thrown from the new openConnection() call. + setURL (url, "ftp", url.getHost(), url.getPort(), url.getFile(), + url.getRef()); + return url.openConnection(); } return new Connection(url); diff --git a/gnu/java/net/protocol/ftp/ActiveModeDTP.java b/gnu/java/net/protocol/ftp/ActiveModeDTP.java index aa3c412b6..1ed31b830 100644 --- a/gnu/java/net/protocol/ftp/ActiveModeDTP.java +++ b/gnu/java/net/protocol/ftp/ActiveModeDTP.java @@ -7,7 +7,7 @@ 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 @@ -128,7 +128,7 @@ final class ActiveModeDTP } acceptThread = null; } - + /** * Returns an input stream from which a remote file can be read. */ @@ -213,7 +213,7 @@ final class ActiveModeDTP transferComplete(); return inProgress; } - + public void transferComplete() { if (socket == null) @@ -247,6 +247,5 @@ final class ActiveModeDTP } } } - -} +} diff --git a/gnu/java/net/protocol/ftp/BlockInputStream.java b/gnu/java/net/protocol/ftp/BlockInputStream.java index 63897f1d6..09915e7ff 100644 --- a/gnu/java/net/protocol/ftp/BlockInputStream.java +++ b/gnu/java/net/protocol/ftp/BlockInputStream.java @@ -7,7 +7,7 @@ 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 @@ -147,4 +147,3 @@ class BlockInputStream } } - diff --git a/gnu/java/net/protocol/ftp/BlockOutputStream.java b/gnu/java/net/protocol/ftp/BlockOutputStream.java index 85481c95b..d181f9dec 100644 --- a/gnu/java/net/protocol/ftp/BlockOutputStream.java +++ b/gnu/java/net/protocol/ftp/BlockOutputStream.java @@ -7,7 +7,7 @@ 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 @@ -108,4 +108,3 @@ class BlockOutputStream } } - diff --git a/gnu/java/net/protocol/ftp/CompressedInputStream.java b/gnu/java/net/protocol/ftp/CompressedInputStream.java index f2e65b7d3..638d780e6 100644 --- a/gnu/java/net/protocol/ftp/CompressedInputStream.java +++ b/gnu/java/net/protocol/ftp/CompressedInputStream.java @@ -7,7 +7,7 @@ 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 @@ -133,13 +133,13 @@ class CompressedInputStream n--; return c; } - + public int read(byte[] buf) throws IOException { return read(buf, 0, buf.length); } - + public int read(byte[] buf, int off, int len) throws IOException { @@ -186,7 +186,7 @@ class CompressedInputStream return l; */ } - + /** * Reads the block header. */ @@ -212,4 +212,3 @@ class CompressedInputStream } } - diff --git a/gnu/java/net/protocol/ftp/CompressedOutputStream.java b/gnu/java/net/protocol/ftp/CompressedOutputStream.java index b960fb3af..ec3aef930 100644 --- a/gnu/java/net/protocol/ftp/CompressedOutputStream.java +++ b/gnu/java/net/protocol/ftp/CompressedOutputStream.java @@ -7,7 +7,7 @@ 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 @@ -57,7 +57,7 @@ class CompressedOutputStream { super(dtp, out); } - + /** * Just one byte cannot be compressed. * It takes 5 bytes to transmit - hardly very compressed! @@ -190,7 +190,7 @@ class CompressedOutputStream System.arraycopy(buf, 0, ret, 3, pos); return ret; } - + int flush_compressed(byte[] buf, int pos, int count, byte c) { buf[pos++] = (byte) (0x80 | count); @@ -225,4 +225,3 @@ class CompressedOutputStream } } - diff --git a/gnu/java/net/protocol/ftp/DTP.java b/gnu/java/net/protocol/ftp/DTP.java index 25580af40..9ba4b7c6c 100644 --- a/gnu/java/net/protocol/ftp/DTP.java +++ b/gnu/java/net/protocol/ftp/DTP.java @@ -7,7 +7,7 @@ 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 @@ -89,4 +89,3 @@ interface DTP void transferComplete(); } - diff --git a/gnu/java/net/protocol/ftp/DTPInputStream.java b/gnu/java/net/protocol/ftp/DTPInputStream.java index 363a5590f..7280b0133 100644 --- a/gnu/java/net/protocol/ftp/DTPInputStream.java +++ b/gnu/java/net/protocol/ftp/DTPInputStream.java @@ -7,7 +7,7 @@ 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 @@ -74,7 +74,7 @@ abstract class DTPInputStream { transferComplete = flag; } - + /** * Notifies the controlling DTP that this stream has completed transfer. */ @@ -85,4 +85,3 @@ abstract class DTPInputStream } } - diff --git a/gnu/java/net/protocol/ftp/DTPOutputStream.java b/gnu/java/net/protocol/ftp/DTPOutputStream.java index 83f0be1e3..105c6f095 100644 --- a/gnu/java/net/protocol/ftp/DTPOutputStream.java +++ b/gnu/java/net/protocol/ftp/DTPOutputStream.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/net/protocol/ftp/FTPConnection.java b/gnu/java/net/protocol/ftp/FTPConnection.java index 98e8a868d..4e253fcb9 100644 --- a/gnu/java/net/protocol/ftp/FTPConnection.java +++ b/gnu/java/net/protocol/ftp/FTPConnection.java @@ -7,7 +7,7 @@ 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 @@ -125,7 +125,7 @@ public class FTPConnection protected static final String STAT = "STAT"; protected static final String HELP = "HELP"; protected static final String NOOP = "NOOP"; - + protected static final String AUTH = "AUTH"; protected static final String PBSZ = "PBSZ"; protected static final String PROT = "PROT"; @@ -211,7 +211,7 @@ public class FTPConnection { this(hostname, -1, 0, 0, false); } - + /** * Creates a new connection to the server. * @param hostname the hostname of the server to connect to @@ -242,7 +242,7 @@ public class FTPConnection { port = FTP_PORT; } - + // Set up socket socket = new Socket(); InetSocketAddress address = new InetSocketAddress(hostname, port); @@ -258,7 +258,7 @@ public class FTPConnection { socket.setSoTimeout(timeout); } - + InputStream in = socket.getInputStream(); in = new BufferedInputStream(in); in = new CRLFInputStream(in); @@ -266,7 +266,7 @@ public class FTPConnection OutputStream out = socket.getOutputStream(); out = new BufferedOutputStream(out); this.out = new CRLFOutputStream(out); - + // Read greeting FTPResponse response = getResponse(); switch (response.getCode()) @@ -277,7 +277,7 @@ public class FTPConnection throw new FTPException(response); } } - + /** * Authenticate using the specified username and password. * If the username suffices for the server, the password will not be used @@ -331,7 +331,7 @@ public class FTPConnection { return starttls(confidential, new EmptyX509TrustManager()); } - + /** * Negotiates TLS over the current connection. * See IETF draft-murray-auth-ftp-ssl-15.txt for details. @@ -351,7 +351,7 @@ public class FTPConnection TrustManager[] trust = new TrustManager[] { tm }; context.init(null, trust, null); SSLSocketFactory factory = context.getSocketFactory(); - + send(AUTH + ' ' + TLS); FTPResponse response = getResponse(); switch (response.getCode()) @@ -367,7 +367,7 @@ public class FTPConnection default: throw new FTPException(response); } - + String hostname = socket.getInetAddress().getHostName(); int port = socket.getPort(); SSLSocket ss = @@ -403,7 +403,7 @@ public class FTPConnection default: throw new FTPException(response); } - + if (confidential) { // Set up streams @@ -422,7 +422,7 @@ public class FTPConnection return false; } } - + /** * Changes directory to the specified path. * @param path an absolute or relative pathname @@ -447,7 +447,7 @@ public class FTPConnection throw new FTPException(response); } } - + /** * Changes directory to the parent of the current working directory. * @return true on success, false otherwise @@ -521,7 +521,7 @@ public class FTPConnection { } } - + /** * Initialise the data transfer process. */ @@ -533,7 +533,7 @@ public class FTPConnection dtp.complete(); dtp = null; } - + InetAddress localhost = socket.getLocalAddress(); if (passive) { @@ -568,7 +568,7 @@ public class FTPConnection { c = message.charAt((++end) + 1); } - + String address = message.substring(start, mid1).replace(',', '.'); int port_hi = @@ -576,7 +576,7 @@ public class FTPConnection int port_lo = Integer.parseInt(message.substring(mid2 + 1, end + 1)); int port = (port_hi << 8) | port_lo; - + /*System.out.println("Entering passive mode: " + address + ":" + port);*/ dtp = new PassiveModeDTP(address, port, localhost, @@ -621,7 +621,7 @@ public class FTPConnection } } } - + // Send PORT command CPStringBuilder buf = new CPStringBuilder(PORT); buf.append(' '); @@ -657,7 +657,7 @@ public class FTPConnection } dtp.setTransferMode(transferMode); } - + /** * Set passive mode. * @param flag true if we should use passive mode, false otherwise @@ -671,7 +671,7 @@ public class FTPConnection initialiseDTP(); } } - + /** * Returns the current representation type of the transfer data. * @return TYPE_ASCII, TYPE_EBCDIC, or TYPE_BINARY @@ -809,7 +809,7 @@ public class FTPConnection throw new FTPException(response); } } - + /** * Retrieves the specified file. * @param filename the filename of the file to retrieve @@ -849,7 +849,7 @@ public class FTPConnection throw new FTPException(response); } } - + /** * Returns a stream for uploading a file. * If a file with the same filename already exists on the server, it will @@ -903,7 +903,7 @@ public class FTPConnection throw new FTPException(response); } } - + /** * This command may be required by some servers to reserve sufficient * storage to accommodate the new file to be transferred. @@ -926,7 +926,7 @@ public class FTPConnection throw new FTPException(response); } } - + /** * Renames a file. * @param oldName the current name of the file @@ -963,7 +963,7 @@ public class FTPConnection throw new FTPException(response); } } - + /** * Aborts the transfer in progress. * @return true if a transfer was in progress, false otherwise @@ -993,7 +993,7 @@ public class FTPConnection throw new FTPException(response); } } - + /** * Causes the file specified to be deleted at the server site. * @param filename the file to delete @@ -1015,7 +1015,7 @@ public class FTPConnection throw new FTPException(response); } } - + /** * Causes the directory specified to be deleted. * This may be an absolute or relative pathname. @@ -1059,7 +1059,7 @@ public class FTPConnection throw new FTPException(response); } } - + /** * Returns the current working directory. */ @@ -1097,7 +1097,7 @@ public class FTPConnection throw new FTPException(response); } } - + /** * Returns a listing of information about the specified pathname. * If the pathname specifies a directory or other group of files, the @@ -1133,7 +1133,7 @@ public class FTPConnection throw new FTPException(response); } } - + /** * Returns a directory listing. The pathname should specify a * directory or other system-specific file group descriptor; a null @@ -1179,7 +1179,7 @@ public class FTPConnection throw new FTPException(response); } } - + /** * Returns the type of operating system at the server. */ @@ -1205,7 +1205,7 @@ public class FTPConnection throw new FTPException(response); } } - + /** * Does nothing. * This method can be used to ensure that the connection does not time @@ -1316,7 +1316,7 @@ public class FTPConnection throw new ProtocolException(line); } } - + /* * Parses the 3-digit numeric code at the beginning of the given line. * Returns -1 on failure. @@ -1350,4 +1350,3 @@ public class FTPConnection } } - diff --git a/gnu/java/net/protocol/ftp/FTPException.java b/gnu/java/net/protocol/ftp/FTPException.java index 14ad3813f..1a7fcb85d 100644 --- a/gnu/java/net/protocol/ftp/FTPException.java +++ b/gnu/java/net/protocol/ftp/FTPException.java @@ -7,7 +7,7 @@ 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 @@ -63,7 +63,7 @@ public class FTPException super(response.getMessage()); this.response = response; } - + /** * Returns the response that provoked this exception. */ @@ -73,4 +73,3 @@ public class FTPException } } - diff --git a/gnu/java/net/protocol/ftp/FTPResponse.java b/gnu/java/net/protocol/ftp/FTPResponse.java index ec72c732c..2620f0d70 100644 --- a/gnu/java/net/protocol/ftp/FTPResponse.java +++ b/gnu/java/net/protocol/ftp/FTPResponse.java @@ -7,7 +7,7 @@ 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 @@ -109,4 +109,3 @@ public final class FTPResponse } } - diff --git a/gnu/java/net/protocol/ftp/FTPURLConnection.java b/gnu/java/net/protocol/ftp/FTPURLConnection.java index cfad5a7c1..8cc1fafd1 100644 --- a/gnu/java/net/protocol/ftp/FTPURLConnection.java +++ b/gnu/java/net/protocol/ftp/FTPURLConnection.java @@ -7,7 +7,7 @@ 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 @@ -137,7 +137,7 @@ public class FTPURLConnection connection.setTransferMode(transferMode); } } - + /** * This connection supports doInput. */ @@ -153,7 +153,7 @@ public class FTPURLConnection { doOutput = dooutput; } - + /** * Returns an input stream that reads from this open connection. */ @@ -174,7 +174,7 @@ public class FTPURLConnection return this.new ClosingInputStream(connection.retrieve(path)); } } - + /** * Returns an output stream that writes to this connection. */ @@ -252,7 +252,7 @@ public class FTPURLConnection l.add(value); map.put(key, l); } - + public void setRequestProperty(String key, String value) { if (connected) @@ -351,7 +351,7 @@ public class FTPURLConnection super.close(); connection.logout(); } - + } class ClosingOutputStream @@ -369,8 +369,7 @@ public class FTPURLConnection super.close(); connection.logout(); } - + } } - diff --git a/gnu/java/net/protocol/ftp/Handler.java b/gnu/java/net/protocol/ftp/Handler.java index 88491b3c1..7638b6664 100644 --- a/gnu/java/net/protocol/ftp/Handler.java +++ b/gnu/java/net/protocol/ftp/Handler.java @@ -7,7 +7,7 @@ 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 @@ -67,4 +67,3 @@ public class Handler } } - diff --git a/gnu/java/net/protocol/ftp/PassiveModeDTP.java b/gnu/java/net/protocol/ftp/PassiveModeDTP.java index 6f4fd6341..a74346c74 100644 --- a/gnu/java/net/protocol/ftp/PassiveModeDTP.java +++ b/gnu/java/net/protocol/ftp/PassiveModeDTP.java @@ -7,7 +7,7 @@ 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 @@ -118,7 +118,7 @@ final class PassiveModeDTP in.setTransferComplete(false); return in; } - + /** * Returns an output stream to which a local file can be written for * upload. @@ -147,12 +147,12 @@ final class PassiveModeDTP out.setTransferComplete(false); return out; } - + public void setTransferMode(int mode) { transferMode = mode; } - + public void complete() { completed = true; @@ -198,4 +198,3 @@ final class PassiveModeDTP } } - diff --git a/gnu/java/net/protocol/ftp/StreamInputStream.java b/gnu/java/net/protocol/ftp/StreamInputStream.java index 93eee4e19..beee14bcb 100644 --- a/gnu/java/net/protocol/ftp/StreamInputStream.java +++ b/gnu/java/net/protocol/ftp/StreamInputStream.java @@ -7,7 +7,7 @@ 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 @@ -54,7 +54,7 @@ class StreamInputStream { super(dtp, in); } - + public int read() throws IOException { @@ -92,4 +92,3 @@ class StreamInputStream } } - diff --git a/gnu/java/net/protocol/ftp/StreamOutputStream.java b/gnu/java/net/protocol/ftp/StreamOutputStream.java index a6e28ece3..2df1a87d8 100644 --- a/gnu/java/net/protocol/ftp/StreamOutputStream.java +++ b/gnu/java/net/protocol/ftp/StreamOutputStream.java @@ -7,7 +7,7 @@ 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 @@ -54,7 +54,7 @@ class StreamOutputStream { super(dtp, out); } - + public void write(int c) throws IOException { @@ -70,7 +70,7 @@ class StreamOutputStream { write(b, 0, b.length); } - + public void write(byte[] b, int off, int len) throws IOException { @@ -80,6 +80,5 @@ class StreamOutputStream } out.write(b, off, len); } - -} +} diff --git a/gnu/java/net/protocol/http/Authenticator.java b/gnu/java/net/protocol/http/Authenticator.java index 0d7c98819..b4ee41e11 100644 --- a/gnu/java/net/protocol/http/Authenticator.java +++ b/gnu/java/net/protocol/http/Authenticator.java @@ -7,7 +7,7 @@ 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 @@ -54,6 +54,5 @@ public interface Authenticator * unsuccessful attempt */ Credentials getCredentials(String realm, int attempt); - -} +} diff --git a/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java b/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java index 35ad2bccf..22a33ccd3 100644 --- a/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java +++ b/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java @@ -7,7 +7,7 @@ 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 @@ -102,6 +102,5 @@ public class ByteArrayRequestBodyWriter } return len; } - -} +} diff --git a/gnu/java/net/protocol/http/ChunkedInputStream.java b/gnu/java/net/protocol/http/ChunkedInputStream.java index 8a30e51db..33df0df95 100644 --- a/gnu/java/net/protocol/http/ChunkedInputStream.java +++ b/gnu/java/net/protocol/http/ChunkedInputStream.java @@ -7,7 +7,7 @@ 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 @@ -158,15 +158,15 @@ public class ChunkedInputStream } else { - int canRead = Math.min(size - count, length); - int len = in.read(buffer, offset, canRead); - if (len == -1) - { - // This is an error condition but it isn't clear what we - // should do with it. - eof = true; - return -1; - } + int canRead = Math.min(size - count, length); + int len = in.read(buffer, offset, canRead); + if (len == -1) + { + // This is an error condition but it isn't clear what we + // should do with it. + eof = true; + return -1; + } count += len; if (count == size) { @@ -205,20 +205,19 @@ public class ChunkedInputStream { if (meta) return 0; - + return Math.min(in.available(), size - count); } /** * This method closes the ChunkedInputStream by closing the underlying * InputStream. - * + * * @exception IOException If an error occurs */ public void close() throws IOException { in.close(); } - -} +} diff --git a/gnu/java/net/protocol/http/Cookie.java b/gnu/java/net/protocol/http/Cookie.java index 4482a121e..122a23f79 100644 --- a/gnu/java/net/protocol/http/Cookie.java +++ b/gnu/java/net/protocol/http/Cookie.java @@ -7,7 +7,7 @@ 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 @@ -138,7 +138,7 @@ public class Cookie { return toString(true, true); } - + public String toString(boolean showPath, boolean showDomain) { CPStringBuilder buf = new CPStringBuilder(); @@ -159,4 +159,3 @@ public class Cookie } } - diff --git a/gnu/java/net/protocol/http/CookieManager.java b/gnu/java/net/protocol/http/CookieManager.java index cc1225c49..da3686689 100644 --- a/gnu/java/net/protocol/http/CookieManager.java +++ b/gnu/java/net/protocol/http/CookieManager.java @@ -7,7 +7,7 @@ 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 @@ -61,5 +61,5 @@ public interface CookieManager * @param path the path to access */ Cookie[] getCookies(String host, boolean secure, String path); - + } diff --git a/gnu/java/net/protocol/http/Credentials.java b/gnu/java/net/protocol/http/Credentials.java index 9e5fcd172..f95b4b53c 100644 --- a/gnu/java/net/protocol/http/Credentials.java +++ b/gnu/java/net/protocol/http/Credentials.java @@ -7,7 +7,7 @@ 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 @@ -83,6 +83,5 @@ public class Credentials { return password; } - -} +} diff --git a/gnu/java/net/protocol/http/HTTPConnection.java b/gnu/java/net/protocol/http/HTTPConnection.java index 44b1a608a..b96bf4c54 100644 --- a/gnu/java/net/protocol/http/HTTPConnection.java +++ b/gnu/java/net/protocol/http/HTTPConnection.java @@ -7,7 +7,7 @@ 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 @@ -201,7 +201,7 @@ public class HTTPConnection this(hostname, secure ? HTTPS_PORT : HTTP_PORT, secure, connectionTimeout, timeout); } - + /** * Creates a new HTTP connection on the specified port. * @param hostname the name of the host to connect to @@ -222,7 +222,7 @@ public class HTTPConnection { this(hostname, port, secure, 0, 0); } - + /** * Creates a new HTTP or HTTPS connection on the specified port. * @param hostname the name of the host to connect to @@ -239,7 +239,7 @@ public class HTTPConnection { if (connectionTimeout < 0 || timeout < 0) throw new IllegalArgumentException(); - + this.hostname = hostname; this.port = port; this.secure = secure; @@ -477,8 +477,8 @@ public class HTTPConnection */ synchronized HTTPConnection get(String host, int port, - boolean secure, - int connectionTimeout, int timeout) + boolean secure, + int connectionTimeout, int timeout) { String ttl = SystemProperties.getProperty("classpath.net.http.keepAliveTTL"); @@ -510,7 +510,7 @@ public class HTTPConnection } HTTPConnection c = null; - + ListIterator it = connectionPool.listIterator(0); while (it.hasNext()) { @@ -584,7 +584,7 @@ public class HTTPConnection } } } - + /** * The number of times this HTTPConnection has be used via keep-alive. */ @@ -618,7 +618,7 @@ public class HTTPConnection { useCount++; pool.put(this); - + } else { @@ -878,7 +878,7 @@ public class HTTPConnection } // -- Events -- - + void addHandshakeCompletedListener(HandshakeCompletedListener l) { synchronized (handshakeCompletedListeners) @@ -895,4 +895,3 @@ public class HTTPConnection } } - diff --git a/gnu/java/net/protocol/http/HTTPDateFormat.java b/gnu/java/net/protocol/http/HTTPDateFormat.java index 2f59e4318..743f8e8e2 100644 --- a/gnu/java/net/protocol/http/HTTPDateFormat.java +++ b/gnu/java/net/protocol/http/HTTPDateFormat.java @@ -7,7 +7,7 @@ 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 @@ -145,7 +145,7 @@ public class HTTPDateFormat // Get time offset in minutes int zoneOffset =(calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET)) / 60000; - + // Apply + or - appropriately if (zoneOffset < 0) { @@ -156,7 +156,7 @@ public class HTTPDateFormat { buf.append('+'); } - + // Set the 2 2-char fields as specified above int tzhours = zoneOffset / 60; buf.append(Character.forDigit(tzhours / 10, 10)); @@ -340,14 +340,14 @@ public class HTTPDateFormat } second = Integer.parseInt(text.substring(start, end)); } - + calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month); calendar.set(Calendar.DAY_OF_MONTH, date); calendar.set(Calendar.HOUR, hour); calendar.set(Calendar.MINUTE, minute); calendar.set(Calendar.SECOND, second); - + if (end != len) { // Timezone @@ -380,7 +380,7 @@ public class HTTPDateFormat } } pos.setIndex(end); - + return calendar.getTime(); } catch (NumberFormatException e) @@ -400,7 +400,7 @@ public class HTTPDateFormat { pos++; } - return pos; + return pos; } private int skipNonWhitespace(String text, int pos) @@ -409,7 +409,7 @@ public class HTTPDateFormat { pos++; } - return pos; + return pos; } private int skipTo(String text, int pos, char c) @@ -418,7 +418,7 @@ public class HTTPDateFormat { pos++; } - return pos; + return pos; } /** @@ -438,4 +438,3 @@ public class HTTPDateFormat } } - diff --git a/gnu/java/net/protocol/http/HTTPURLConnection.java b/gnu/java/net/protocol/http/HTTPURLConnection.java index b31f42669..9ba5c4793 100644 --- a/gnu/java/net/protocol/http/HTTPURLConnection.java +++ b/gnu/java/net/protocol/http/HTTPURLConnection.java @@ -7,7 +7,7 @@ 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 @@ -151,7 +151,7 @@ public class HTTPURLConnection } final Credentials creds = (username == null) ? null : new Credentials (username, password); - + if ("POST".equals(method)) { String contentType = requestHeaders.getValue("Content-Type"); @@ -241,113 +241,113 @@ public class HTTPURLConnection throw ioe; } } - + if (response.isRedirect() && getInstanceFollowRedirects()) { - // Read the response body, if there is one. If the - // redirect points us back at the same server, we will use - // the cached connection, so we must make sure there is no - // pending data in it. + // Read the response body, if there is one. If the + // redirect points us back at the same server, we will use + // the cached connection, so we must make sure there is no + // pending data in it. InputStream body = response.getBody(); - if (body != null) - { - byte[] ignore = new byte[1024]; - while (true) - { - int n = body.read(ignore, 0, ignore.length); - if (n == -1) - break; - } - } + if (body != null) + { + byte[] ignore = new byte[1024]; + while (true) + { + int n = body.read(ignore, 0, ignore.length); + if (n == -1) + break; + } + } // Follow redirect String location = response.getHeader("Location"); - if (location != null) - { - String connectionUri = connection.getURI(); - int start = connectionUri.length(); - if (location.startsWith(connectionUri) && - location.charAt(start) == '/') - { - file = location.substring(start); - retry = true; - } - else if (location.startsWith("http:")) - { - connection.close(); - connection = null; - secure = false; - start = 7; - int end = location.indexOf('/', start); + if (location != null) + { + String connectionUri = connection.getURI(); + int start = connectionUri.length(); + if (location.startsWith(connectionUri) && + location.charAt(start) == '/') + { + file = location.substring(start); + retry = true; + } + else if (location.startsWith("http:")) + { + connection.close(); + connection = null; + secure = false; + start = 7; + int end = location.indexOf('/', start); if (end == -1) end = location.length(); - host = location.substring(start, end); - int ci = host.lastIndexOf(':'); - if (ci != -1) - { - port = Integer.parseInt(host.substring (ci + 1)); - host = host.substring(0, ci); - } - else - { - port = HTTPConnection.HTTP_PORT; - } - file = location.substring(end); - retry = true; - } - else if (location.startsWith("https:")) - { - connection.close(); - connection = null; - secure = true; - start = 8; - int end = location.indexOf('/', start); + host = location.substring(start, end); + int ci = host.lastIndexOf(':'); + if (ci != -1) + { + port = Integer.parseInt(host.substring (ci + 1)); + host = host.substring(0, ci); + } + else + { + port = HTTPConnection.HTTP_PORT; + } + file = location.substring(end); + retry = true; + } + else if (location.startsWith("https:")) + { + connection.close(); + connection = null; + secure = true; + start = 8; + int end = location.indexOf('/', start); if (end == -1) end = location.length(); - host = location.substring(start, end); - int ci = host.lastIndexOf(':'); - if (ci != -1) - { - port = Integer.parseInt(host.substring (ci + 1)); - host = host.substring(0, ci); - } - else - { - port = HTTPConnection.HTTPS_PORT; - } - file = location.substring(end); - retry = true; - } - else if (location.length() > 0) - { - // Malformed absolute URI, treat as file part of URI - if (location.charAt(0) == '/') - { - // Absolute path - file = location; - } - else - { - // Relative path - int lsi = file.lastIndexOf('/'); - file = (lsi == -1) ? "/" : file.substring(0, lsi + 1); - file += location; - } - retry = true; - } - } + host = location.substring(start, end); + int ci = host.lastIndexOf(':'); + if (ci != -1) + { + port = Integer.parseInt(host.substring (ci + 1)); + host = host.substring(0, ci); + } + else + { + port = HTTPConnection.HTTPS_PORT; + } + file = location.substring(end); + retry = true; + } + else if (location.length() > 0) + { + // Malformed absolute URI, treat as file part of URI + if (location.charAt(0) == '/') + { + // Absolute path + file = location; + } + else + { + // Relative path + int lsi = file.lastIndexOf('/'); + file = (lsi == -1) ? "/" : file.substring(0, lsi + 1); + file += location; + } + retry = true; + } + } } else { responseSink = response.getBody(); - + if (response.isError()) - errorSink = responseSink; + errorSink = responseSink; } } while (retry); connected = true; - } + } /** * Returns a connection, from the pool if necessary. @@ -425,7 +425,7 @@ public class HTTPURLConnection } public String getRequestProperty(String key) - { + { return requestHeaders.getValue(key); } @@ -433,7 +433,7 @@ public class HTTPURLConnection { if (connected) throw new IllegalStateException("Already connected"); - + Map<String, List<String>> m = requestHeaders.getAsMap(); return Collections.unmodifiableMap(m); } @@ -441,7 +441,7 @@ public class HTTPURLConnection public void setRequestProperty(String key, String value) { super.setRequestProperty(key, value); - + requestHeaders.put(key, value); } @@ -477,9 +477,9 @@ public class HTTPURLConnection } return requestSink; } - + // -- Response -- - + public InputStream getInputStream() throws IOException { @@ -491,17 +491,17 @@ public class HTTPURLConnection { throw new ProtocolException("doInput is false"); } - + if (response.isError()) { int code = response.getCode(); if (code == 404 || code == 410) throw new FileNotFoundException(url.toString()); - + throw new IOException("Server returned HTTP response code " + code + " for URL " + url.toString()); } - + return responseSink; } @@ -535,7 +535,7 @@ public class HTTPURLConnection " " + response.getCode() + " " + response.getMessage(); } - + public String getHeaderField(int index) { if (!connected) @@ -641,7 +641,7 @@ public class HTTPURLConnection } return handshakeEvent.getCipherSuite(); } - + public Certificate[] getLocalCertificates() { if (!connected) @@ -681,14 +681,13 @@ public class HTTPURLConnection super.setReadTimeout(timeout); if (connection == null) return; - try + try { - connection.getSocket().setSoTimeout(timeout); - } + connection.getSocket().setSoTimeout(timeout); + } catch (IOException se) { - // Ignore socket exceptions. + // Ignore socket exceptions. } } } - diff --git a/gnu/java/net/protocol/http/Handler.java b/gnu/java/net/protocol/http/Handler.java index 640542513..30810321d 100644 --- a/gnu/java/net/protocol/http/Handler.java +++ b/gnu/java/net/protocol/http/Handler.java @@ -7,7 +7,7 @@ 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 @@ -70,4 +70,3 @@ public class Handler } } - diff --git a/gnu/java/net/protocol/http/Headers.java b/gnu/java/net/protocol/http/Headers.java index 690a0c65b..faf5eb195 100644 --- a/gnu/java/net/protocol/http/Headers.java +++ b/gnu/java/net/protocol/http/Headers.java @@ -7,7 +7,7 @@ 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 @@ -71,7 +71,7 @@ class Headers implements Iterable<Headers.HeaderElement> */ private final ArrayList<HeaderElement> headers = new ArrayList<HeaderElement>(); - + /** * The HTTP dateformat used to parse date header fields. */ @@ -111,11 +111,11 @@ class Headers implements Iterable<Headers.HeaderElement> { return headers.iterator(); } - + /** * Returns the value of the specified header as a string. If * multiple values are present, the last one is returned. - * + * * @param header the header name (case insensitive search) * @return The header value or <code>null</code> if not found. */ @@ -135,7 +135,7 @@ class Headers implements Iterable<Headers.HeaderElement> /** * Returns the value of the specified header as an integer. If * multiple values are present, the last one is returned. - * + * * @param header the header name (case insensitive search) * @return The header value or <code>-1</code> if not present or * not an integer value. @@ -161,7 +161,7 @@ class Headers implements Iterable<Headers.HeaderElement> /** * Returns the value of the specified header as a long. If * multiple values are present, the last one is returned. - * + * * @param header the header name (case insensitive search) * @return The header value or <code>-1</code> if not present or * not a long value. @@ -187,7 +187,7 @@ class Headers implements Iterable<Headers.HeaderElement> /** * Returns the value of the specified header as a date. If * multiple values are present, the last one is returned. - * + * * @param header the header name (case insensitive search) * @return The header value or <code>null</code> if not present or * not a date value. @@ -212,7 +212,7 @@ class Headers implements Iterable<Headers.HeaderElement> /** * Add a header to this set of headers. If there is an existing * header with the same name it's value is replaced with the new value. - * If multiple headers of the same name exist only the last one's value + * If multiple headers of the same name exist only the last one's value * is replaced. * * @param name the header name @@ -221,7 +221,7 @@ class Headers implements Iterable<Headers.HeaderElement> * @see #addValue(String, String) */ public void put(String name, String value) - { + { for (int i = headers.size() - 1; i >= 0; i--) { HeaderElement e = headers.get(i); @@ -231,14 +231,14 @@ class Headers implements Iterable<Headers.HeaderElement> return; } } - + // nothing was replaced so add it as new HeaderElement addValue(name, value); } - + /** - * Add all headers from a set of headers to this set. Any existing header - * with the same (case insensitive) name as one of the new headers will + * Add all headers from a set of headers to this set. Any existing header + * with the same (case insensitive) name as one of the new headers will * be overridden. * * @param o the headers to be added @@ -280,7 +280,7 @@ class Headers implements Iterable<Headers.HeaderElement> { LineInputStream lin = (in instanceof LineInputStream) ? (LineInputStream) in : new LineInputStream(in); - + String name = null; CPStringBuilder value = new CPStringBuilder(); while (true) @@ -307,9 +307,9 @@ class Headers implements Iterable<Headers.HeaderElement> if (c1 == ' ' || c1 == '\t') { // Continuation - int last = len - 1; - if (line.charAt(last) != '\r') - ++last; + int last = len - 1; + if (line.charAt(last) != '\r') + ++last; value.append(line.substring(0, last)); } else @@ -318,7 +318,7 @@ class Headers implements Iterable<Headers.HeaderElement> { addValue(name, value.toString()); } - + int di = line.indexOf(':'); name = line.substring(0, di); value.setLength(0); @@ -327,14 +327,14 @@ class Headers implements Iterable<Headers.HeaderElement> di++; } while (di < len && line.charAt(di) == ' '); - int last = len - 1; - if (line.charAt(last) != '\r') - ++last; + int last = len - 1; + if (line.charAt(last) != '\r') + ++last; value.append(line.substring(di, last)); } } } - + /** * Add a header to this set of headers. If there is an existing @@ -352,12 +352,12 @@ class Headers implements Iterable<Headers.HeaderElement> /** * Get a new Map containing all the headers. The keys of the Map - * are Strings (the header names). The headers will be included + * are Strings (the header names). The headers will be included * case-sensitive in the map so that querying must be done with the * correct case of the needed header name. The values of the Map are * unmodifiable Lists containing Strings (the header values). * - * <p> + * <p> * The returned map is modifiable. Changing it will not effect this * collection of Headers in any way.</p> * @@ -387,7 +387,7 @@ class Headers implements Iterable<Headers.HeaderElement> } return m; } - + /** * Get the name of the Nth header. * @@ -401,7 +401,7 @@ class Headers implements Iterable<Headers.HeaderElement> { if (i >= headers.size() || i < 0) return null; - + return headers.get(i).name; } @@ -418,7 +418,7 @@ class Headers implements Iterable<Headers.HeaderElement> { if (i >= headers.size() || i < 0) return null; - + return headers.get(i).value; } } diff --git a/gnu/java/net/protocol/http/Request.java b/gnu/java/net/protocol/http/Request.java index 88e2fd077..534213eed 100644 --- a/gnu/java/net/protocol/http/Request.java +++ b/gnu/java/net/protocol/http/Request.java @@ -7,7 +7,7 @@ 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 @@ -280,14 +280,14 @@ public class Request setHeader("Content-Length", Integer.toString(contentLength)); } } - + try { // Loop while authentication fails or continue do { retry = false; - + // Get socket output and input streams OutputStream out = connection.getOutputStream(); @@ -314,7 +314,7 @@ public class Request byte[] buffer = new byte[4096]; int len; int count = 0; - + requestBodyWriter.reset(); do { @@ -372,13 +372,13 @@ public class Request } return response; } - + Response readResponse(InputStream in) throws IOException { String line; int len; - + // Read response status line LineInputStream lis = new LineInputStream(in); @@ -414,7 +414,7 @@ public class Request responseHeaders.parse(lis); notifyHeaderHandlers(responseHeaders); InputStream body = null; - + switch (code) { case 100: @@ -459,7 +459,7 @@ public class Request throws IOException { long contentLength = -1; - + // Persistent connections are the default in HTTP/1.1 boolean doClose = "close".equalsIgnoreCase(getHeader("Connection")) || "close".equalsIgnoreCase(responseHeaders.getValue("Connection")) || @@ -475,9 +475,9 @@ public class Request else if ("chunked".equalsIgnoreCase(transferCoding)) { in = new LimitedLengthInputStream(in, -1, false, connection, doClose); - + in = new ChunkedInputStream(in, responseHeaders); - } + } else { contentLength = responseHeaders.getLongValue("Content-Length"); @@ -505,9 +505,9 @@ public class Request throw new ProtocolException("Unsupported Content-Encoding: " + contentCoding); } - // Remove the Content-Encoding header because the content is - // no longer compressed. - responseHeaders.remove("Content-Encoding"); + // Remove the Content-Encoding header because the content is + // no longer compressed. + responseHeaders.remove("Content-Encoding"); } return in; } @@ -551,7 +551,7 @@ public class Request { MessageDigest md5 = MessageDigest.getInstance("MD5"); final byte[] COLON = { 0x3a }; - + // Calculate H(A1) md5.reset(); md5.update(username.getBytes("US-ASCII")); @@ -572,7 +572,7 @@ public class Request ha1 = md5.digest(); } String ha1Hex = toHexString(ha1); - + // Calculate H(A2) md5.reset(); md5.update(method.getBytes("US-ASCII")); @@ -586,7 +586,7 @@ public class Request } byte[] ha2 = md5.digest(); String ha2Hex = toHexString(ha2); - + // Calculate response md5.reset(); md5.update(ha1Hex.getBytes("US-ASCII")); @@ -606,8 +606,8 @@ public class Request md5.update(COLON); md5.update(ha2Hex.getBytes("US-ASCII")); String digestResponse = toHexString(md5.digest()); - - String authorization = scheme + + + String authorization = scheme + " username=\"" + username + "\"" + " realm=\"" + realm + "\"" + " nonce=\"" + nonce + "\"" + @@ -652,7 +652,7 @@ public class Request buf.setLength(0); } else if (c != ',' || (i <(len - 1) && text.charAt(i + 1) != ' ')) - { + { buf.append(c); } } @@ -855,4 +855,3 @@ public class Request } } - diff --git a/gnu/java/net/protocol/http/RequestBodyWriter.java b/gnu/java/net/protocol/http/RequestBodyWriter.java index 05d98ebb8..aa5b78a54 100644 --- a/gnu/java/net/protocol/http/RequestBodyWriter.java +++ b/gnu/java/net/protocol/http/RequestBodyWriter.java @@ -7,7 +7,7 @@ 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 @@ -64,6 +64,5 @@ public interface RequestBodyWriter * @return the number of bytes written */ int write(byte[] buffer); - -} +} diff --git a/gnu/java/net/protocol/http/Response.java b/gnu/java/net/protocol/http/Response.java index 76fac9344..084cf75fa 100644 --- a/gnu/java/net/protocol/http/Response.java +++ b/gnu/java/net/protocol/http/Response.java @@ -7,7 +7,7 @@ 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 @@ -61,7 +61,7 @@ public class Response /** * The HTTP status code of the response. - */ + */ protected final int code; /** @@ -114,7 +114,7 @@ public class Response /** * Returns the HTTP status code of the response. * @see #code - */ + */ public int getCode() { return code; @@ -188,22 +188,22 @@ public class Response { return headers.getDateValue(name); } - + /** * Tests whether this response indicates a redirection. - * + * * @return <code>true</code> if, <code>false</code> otherwise. */ public boolean isRedirect() { return (code != 304 && getCodeClass() == 3); } - + /** * Tests whether this response indicates an error. * Errors are the response codes <code>4xx</code> - Client error and * <code>5xx</code> - Server error. - * + * * @return <code>true</code> if, <code>false</code> otherwise. */ public boolean isError() @@ -221,4 +221,3 @@ public class Response return body; } } - diff --git a/gnu/java/net/protocol/http/ResponseHeaderHandler.java b/gnu/java/net/protocol/http/ResponseHeaderHandler.java index 4c5261da1..ca863440e 100644 --- a/gnu/java/net/protocol/http/ResponseHeaderHandler.java +++ b/gnu/java/net/protocol/http/ResponseHeaderHandler.java @@ -7,7 +7,7 @@ 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 @@ -52,6 +52,5 @@ public interface ResponseHeaderHandler * Sets the value for the header associated with this handler. */ void setValue(String value); - -} +} diff --git a/gnu/java/net/protocol/http/SimpleCookieManager.java b/gnu/java/net/protocol/http/SimpleCookieManager.java index fe05ba09e..f08204769 100644 --- a/gnu/java/net/protocol/http/SimpleCookieManager.java +++ b/gnu/java/net/protocol/http/SimpleCookieManager.java @@ -7,7 +7,7 @@ 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 @@ -133,6 +133,5 @@ public class SimpleCookieManager } } } - -} +} diff --git a/gnu/java/net/protocol/https/Handler.java b/gnu/java/net/protocol/https/Handler.java index 2b1375170..dbb619905 100644 --- a/gnu/java/net/protocol/https/Handler.java +++ b/gnu/java/net/protocol/https/Handler.java @@ -7,7 +7,7 @@ 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 @@ -73,4 +73,3 @@ public class Handler } } - diff --git a/gnu/java/net/protocol/jar/Connection.java b/gnu/java/net/protocol/jar/Connection.java index 386aacef6..85d27bfc9 100644 --- a/gnu/java/net/protocol/jar/Connection.java +++ b/gnu/java/net/protocol/jar/Connection.java @@ -7,7 +7,7 @@ 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 @@ -73,13 +73,13 @@ public final class Connection extends JarURLConnection private JarFile jar_file; private JarEntry jar_entry; private URL jar_url; - + public static class JarFileCache { private static Hashtable<URL, JarFile> cache = new Hashtable<URL, JarFile>(); private static final int READBUFSIZE = 4*1024; - + public static synchronized JarFile get (URL url, boolean useCaches) throws IOException { @@ -92,31 +92,31 @@ public final class Connection extends JarURLConnection } if ("file".equals (url.getProtocol())) - { - String fn = url.getFile(); - fn = gnu.java.net.protocol.file.Connection.unquote(fn); - File f = new File (fn); - jf = new JarFile (f, true, ZipFile.OPEN_READ); - } + { + String fn = url.getFile(); + fn = gnu.java.net.protocol.file.Connection.unquote(fn); + File f = new File (fn); + jf = new JarFile (f, true, ZipFile.OPEN_READ); + } else - { - URLConnection urlconn = url.openConnection(); - InputStream is = urlconn.getInputStream(); - byte[] buf = new byte [READBUFSIZE]; - File f = File.createTempFile ("cache", "jar"); - FileOutputStream fos = new FileOutputStream (f); - int len = 0; - - while ((len = is.read (buf)) != -1) - { - fos.write (buf, 0, len); - } - - fos.close(); - // Always verify the Manifest, open read only and delete when done. - jf = new JarFile (f, true, - ZipFile.OPEN_READ | ZipFile.OPEN_DELETE); - } + { + URLConnection urlconn = url.openConnection(); + InputStream is = urlconn.getInputStream(); + byte[] buf = new byte [READBUFSIZE]; + File f = File.createTempFile ("cache", "jar"); + FileOutputStream fos = new FileOutputStream (f); + int len = 0; + + while ((len = is.read (buf)) != -1) + { + fos.write (buf, 0, len); + } + + fos.close(); + // Always verify the Manifest, open read only and delete when done. + jf = new JarFile (f, true, + ZipFile.OPEN_READ | ZipFile.OPEN_DELETE); + } if (useCaches) cache.put (url, jf); @@ -140,7 +140,7 @@ public final class Connection extends JarURLConnection jar_url = getJarFileURL(); jar_file = JarFileCache.get (jar_url, useCaches); String entry_name = getEntryName(); - + if (entry_name != null && !entry_name.equals ("")) { @@ -160,7 +160,7 @@ public final class Connection extends JarURLConnection if (! doInput) throw new ProtocolException("Can't open InputStream if doInput is false"); - + return jar_file.getInputStream (jar_entry); } @@ -179,26 +179,26 @@ public final class Connection extends JarURLConnection { try { - if (!connected) - connect(); + if (!connected) + connect(); - if (field.equals("content-type")) + if (field.equals("content-type")) return guessContentTypeFromName(getJarEntry().getName()); - else if (field.equals("content-length")) + else if (field.equals("content-length")) return Long.toString(getJarEntry().getSize()); - else if (field.equals("last-modified")) - { - // Both creating and manipulating dateFormat need synchronization. - synchronized (Connection.class) - { - if (dateFormat == null) - dateFormat = new SimpleDateFormat - ("EEE, dd MMM yyyy hh:mm:ss 'GMT'", - new Locale ("En", "Us", "Unix")); - - return dateFormat.format(new Date(getJarEntry().getTime())); - } - } + else if (field.equals("last-modified")) + { + // Both creating and manipulating dateFormat need synchronization. + synchronized (Connection.class) + { + if (dateFormat == null) + dateFormat = new SimpleDateFormat + ("EEE, dd MMM yyyy hh:mm:ss 'GMT'", + new Locale ("En", "Us", "Unix")); + + return dateFormat.format(new Date(getJarEntry().getTime())); + } + } } catch (IOException e) { @@ -222,11 +222,11 @@ public final class Connection extends JarURLConnection try { - return getJarEntry().getTime(); + return getJarEntry().getTime(); } catch (IOException e) { - return -1; + return -1; } } } diff --git a/gnu/java/net/protocol/jar/Handler.java b/gnu/java/net/protocol/jar/Handler.java index 66f0fb6d9..7d6103e93 100644 --- a/gnu/java/net/protocol/jar/Handler.java +++ b/gnu/java/net/protocol/jar/Handler.java @@ -7,7 +7,7 @@ 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 @@ -91,34 +91,34 @@ public class Handler extends URLStreamHandler // strategy when we encounter an error in parsing is to return without // doing anything. String file = url.getFile(); - + if (!file.equals("")) { //has context url - url_string = url_string.substring (start, end); + url_string = url_string.substring (start, end); if (url_string.startsWith("/")) { //url string is an absolute path int idx = file.lastIndexOf ("!/"); - - if (idx < 0) - throw new URLParseError("no !/ in spec"); - - file = file.substring (0, idx + 1) + url_string; + + if (idx < 0) + throw new URLParseError("no !/ in spec"); + + file = file.substring (0, idx + 1) + url_string; } else if (url_string.length() > 0) { int idx = file.lastIndexOf ("/"); if (idx == -1) //context path is weird - file = "/" + url_string; + file = "/" + url_string; else if (idx == (file.length() - 1)) //just concatenate two parts file = file + url_string; else - // according to Java API Documentation, here is a little different + // according to Java API Documentation, here is a little different // with URLStreamHandler.parseURL // but JDK seems doesn't handle it well file = file.substring(0, idx + 1) + url_string; } - + setURL (url, "jar", url.getHost(), url.getPort(), flat(file), null); return; } @@ -130,7 +130,7 @@ public class Handler extends URLStreamHandler return; if (start > url_string.length()) return; - + // Skip remains of protocol url_string = url_string.substring (start, end); @@ -140,16 +140,16 @@ public class Handler extends URLStreamHandler try { - new URL(url_string.substring (0, jar_stop)); + new URL(url_string.substring (0, jar_stop)); } catch (MalformedURLException e) { - throw new URLParseError("invalid inner URL: " + e.getMessage()); + throw new URLParseError("invalid inner URL: " + e.getMessage()); } - + if (!url.getProtocol().equals ("jar") ) throw new URLParseError("unexpected protocol " + url.getProtocol()); - + setURL (url, "jar", url.getHost(), url.getPort(), url_string, null); } @@ -170,16 +170,16 @@ public class Handler extends URLStreamHandler StringTokenizer st = new StringTokenizer(jar_path, "/"); while (st.hasMoreTokens()) { - String token = st.nextToken(); + String token = st.nextToken(); if (token.equals(".")) continue; else if (token.equals("..")) - { - if (! tokens.isEmpty()) - tokens.remove(tokens.size() - 1); - } - else - tokens.add(token); + { + if (! tokens.isEmpty()) + tokens.remove(tokens.size() - 1); + } + else + tokens.add(token); } CPStringBuilder path = new CPStringBuilder(url_string.length()); @@ -203,8 +203,8 @@ public class Handler extends URLStreamHandler String ref = url.getRef(); // return "jar:" + file; - // Performance!!: - // Do the concatenation manually to avoid resize StringBuffer's + // Performance!!: + // Do the concatenation manually to avoid resize StringBuffer's // internal buffer. The length of ref is not taken into consideration // as it's a rare path. CPStringBuilder sb = new CPStringBuilder (file.length() + 5); diff --git a/gnu/java/nio/ChannelInputStream.java b/gnu/java/nio/ChannelInputStream.java index f56536d65..5cad678c6 100644 --- a/gnu/java/nio/ChannelInputStream.java +++ b/gnu/java/nio/ChannelInputStream.java @@ -1,4 +1,4 @@ -/* ChannelInputStream.java -- +/* ChannelInputStream.java -- Copyright (C) 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -51,11 +51,11 @@ import java.nio.channels.SelectableChannel; public final class ChannelInputStream extends InputStream { private ReadableByteChannel ch; - + public ChannelInputStream (ReadableByteChannel ch) { super(); - + this.ch = ch; } @@ -72,9 +72,9 @@ public final class ChannelInputStream extends InputStream public int read() throws IOException { if (ch instanceof SelectableChannel - && (! ((SelectableChannel) ch).isBlocking())) + && (! ((SelectableChannel) ch).isBlocking())) throw new IllegalBlockingModeException(); - + ByteBuffer buffer = ByteBuffer.allocate(1); int result = ch.read(buffer); diff --git a/gnu/java/nio/ChannelOutputStream.java b/gnu/java/nio/ChannelOutputStream.java index 08323eace..606f3775d 100644 --- a/gnu/java/nio/ChannelOutputStream.java +++ b/gnu/java/nio/ChannelOutputStream.java @@ -1,4 +1,4 @@ -/* ChannelOutputStream.java -- +/* ChannelOutputStream.java -- Copyright (C) 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -49,11 +49,11 @@ import java.nio.channels.WritableByteChannel; public final class ChannelOutputStream extends OutputStream { private WritableByteChannel ch; - + public ChannelOutputStream (WritableByteChannel ch) { super(); - + this.ch = ch; } diff --git a/gnu/java/nio/ChannelReader.java b/gnu/java/nio/ChannelReader.java index 1e7372d2e..3c1456a36 100644 --- a/gnu/java/nio/ChannelReader.java +++ b/gnu/java/nio/ChannelReader.java @@ -1,4 +1,4 @@ -/* ChannelReader.java -- +/* ChannelReader.java -- Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -50,11 +50,11 @@ import java.nio.charset.CodingErrorAction; /** * A Reader implementation that works using a ReadableByteChannel and a * CharsetDecoder. - * + * * <p> * This is a bridge between NIO <-> IO character decoding. * </p> - * + * * @author Robert Schuster */ public class ChannelReader extends Reader @@ -97,36 +97,36 @@ public class ChannelReader extends Reader // I declared channel being null meaning that the reader is closed. if (!channel.isOpen()) throw new IOException("Reader was already closed."); - + // I declared decoder being null meaning that there is no more data to read // and convert. if (decoder == null) return -1; - + // Stores the amount of character being read. It -1 so that if no conversion // occured the caller will see this as an 'end of file'. int sum = -1; - + // Copies any characters which may be left from the last invocation into the // destination array. if (charBuffer.remaining() > 0) { sum = Math.min(count, charBuffer.remaining()); charBuffer.get(buf, offset, sum); - + // Updates the control variables according to the latest copy operation. offset += sum; count -= sum; } - + // Copies the character which have not been put in the destination array to // the beginning. If data is actually copied count will be 0. If no data is // copied count is >0 and we can now convert some more characters. charBuffer.compact(); - + int converted = 0; boolean last = false; - + while (count != 0) { // Tries to convert some bytes (Which will intentionally fail in the @@ -139,7 +139,7 @@ public class ChannelReader extends Reader // unmappable. result.throwException(); } - + // Marks that we should end this loop regardless whether the caller // wants more chars or not, when this was the last conversion. if (last) @@ -149,11 +149,11 @@ public class ChannelReader extends Reader else if (result.isUnderflow()) { // We need more bytes to do the conversion. - + // Copies the not yet converted bytes to the beginning making it // being able to receive more bytes. byteBuffer.compact(); - + // Reads in another bunch of bytes for being converted. if (channel.read(byteBuffer) == -1) { @@ -162,42 +162,42 @@ public class ChannelReader extends Reader // done in the next loop iteration. last = true; } - + // Prepares the byteBuffer for the next character conversion run. byteBuffer.flip(); } - + // Prepares the charBuffer for being drained. charBuffer.flip(); - + converted = Math.min(count, charBuffer.remaining()); charBuffer.get(buf, offset, converted); - + // Copies characters which have not yet being copied into the char-Array // to the beginning making it possible to read them later (If data is // really copied here, then the caller has received enough characters so // far.). charBuffer.compact(); - + // Updates the control variables according to the latest copy operation. offset += converted; count -= converted; - + // Updates the amount of transferred characters. sum += converted; - + if (decoder == null) { break; } - + // Now that more characters have been transfered we let the loop decide // what to do next. } - + // Makes the charBuffer ready for reading on the next invocation. charBuffer.flip(); - + return sum; } } diff --git a/gnu/java/nio/ChannelWriter.java b/gnu/java/nio/ChannelWriter.java index 8e533ccbf..2441fb395 100644 --- a/gnu/java/nio/ChannelWriter.java +++ b/gnu/java/nio/ChannelWriter.java @@ -117,7 +117,7 @@ public class ChannelWriter { if (enc == null) throw new IOException("writer already closed"); - + byteBuffer.clear(); charBuffer.flip(); CoderResult res = enc.encode(charBuffer, byteBuffer, true); @@ -173,7 +173,7 @@ public class ChannelWriter break; } lastLen = len; - + // Convert. byteBuffer.clear(); CoderResult res = enc.encode(charBuffer, byteBuffer, false); diff --git a/gnu/java/nio/DatagramChannelImpl.java b/gnu/java/nio/DatagramChannelImpl.java index ea8c863e3..1132796dd 100644 --- a/gnu/java/nio/DatagramChannelImpl.java +++ b/gnu/java/nio/DatagramChannelImpl.java @@ -1,4 +1,4 @@ -/* DatagramChannelImpl.java -- +/* DatagramChannelImpl.java -- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -57,7 +57,7 @@ public final class DatagramChannelImpl extends DatagramChannel { private NIODatagramSocket socket; private VMChannel channel; - + /** * Indicates whether this channel initiated whatever operation * is being invoked on our datagram socket. @@ -85,7 +85,7 @@ public final class DatagramChannelImpl extends DatagramChannel { return inChannelOperation; } - + /** * Sets our indicator of whether we are initiating an I/O operation * on our socket. @@ -94,18 +94,18 @@ public final class DatagramChannelImpl extends DatagramChannel { inChannelOperation = b; } - + public DatagramSocket socket () { return socket; } - + protected void implCloseSelectableChannel () throws IOException { channel.close(); } - + protected void implConfigureBlocking (boolean blocking) throws IOException { @@ -117,7 +117,7 @@ public final class DatagramChannelImpl extends DatagramChannel { if (!isOpen()) throw new ClosedChannelException(); - + try { channel.connect((InetSocketAddress) remote, 0); @@ -128,14 +128,14 @@ public final class DatagramChannelImpl extends DatagramChannel } return this; } - + public DatagramChannel disconnect () throws IOException { channel.disconnect(); return this; } - + public boolean isConnected() { try @@ -147,13 +147,13 @@ public final class DatagramChannelImpl extends DatagramChannel return false; } } - + public int write (ByteBuffer src) throws IOException { if (!isConnected ()) throw new NotYetConnectedException (); - + return channel.write(src); } @@ -180,32 +180,32 @@ public final class DatagramChannelImpl extends DatagramChannel { if (!isConnected ()) throw new NotYetConnectedException (); - + return channel.read(dst); } - + public long read (ByteBuffer[] dsts, int offset, int length) throws IOException { if (!isConnected()) throw new NotYetConnectedException(); - + if ((offset < 0) || (offset > dsts.length) || (length < 0) || (length > (dsts.length - offset))) throw new IndexOutOfBoundsException(); - + /* Likewise, see the comment int write above. */ return channel.readScattering(dsts, offset, length); } - + public SocketAddress receive (ByteBuffer dst) throws IOException { if (!isOpen()) throw new ClosedChannelException(); - + try { begin(); @@ -216,23 +216,23 @@ public final class DatagramChannelImpl extends DatagramChannel end(true); } } - + public int send (ByteBuffer src, SocketAddress target) throws IOException { if (!isOpen()) throw new ClosedChannelException(); - + if (!(target instanceof InetSocketAddress)) throw new IOException("can only send to inet socket addresses"); - + InetSocketAddress dst = (InetSocketAddress) target; if (dst.isUnresolved()) throw new IOException("Target address not resolved"); return channel.send(src, dst); } - + public VMChannel getVMChannel() { return channel; diff --git a/gnu/java/nio/DatagramChannelSelectionKey.java b/gnu/java/nio/DatagramChannelSelectionKey.java index f192e5002..93837f341 100644 --- a/gnu/java/nio/DatagramChannelSelectionKey.java +++ b/gnu/java/nio/DatagramChannelSelectionKey.java @@ -1,4 +1,4 @@ -/* DatagramChannelSelectionKey.java -- +/* DatagramChannelSelectionKey.java -- Copyright (C) 2003, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/nio/EpollSelectionKeyImpl.java b/gnu/java/nio/EpollSelectionKeyImpl.java index 11113f397..c0b7720e3 100644 --- a/gnu/java/nio/EpollSelectionKeyImpl.java +++ b/gnu/java/nio/EpollSelectionKeyImpl.java @@ -58,7 +58,7 @@ public class EpollSelectionKeyImpl extends AbstractSelectionKey int key; boolean valid; boolean cancelled; - + EpollSelectionKeyImpl(EpollSelectorImpl selector, SelectableChannel channel, int fd) { diff --git a/gnu/java/nio/EpollSelectorImpl.java b/gnu/java/nio/EpollSelectorImpl.java index 2b3c9bbb1..f74b087c2 100644 --- a/gnu/java/nio/EpollSelectorImpl.java +++ b/gnu/java/nio/EpollSelectorImpl.java @@ -65,20 +65,20 @@ public class EpollSelectorImpl extends AbstractSelector // XXX is this reasonable? Does it matter? private static final int DEFAULT_EPOLL_SIZE = 128; private static final int sizeof_struct_epoll_event; - + private static final int OP_ACCEPT = SelectionKey.OP_ACCEPT; private static final int OP_CONNECT = SelectionKey.OP_CONNECT; private static final int OP_READ = SelectionKey.OP_READ; private static final int OP_WRITE = SelectionKey.OP_WRITE; - + /** our epoll file descriptor. */ private int epoll_fd; - + private final HashMap keys; private Set selectedKeys; private Thread waitingThread; private ByteBuffer events; - + private static final int INITIAL_CAPACITY; private static final int MAX_DOUBLING_CAPACITY; private static final int CAPACITY_INCREMENT; @@ -87,17 +87,17 @@ public class EpollSelectorImpl extends AbstractSelector { if (Configuration.INIT_LOAD_LIBRARY) System.loadLibrary("javanio"); - + if (epoll_supported()) sizeof_struct_epoll_event = sizeof_struct(); else sizeof_struct_epoll_event = -1; - + INITIAL_CAPACITY = 64 * sizeof_struct_epoll_event; MAX_DOUBLING_CAPACITY = 1024 * sizeof_struct_epoll_event; CAPACITY_INCREMENT = 128 * sizeof_struct_epoll_event; } - + public EpollSelectorImpl(SelectorProvider provider) throws IOException { @@ -135,7 +135,7 @@ public class EpollSelectorImpl extends AbstractSelector throw new IllegalArgumentException("invalid timeout"); return doSelect((int) timeout); } - + private int doSelect(int timeout) throws IOException { synchronized (keys) @@ -152,7 +152,7 @@ public class EpollSelectorImpl extends AbstractSelector it.remove(); deregister(key); } - + // Clear out closed channels. The fds are removed from the epoll // fd when closed, so there is no need to remove them manually. for (Iterator it = keys.values().iterator(); it.hasNext(); ) @@ -165,7 +165,7 @@ public class EpollSelectorImpl extends AbstractSelector it.remove(); } } - + // Don't bother if we have nothing to select. if (keys.isEmpty()) return 0; @@ -183,7 +183,7 @@ public class EpollSelectorImpl extends AbstractSelector waitingThread = null; end(); } - + HashSet s = new HashSet(ret); for (int i = 0; i < ret; i++) { @@ -197,9 +197,9 @@ public class EpollSelectorImpl extends AbstractSelector key.selectedOps = selected_ops(b) & key.interestOps; s.add(key); } - + reallocateBuffer(); - + selectedKeys = s; return ret; } @@ -239,7 +239,7 @@ public class EpollSelectorImpl extends AbstractSelector } return this; } - + /* (non-Javadoc) * @see java.nio.channels.spi.AbstractSelector#implCloseSelector() */ @@ -275,7 +275,7 @@ public class EpollSelectorImpl extends AbstractSelector result.key = System.identityHashCode(result); epoll_add(epoll_fd, result.fd, ops); keys.put(Integer.valueOf(native_fd), result); - reallocateBuffer(); + reallocateBuffer(); return result; } } @@ -284,7 +284,7 @@ public class EpollSelectorImpl extends AbstractSelector throw new IllegalArgumentException(ioe); } } - + private void reallocateBuffer() { // Ensure we have enough space for all potential events that may be @@ -301,18 +301,18 @@ public class EpollSelectorImpl extends AbstractSelector // Ensure that the events buffer is not too large, given the number of // events registered. else if (events.capacity() > keys.size() * sizeof_struct_epoll_event * 2 + 1 - && events.capacity() > INITIAL_CAPACITY) + && events.capacity() > INITIAL_CAPACITY) { int cap = events.capacity() >>> 1; events = ByteBuffer.allocateDirect(cap); } } - + void epoll_modify(EpollSelectionKeyImpl key, int ops) throws IOException { epoll_modify(epoll_fd, key.fd, ops); } - + /** * Tell if epoll is supported by this system, and support was compiled in. * @@ -327,8 +327,8 @@ public class EpollSelectorImpl extends AbstractSelector * @return The size of `struct epoll_event'. */ private static native int sizeof_struct(); - - + + /** * Open a new epoll file descriptor. * @@ -337,7 +337,7 @@ public class EpollSelectorImpl extends AbstractSelector * @throws IOException If allocating a new epoll descriptor fails. */ private static native int epoll_create(int size) throws IOException; - + /** * Add a file descriptor to this selector. * @@ -347,7 +347,7 @@ public class EpollSelectorImpl extends AbstractSelector */ private static native void epoll_add(int efd, int fd, int ops) throws IOException; - + /** * Modify the interest ops of the key selecting for the given FD. * @@ -358,7 +358,7 @@ public class EpollSelectorImpl extends AbstractSelector */ private static native void epoll_modify(int efd, int fd, int ops) throws IOException; - + /** * Remove a file descriptor from this selector. * @@ -367,7 +367,7 @@ public class EpollSelectorImpl extends AbstractSelector * @throws IOException */ private static native void epoll_delete(int efd, int fd) throws IOException; - + /** * Select events. * @@ -380,7 +380,7 @@ public class EpollSelectorImpl extends AbstractSelector */ private static native int epoll_wait(int efd, ByteBuffer state, int n, int timeout) throws IOException; - + /** * Fetch the fd value from a selected struct epoll_event. * @@ -388,7 +388,7 @@ public class EpollSelectorImpl extends AbstractSelector * @return The fd value. */ private static native int selected_fd(ByteBuffer struct); - + /** * Fetch the enabled operations from a selected struct epoll_event. * diff --git a/gnu/java/nio/FileChannelImpl.java b/gnu/java/nio/FileChannelImpl.java index d4a374b4a..c17227d3d 100644 --- a/gnu/java/nio/FileChannelImpl.java +++ b/gnu/java/nio/FileChannelImpl.java @@ -1,4 +1,4 @@ -/* FileChannelImpl.java -- +/* FileChannelImpl.java -- Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -58,7 +58,7 @@ import java.nio.channels.WritableByteChannel; /** * This file is not user visible ! * But alas, Java does not have a concept of friendly packages - * so this class is public. + * so this class is public. * Instances of this class are created by invoking getChannel * Upon a Input/Output/RandomAccessFile object. */ @@ -86,7 +86,7 @@ public final class FileChannelImpl extends FileChannel { System.loadLibrary("javanio"); } - + //init(); FileChannelImpl ch = null; @@ -99,7 +99,7 @@ public final class FileChannelImpl extends FileChannel throw new Error(ioe); } in = ch; - + ch = null; try { @@ -110,11 +110,11 @@ public final class FileChannelImpl extends FileChannel throw new Error(ioe); } out = ch; - + ch = null; try { - ch = new FileChannelImpl(VMChannel.getStderr(), WRITE); + ch = new FileChannelImpl(VMChannel.getStderr(), WRITE); } catch (IOException ioe) { @@ -154,16 +154,16 @@ public final class FileChannelImpl extends FileChannel // to avoid race condition. if (file.isDirectory()) { - try - { - close(); - } - catch (IOException e) - { - /* ignore it */ - } - - throw new FileNotFoundException(description + " is a directory"); + try + { + close(); + } + catch (IOException e) + { + /* ignore it */ + } + + throw new FileNotFoundException(description + " is a directory"); } } @@ -202,7 +202,7 @@ public final class FileChannelImpl extends FileChannel { ch.truncate(size); } - + public void unlock(long pos, long len) throws IOException { ch.unlock(pos, len); @@ -212,7 +212,7 @@ public final class FileChannelImpl extends FileChannel { return ch.size(); } - + protected void implCloseChannel() throws IOException { ch.close(); @@ -241,7 +241,7 @@ public final class FileChannelImpl extends FileChannel position (position); int result = read(dst); position (oldPosition); - + return result; } @@ -260,7 +260,7 @@ public final class FileChannelImpl extends FileChannel { return ch.write(src); } - + public int write (ByteBuffer src, long position) throws IOException { @@ -269,7 +269,7 @@ public final class FileChannelImpl extends FileChannel if (!isOpen ()) throw new ClosedChannelException (); - + if ((mode & WRITE) == 0) throw new NonWritableChannelException (); @@ -280,7 +280,7 @@ public final class FileChannelImpl extends FileChannel seek (position); result = write(src); seek (oldPosition); - + return result; } @@ -296,30 +296,30 @@ public final class FileChannelImpl extends FileChannel } public MappedByteBuffer map (FileChannel.MapMode mode, - long position, long size) + long position, long size) throws IOException { char nmode = 0; if (mode == MapMode.READ_ONLY) { - nmode = 'r'; - if ((this.mode & READ) == 0) - throw new NonReadableChannelException(); + nmode = 'r'; + if ((this.mode & READ) == 0) + throw new NonReadableChannelException(); } else if (mode == MapMode.READ_WRITE || mode == MapMode.PRIVATE) { - nmode = mode == MapMode.READ_WRITE ? '+' : 'c'; - if ((this.mode & WRITE) != WRITE) - throw new NonWritableChannelException(); - if ((this.mode & READ) != READ) - throw new NonReadableChannelException(); + nmode = mode == MapMode.READ_WRITE ? '+' : 'c'; + if ((this.mode & WRITE) != WRITE) + throw new NonWritableChannelException(); + if ((this.mode & READ) != READ) + throw new NonReadableChannelException(); } else throw new IllegalArgumentException ("mode: " + mode); - + if (position < 0 || size < 0 || size > Integer.MAX_VALUE) throw new IllegalArgumentException ("position: " + position - + ", size: " + size); + + ", size: " + size); return ch.map(nmode, position, (int) size); } @@ -335,99 +335,99 @@ public final class FileChannelImpl extends FileChannel } // like transferTo, but with a count of less than 2Gbytes - private int smallTransferTo (long position, int count, - WritableByteChannel target) + private int smallTransferTo (long position, int count, + WritableByteChannel target) throws IOException { ByteBuffer buffer; try { - // Try to use a mapped buffer if we can. If this fails for - // any reason we'll fall back to using a ByteBuffer. - buffer = map (MapMode.READ_ONLY, position, count); + // Try to use a mapped buffer if we can. If this fails for + // any reason we'll fall back to using a ByteBuffer. + buffer = map (MapMode.READ_ONLY, position, count); } catch (IOException e) { - buffer = ByteBuffer.allocate (count); - read (buffer, position); - buffer.flip(); + buffer = ByteBuffer.allocate (count); + read (buffer, position); + buffer.flip(); } return target.write (buffer); } - public long transferTo (long position, long count, - WritableByteChannel target) + public long transferTo (long position, long count, + WritableByteChannel target) throws IOException { if (position < 0 || count < 0) throw new IllegalArgumentException ("position: " + position - + ", count: " + count); + + ", count: " + count); if (!isOpen ()) throw new ClosedChannelException (); if ((mode & READ) == 0) throw new NonReadableChannelException (); - + final int pageSize = 65536; long total = 0; while (count > 0) { - int transferred - = smallTransferTo (position, (int)Math.min (count, pageSize), - target); - if (transferred < 0) - break; - total += transferred; - position += transferred; - count -= transferred; + int transferred + = smallTransferTo (position, (int)Math.min (count, pageSize), + target); + if (transferred < 0) + break; + total += transferred; + position += transferred; + count -= transferred; } return total; } // like transferFrom, but with a count of less than 2Gbytes - private int smallTransferFrom (ReadableByteChannel src, long position, - int count) + private int smallTransferFrom (ReadableByteChannel src, long position, + int count) throws IOException { ByteBuffer buffer = null; if (src instanceof FileChannel) { - try - { - // Try to use a mapped buffer if we can. If this fails - // for any reason we'll fall back to using a ByteBuffer. - buffer = ((FileChannel)src).map (MapMode.READ_ONLY, position, - count); - } - catch (IOException e) - { - } + try + { + // Try to use a mapped buffer if we can. If this fails + // for any reason we'll fall back to using a ByteBuffer. + buffer = ((FileChannel)src).map (MapMode.READ_ONLY, position, + count); + } + catch (IOException e) + { + } } if (buffer == null) { - buffer = ByteBuffer.allocate (count); - src.read (buffer); - buffer.flip(); + buffer = ByteBuffer.allocate (count); + src.read (buffer); + buffer.flip(); } return write (buffer, position); } - public long transferFrom (ReadableByteChannel src, long position, - long count) + public long transferFrom (ReadableByteChannel src, long position, + long count) throws IOException { if (position < 0 || count < 0) throw new IllegalArgumentException ("position: " + position - + ", count: " + count); + + ", count: " + count); if (!isOpen ()) throw new ClosedChannelException (); @@ -440,13 +440,13 @@ public final class FileChannelImpl extends FileChannel while (count > 0) { - int transferred = smallTransferFrom (src, position, - (int)Math.min (count, pageSize)); - if (transferred < 0) - break; - total += transferred; - position += transferred; - count -= transferred; + int transferred = smallTransferFrom (src, position, + (int)Math.min (count, pageSize)); + if (transferred < 0) + break; + total += transferred; + position += transferred; + count -= transferred; } return total; @@ -459,14 +459,14 @@ public final class FileChannelImpl extends FileChannel if (position < 0 || size < 0) throw new IllegalArgumentException ("position: " + position - + ", size: " + size); + + ", size: " + size); if (!isOpen ()) throw new ClosedChannelException(); if (shared && ((mode & READ) == 0)) throw new NonReadableChannelException(); - + if (!shared && ((mode & WRITE) == 0)) throw new NonWritableChannelException(); } @@ -479,19 +479,19 @@ public final class FileChannelImpl extends FileChannel boolean completed = false; try { - begin(); - boolean lockable = ch.lock(position, size, shared, false); - completed = true; - return (lockable - ? new FileLockImpl(this, position, size, shared) - : null); + begin(); + boolean lockable = ch.lock(position, size, shared, false); + completed = true; + return (lockable + ? new FileLockImpl(this, position, size, shared) + : null); } finally { - end(completed); + end(completed); } } - + public FileLock lock (long position, long size, boolean shared) throws IOException { @@ -500,15 +500,15 @@ public final class FileChannelImpl extends FileChannel boolean completed = false; try { - boolean lockable = ch.lock(position, size, shared, true); - completed = true; - return (lockable - ? new FileLockImpl(this, position, size, shared) - : null); + boolean lockable = ch.lock(position, size, shared, true); + completed = true; + return (lockable + ? new FileLockImpl(this, position, size, shared) + : null); } finally { - end(completed); + end(completed); } } @@ -520,7 +520,7 @@ public final class FileChannelImpl extends FileChannel return implPosition (); } - + public FileChannel position (long newPosition) throws IOException { @@ -535,7 +535,7 @@ public final class FileChannelImpl extends FileChannel seek (newPosition); return this; } - + public FileChannel truncate (long size) throws IOException { @@ -557,9 +557,9 @@ public final class FileChannelImpl extends FileChannel public String toString() { return (super.toString() - + "[ fd: " + ch.getState() - + "; mode: " + Integer.toOctalString(mode) - + "; " + description + " ]"); + + "[ fd: " + ch.getState() + + "; mode: " + Integer.toOctalString(mode) + + "; " + description + " ]"); } /** diff --git a/gnu/java/nio/FileLockImpl.java b/gnu/java/nio/FileLockImpl.java index 768906ce9..e714ea358 100644 --- a/gnu/java/nio/FileLockImpl.java +++ b/gnu/java/nio/FileLockImpl.java @@ -69,14 +69,14 @@ public final class FileLockImpl extends FileLock { try { - release(); + release(); } catch (IOException e) { - // Ignore this. + // Ignore this. } } - + /** * Whether or not this lock is valid, false when channel is closed or * release has been explicitly called. @@ -95,8 +95,8 @@ public final class FileLockImpl extends FileLock { if (isValid()) { - valid = false; - ((FileChannelImpl) channel()).unlock(position(), size()); + valid = false; + ((FileChannelImpl) channel()).unlock(position(), size()); } } } diff --git a/gnu/java/nio/InputStreamChannel.java b/gnu/java/nio/InputStreamChannel.java index a3dffe245..9bdfe3238 100644 --- a/gnu/java/nio/InputStreamChannel.java +++ b/gnu/java/nio/InputStreamChannel.java @@ -1,4 +1,4 @@ -/* InputStreamChannel.java -- +/* InputStreamChannel.java -- Copyright (C) 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -51,7 +51,7 @@ public final class InputStreamChannel implements ReadableByteChannel { private boolean closed = false; private InputStream in; - + public InputStreamChannel (InputStream in) { super(); @@ -76,7 +76,7 @@ public final class InputStreamChannel implements ReadableByteChannel { if (!isOpen()) throw new ClosedChannelException(); - + byte[] buffer = new byte [dst.remaining()]; int readBytes = in.read (buffer); diff --git a/gnu/java/nio/KqueueSelectionKeyImpl.java b/gnu/java/nio/KqueueSelectionKeyImpl.java index 11b37cadb..9fe6b6613 100644 --- a/gnu/java/nio/KqueueSelectionKeyImpl.java +++ b/gnu/java/nio/KqueueSelectionKeyImpl.java @@ -57,12 +57,12 @@ public class KqueueSelectionKeyImpl extends AbstractSelectionKey /** The selector we were created for. */ private final KqueueSelectorImpl selector; - + /** The channel we are attached to. */ private final SelectableChannel channel; - + private final VMChannelOwner natChannel; - + public KqueueSelectionKeyImpl(KqueueSelectorImpl selector, SelectableChannel channel) { @@ -101,7 +101,7 @@ public class KqueueSelectionKeyImpl extends AbstractSelectionKey throw new IllegalStateException("key is invalid"); if ((ops & ~channel.validOps()) != 0) throw new IllegalArgumentException("channel does not support all operations"); - + selector.setInterestOps(this, ops); return this; } @@ -123,7 +123,7 @@ public class KqueueSelectionKeyImpl extends AbstractSelectionKey { return selector; } - + public String toString() { if (!isValid()) @@ -140,12 +140,12 @@ public class KqueueSelectionKeyImpl extends AbstractSelectionKey + ((readyOps & OP_WRITE) != 0 ? " OP_WRITE" : "") + " } ]"; } - + public int hashCode() { return fd; } - + public boolean equals(Object o) { if (!(o instanceof KqueueSelectionKeyImpl)) @@ -153,8 +153,8 @@ public class KqueueSelectionKeyImpl extends AbstractSelectionKey KqueueSelectionKeyImpl that = (KqueueSelectionKeyImpl) o; return that.fd == this.fd && that.channel.equals(this.channel); } - - + + boolean isReadActive() { return (activeOps & (OP_READ | OP_ACCEPT)) != 0; @@ -164,17 +164,17 @@ public class KqueueSelectionKeyImpl extends AbstractSelectionKey { return (interestOps & (OP_READ | OP_ACCEPT)) != 0; } - + boolean isWriteActive() { return (activeOps & (OP_WRITE | OP_CONNECT)) != 0; } - + boolean isWriteInterested() { return (interestOps & (OP_WRITE | OP_CONNECT)) != 0; } - + boolean needCommitRead() { return isReadActive() == (!isReadInterested()); diff --git a/gnu/java/nio/KqueueSelectorImpl.java b/gnu/java/nio/KqueueSelectorImpl.java index 34ca1dc59..e696c0d72 100644 --- a/gnu/java/nio/KqueueSelectorImpl.java +++ b/gnu/java/nio/KqueueSelectorImpl.java @@ -70,7 +70,7 @@ public class KqueueSelectorImpl extends AbstractSelector private static final int MAX_DOUBLING_CAPACITY = 16384; private static final int CAP_INCREMENT = 1024; private static final int INITIAL_CAPACITY; - + static { try @@ -88,7 +88,7 @@ public class KqueueSelectorImpl extends AbstractSelector _sizeof_struct_kevent = -1; INITIAL_CAPACITY = 16 * _sizeof_struct_kevent; } - + /** * Tell if kqueue-based selectors are supported on this system. * @@ -96,15 +96,15 @@ public class KqueueSelectorImpl extends AbstractSelector * compiled in to Classpath. */ public static native boolean kqueue_supported(); - + /* Our native file descriptor. */ private int kq; - + private HashMap/*<Integer,KqueueSelectionKeyImpl>*/ keys; private HashSet/*<KqueueSelectionKeyImpl>*/ selected; private Thread blockedThread; private ByteBuffer events; - + private static final int OP_ACCEPT = SelectionKey.OP_ACCEPT; private static final int OP_CONNECT = SelectionKey.OP_CONNECT; private static final int OP_READ = SelectionKey.OP_READ; @@ -160,7 +160,7 @@ public class KqueueSelectorImpl extends AbstractSelector { if (!isOpen()) throw new ClosedSelectorException(); - + return selected; } @@ -181,20 +181,20 @@ public class KqueueSelectorImpl extends AbstractSelector blockedThread.interrupt(); return this; } - + public String toString() { return super.toString() + " [ fd: " + kq + " ]"; } - + public boolean equals(Object o) { if (!(o instanceof KqueueSelectorImpl)) return false; - + return ((KqueueSelectorImpl) o).kq == kq; } - + int doSelect(long timeout) throws IOException { Set cancelled = cancelledKeys(); @@ -207,7 +207,7 @@ public class KqueueSelectorImpl extends AbstractSelector KqueueSelectionKeyImpl key = (KqueueSelectionKeyImpl) it.next(); key.interestOps = 0; } - + int events_size = (2 * _sizeof_struct_kevent) * keys.size(); int num_events = 0; @@ -215,7 +215,7 @@ public class KqueueSelectorImpl extends AbstractSelector { Map.Entry e = (Map.Entry) it.next(); KqueueSelectionKeyImpl key = (KqueueSelectionKeyImpl) e.getValue(); - + SelectableChannel ch = key.channel(); if (ch instanceof VMChannelOwner) { @@ -226,7 +226,7 @@ public class KqueueSelectorImpl extends AbstractSelector continue; } } - + // If this key is registering a read filter, add it to the buffer. if (key.needCommitRead()) { @@ -235,7 +235,7 @@ public class KqueueSelectorImpl extends AbstractSelector key.activeOps & (OP_READ | OP_ACCEPT), key.key); num_events++; } - + // If this key is registering a write filter, add it to the buffer. if (key.needCommitWrite()) { @@ -271,7 +271,7 @@ public class KqueueSelectorImpl extends AbstractSelector //System.out.println("dump of keys selected:"); //dump_selection_keys((ByteBuffer) events.duplicate().limit(n * _sizeof_struct_kevent)); - + // Commit the operations we've just added in the call to kevent. for (Iterator it = keys.values().iterator(); it.hasNext(); ) { @@ -288,7 +288,7 @@ public class KqueueSelectorImpl extends AbstractSelector int y = fetch_key(events.slice()); KqueueSelectionKeyImpl key = (KqueueSelectionKeyImpl) keys.get(new Integer(y)); - + if (key == null) { System.out.println("WARNING! no key found for selected key " + y); @@ -301,7 +301,7 @@ public class KqueueSelectorImpl extends AbstractSelector key.readyOps = ready_ops(events.slice(), key.interestOps); selected.add(key); } - + // Finally, remove the cancelled keys. for (Iterator it = cancelled.iterator(); it.hasNext(); ) { @@ -317,7 +317,7 @@ public class KqueueSelectorImpl extends AbstractSelector } } } - + protected SelectionKey register(AbstractSelectableChannel channel, int interestOps, Object attachment) @@ -336,7 +336,7 @@ public class KqueueSelectorImpl extends AbstractSelector { throw new IllegalArgumentException("channel is closed or invalid"); } - + KqueueSelectionKeyImpl result = new KqueueSelectionKeyImpl(this, channel); result.interestOps = interestOps; result.attach(attachment); @@ -351,7 +351,7 @@ public class KqueueSelectorImpl extends AbstractSelector } return result; } - + void setInterestOps(KqueueSelectionKeyImpl key, int ops) { synchronized (keys) @@ -359,11 +359,11 @@ public class KqueueSelectorImpl extends AbstractSelector key.interestOps = ops; } } - + /** * Reallocate the events buffer. This is the destination buffer for * events returned by kevent. This method will: - * + * * * Grow the buffer if there is insufficent space for all registered * events. * * Shrink the buffer if it is more than twice the size needed. @@ -380,7 +380,7 @@ public class KqueueSelectorImpl extends AbstractSelector cap += CAP_INCREMENT; else cap = cap << 1; - + events = ByteBuffer.allocateDirect(cap); } else if (events.capacity() > 4 * (_sizeof_struct_kevent) * keys.size() + 1 @@ -392,12 +392,12 @@ public class KqueueSelectorImpl extends AbstractSelector } } } - + //synchronized void updateOps(KqueueSelectionKeyImpl key, int interestOps) //{ // updateOps(key, interestOps, 0, false); //} - + /*void updateOps(KqueueSelectionKeyImpl key, int interestOps, int activeOps, int fd) { @@ -437,25 +437,25 @@ public class KqueueSelectorImpl extends AbstractSelector + " }"); } } - + /** * Return the size of a <code>struct kevent</code> on this system. * * @return The size of <code>struct kevent</code>. */ private static native int sizeof_struct_kevent(); - + /** * Opens a kqueue descriptor. - * + * * @return The new kqueue descriptor. * @throws IOException If opening fails. */ private static native int implOpen() throws IOException; - + /** * Closes the kqueue file descriptor. - * + * * @param kq The kqueue file descriptor. * @throws IOException */ @@ -474,7 +474,7 @@ public class KqueueSelectorImpl extends AbstractSelector */ private static native void kevent_set(ByteBuffer nstate, int i, int fd, int interestOps, int activeOps, int key); - + /** * Poll for events. The source events are stored in <code>events</code>, * which is also where polled events will be placed. @@ -490,7 +490,7 @@ public class KqueueSelectorImpl extends AbstractSelector */ private static native int kevent(int kq, ByteBuffer events, int nevents, int nout, long timeout); - + /** * Fetch a polled key from a native state buffer. For each kevent key we * create, we put the native state info (one or more <code>struct @@ -503,7 +503,7 @@ public class KqueueSelectorImpl extends AbstractSelector * @return The key object. */ private static native int fetch_key(ByteBuffer nstate); - + /** * Fetch the ready ops of the associated native state. That is, this * inspects the first argument as a <code>struct kevent</code>, looking @@ -516,7 +516,7 @@ public class KqueueSelectorImpl extends AbstractSelector * @return The bit set representing the ready operations. */ private static native int ready_ops(ByteBuffer nstate, int interestOps); - + /** * Check if kevent returned EV_EOF for a selection key. * diff --git a/gnu/java/nio/NIODatagramSocket.java b/gnu/java/nio/NIODatagramSocket.java index f23236eca..b0c7b2dc2 100644 --- a/gnu/java/nio/NIODatagramSocket.java +++ b/gnu/java/nio/NIODatagramSocket.java @@ -1,4 +1,4 @@ -/* NIODatagramSocket.java -- +/* NIODatagramSocket.java -- Copyright (C) 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -50,7 +50,7 @@ public final class NIODatagramSocket extends DatagramSocket { private PlainDatagramSocketImpl impl; private DatagramChannelImpl channel; - + public NIODatagramSocket (PlainDatagramSocketImpl impl, DatagramChannelImpl channel) { diff --git a/gnu/java/nio/NIOServerSocket.java b/gnu/java/nio/NIOServerSocket.java index fc4d0dbe0..5dbda6b00 100644 --- a/gnu/java/nio/NIOServerSocket.java +++ b/gnu/java/nio/NIOServerSocket.java @@ -1,4 +1,4 @@ -/* NIOServerSocket.java -- +/* NIOServerSocket.java -- Copyright (C) 2003, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -55,7 +55,7 @@ import java.security.PrivilegedExceptionAction; public final class NIOServerSocket extends ServerSocket { private ServerSocketChannelImpl channel; - + protected NIOServerSocket (ServerSocketChannelImpl channel) throws IOException { @@ -67,24 +67,24 @@ public final class NIOServerSocket extends ServerSocket { try { - final Object t = this; - final Method method = ServerSocket.class.getDeclaredMethod("getImpl", new Class[0]); - method.setAccessible(true); - PrivilegedExceptionAction action = new PrivilegedExceptionAction() - { - public Object run() throws Exception - { - return method.invoke(t, new Object[0]); - } - }; - return (PlainSocketImpl) AccessController.doPrivileged(action); + final Object t = this; + final Method method = ServerSocket.class.getDeclaredMethod("getImpl", new Class[0]); + method.setAccessible(true); + PrivilegedExceptionAction action = new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + return method.invoke(t, new Object[0]); + } + }; + return (PlainSocketImpl) AccessController.doPrivileged(action); } catch (Exception e) { - // This should never happen. - Error error = new InternalError("unable to invoke method ServerSocket.getImpl()"); - error.initCause(e); - throw error; + // This should never happen. + Error error = new InternalError("unable to invoke method ServerSocket.getImpl()"); + error.initCause(e); + throw error; } } diff --git a/gnu/java/nio/NIOSocket.java b/gnu/java/nio/NIOSocket.java index 87574e491..a421e019a 100644 --- a/gnu/java/nio/NIOSocket.java +++ b/gnu/java/nio/NIOSocket.java @@ -1,4 +1,4 @@ -/* NIOSocket.java -- +/* NIOSocket.java -- Copyright (C) 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -48,7 +48,7 @@ import java.nio.channels.SocketChannel; public final class NIOSocket extends Socket { private SocketChannelImpl channel; - + protected NIOSocket (SocketChannelImpl channel) throws IOException { @@ -66,12 +66,12 @@ public final class NIOSocket extends Socket // this.impl = channel.getPlainSocketImpl(); // this.channel = channel; //} - + public final SocketChannel getChannel() { return channel; } - + public boolean isConnected() { return channel.isConnected(); diff --git a/gnu/java/nio/NIOSocketImpl.java b/gnu/java/nio/NIOSocketImpl.java index 4b26561a2..15cc07dc8 100644 --- a/gnu/java/nio/NIOSocketImpl.java +++ b/gnu/java/nio/NIOSocketImpl.java @@ -50,7 +50,7 @@ public class NIOSocketImpl extends PlainSocketImpl { private final SocketChannelImpl channel; - + NIOSocketImpl(SocketChannelImpl channel) throws IOException { this.channel = channel; diff --git a/gnu/java/nio/OutputStreamChannel.java b/gnu/java/nio/OutputStreamChannel.java index 8167426b0..ac2e7888d 100644 --- a/gnu/java/nio/OutputStreamChannel.java +++ b/gnu/java/nio/OutputStreamChannel.java @@ -1,4 +1,4 @@ -/* OutputStreamChannel.java -- +/* OutputStreamChannel.java -- Copyright (C) 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -51,11 +51,11 @@ public final class OutputStreamChannel implements WritableByteChannel { private boolean closed = false; private OutputStream out; - + public OutputStreamChannel (OutputStream out) { super(); - + this.out = out; } @@ -72,12 +72,12 @@ public final class OutputStreamChannel implements WritableByteChannel { return !closed; } - + public int write (ByteBuffer src) throws IOException { if (!isOpen()) throw new ClosedChannelException(); - + int len = src.remaining(); byte[] buffer = new byte [len]; src.get (buffer); diff --git a/gnu/java/nio/PipeImpl.java b/gnu/java/nio/PipeImpl.java index 8a95b9622..143af1a24 100644 --- a/gnu/java/nio/PipeImpl.java +++ b/gnu/java/nio/PipeImpl.java @@ -1,4 +1,4 @@ -/* PipeImpl.java -- +/* PipeImpl.java -- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -49,7 +49,7 @@ class PipeImpl extends Pipe implements VMChannelOwner { private VMChannel vmch; - + public SourceChannelImpl (SelectorProvider selectorProvider, VMChannel channel) { @@ -82,18 +82,18 @@ class PipeImpl extends Pipe } public final synchronized long read (ByteBuffer[] srcs, int offset, - int len) + int len) throws IOException { if (offset < 0 - || offset > srcs.length - || len < 0 - || len > srcs.length - offset) - throw new IndexOutOfBoundsException(); + || offset > srcs.length + || len < 0 + || len > srcs.length - offset) + throw new IndexOutOfBoundsException(); return vmch.readScattering(srcs, offset, len); } - + public VMChannel getVMChannel() { return vmch; @@ -104,7 +104,7 @@ class PipeImpl extends Pipe implements VMChannelOwner { private VMChannel vmch; - + public SinkChannelImpl (SelectorProvider selectorProvider, VMChannel channel) { @@ -140,14 +140,14 @@ class PipeImpl extends Pipe throws IOException { if (offset < 0 - || offset > srcs.length - || len < 0 - || len > srcs.length - offset) - throw new IndexOutOfBoundsException(); - + || offset > srcs.length + || len < 0 + || len > srcs.length - offset) + throw new IndexOutOfBoundsException(); + return vmch.writeGathering(srcs, offset, len); } - + public VMChannel getVMChannel() { return vmch; @@ -156,7 +156,7 @@ class PipeImpl extends Pipe private SinkChannelImpl sink; private SourceChannelImpl source; - + public PipeImpl (SelectorProvider provider) throws IOException { diff --git a/gnu/java/nio/SelectionKeyImpl.java b/gnu/java/nio/SelectionKeyImpl.java index c927f3196..a26ff8726 100644 --- a/gnu/java/nio/SelectionKeyImpl.java +++ b/gnu/java/nio/SelectionKeyImpl.java @@ -1,4 +1,4 @@ -/* SelectionKeyImpl.java -- +/* SelectionKeyImpl.java -- Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -65,7 +65,7 @@ public abstract class SelectionKeyImpl extends AbstractSelectionKey { if (!isValid()) throw new CancelledKeyException(); - + return readyOps; } @@ -73,7 +73,7 @@ public abstract class SelectionKeyImpl extends AbstractSelectionKey { if (!isValid()) throw new CancelledKeyException(); - + readyOps = ops; return this; } @@ -82,10 +82,10 @@ public abstract class SelectionKeyImpl extends AbstractSelectionKey { if (!isValid()) throw new CancelledKeyException(); - + synchronized (impl.selectedKeys()) { - return interestOps; + return interestOps; } } @@ -96,11 +96,11 @@ public abstract class SelectionKeyImpl extends AbstractSelectionKey synchronized (impl.selectedKeys()) { - interestOps = ops; + interestOps = ops; } return this; } - + public Selector selector () { return impl; diff --git a/gnu/java/nio/SelectorImpl.java b/gnu/java/nio/SelectorImpl.java index c08478c99..21238f20f 100644 --- a/gnu/java/nio/SelectorImpl.java +++ b/gnu/java/nio/SelectorImpl.java @@ -1,4 +1,4 @@ -/* SelectorImpl.java -- +/* SelectorImpl.java -- Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -62,12 +62,12 @@ public class SelectorImpl extends AbstractSelector * selectThread and unhandledWakeup fields. */ private Object selectThreadMutex = new Object (); - + /** * Any thread that's currently blocked in a select operation. */ private Thread selectThread; - + /** * Indicates whether we have an unhandled wakeup call. This can * be due to either wakeup() triggering a thread interruption while @@ -82,7 +82,7 @@ public class SelectorImpl extends AbstractSelector public SelectorImpl (SelectorProvider provider) { super (provider); - + keys = new HashSet<SelectionKey> (); selected = new HashSet<SelectionKey> (); } @@ -97,7 +97,7 @@ public class SelectorImpl extends AbstractSelector { // Cancel any pending select operation. wakeup(); - + synchronized (keys) { synchronized (selected) @@ -117,7 +117,7 @@ public class SelectorImpl extends AbstractSelector return Collections.unmodifiableSet (keys); } - + public final int selectNow() throws IOException { @@ -174,7 +174,7 @@ public class SelectorImpl extends AbstractSelector { if (!isOpen()) throw new ClosedSelectorException(); - + synchronized (keys) { synchronized (selected) @@ -199,7 +199,7 @@ public class SelectorImpl extends AbstractSelector // FIXME: Not sure from the spec at what point we should // return "immediately". Is it here or immediately upon // entry to this function? - + // NOTE: There's a possibility of another thread calling // wakeup() immediately after our thread releases // selectThreadMutex's monitor here, in which case we'll @@ -285,18 +285,18 @@ public class SelectorImpl extends AbstractSelector // Set new ready write ops for (int i = 0; i < write.length; i++) { - if (key.getNativeFD() == write[i]) - { - if (key.channel() instanceof SocketChannel) - { - if (((SocketChannel) key.channel ()).isConnected ()) - ops = ops | SelectionKey.OP_WRITE; - else - ops = ops | SelectionKey.OP_CONNECT; - } - else - ops = ops | SelectionKey.OP_WRITE; - } + if (key.getNativeFD() == write[i]) + { + if (key.channel() instanceof SocketChannel) + { + if (((SocketChannel) key.channel ()).isConnected ()) + ops = ops | SelectionKey.OP_WRITE; + else + ops = ops | SelectionKey.OP_CONNECT; + } + else + ops = ops | SelectionKey.OP_WRITE; + } } // FIXME: We dont handle exceptional file descriptors yet. @@ -311,12 +311,12 @@ public class SelectorImpl extends AbstractSelector key.readyOps (key.interestOps () & ops); } deregisterCancelledKeys(); - + return result; } } } - + public final Set<SelectionKey> selectedKeys() { if (!isOpen()) @@ -332,19 +332,19 @@ public class SelectorImpl extends AbstractSelector // do the reverse under the covers: wakeup triggers a thread // interrupt followed by a subsequent reset of the thread's // interrupt status within select(). - + // First, acquire the monitor of the object regulating // access to our selectThread and unhandledWakeup fields. synchronized (selectThreadMutex) { unhandledWakeup = true; - + // Interrupt any thread which is currently blocked in // a select operation. if (selectThread != null) selectThread.interrupt (); } - + return this; } @@ -372,7 +372,7 @@ public class SelectorImpl extends AbstractSelector Object att) { SelectionKeyImpl result; - + if (ch instanceof SocketChannelImpl) result = new SocketChannelSelectionKey (ch, this); else if (ch instanceof DatagramChannelImpl) @@ -388,8 +388,8 @@ public class SelectorImpl extends AbstractSelector { keys.add (result); - result.interestOps (ops); - result.attach (att); + result.interestOps (ops); + result.attach (att); } return result; diff --git a/gnu/java/nio/SelectorProviderImpl.java b/gnu/java/nio/SelectorProviderImpl.java index 0c509b985..a205bbd61 100644 --- a/gnu/java/nio/SelectorProviderImpl.java +++ b/gnu/java/nio/SelectorProviderImpl.java @@ -1,4 +1,4 @@ -/* SelectorProviderImpl.java -- +/* SelectorProviderImpl.java -- Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -54,7 +54,7 @@ public class SelectorProviderImpl extends SelectorProvider private static final String SELECTOR_IMPL_EPOLL = "epoll"; private static final String SELECTOR_IMPL = "gnu.java.nio.selectorImpl"; private static boolean epoll_failed = false; - + public SelectorProviderImpl () { } @@ -70,7 +70,7 @@ public class SelectorProviderImpl extends SelectorProvider { return new PipeImpl (this); } - + public AbstractSelector openSelector () throws IOException { diff --git a/gnu/java/nio/ServerSocketChannelImpl.java b/gnu/java/nio/ServerSocketChannelImpl.java index 0128661e5..567fc90c7 100644 --- a/gnu/java/nio/ServerSocketChannelImpl.java +++ b/gnu/java/nio/ServerSocketChannelImpl.java @@ -1,4 +1,4 @@ -/* ServerSocketChannelImpl.java -- +/* ServerSocketChannelImpl.java -- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -97,7 +97,7 @@ public final class ServerSocketChannelImpl extends ServerSocketChannel throw new NotYetBoundException(); boolean completed = false; - + try { begin(); @@ -120,7 +120,7 @@ public final class ServerSocketChannelImpl extends ServerSocketChannel { return serverSocket; } - + public VMChannel getVMChannel() { return channel; diff --git a/gnu/java/nio/ServerSocketChannelSelectionKey.java b/gnu/java/nio/ServerSocketChannelSelectionKey.java index 5b510cb6f..a4b2891a2 100644 --- a/gnu/java/nio/ServerSocketChannelSelectionKey.java +++ b/gnu/java/nio/ServerSocketChannelSelectionKey.java @@ -1,4 +1,4 @@ -/* ServerSocketChannelSelectionKey.java -- +/* ServerSocketChannelSelectionKey.java -- Copyright (C) 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/nio/SocketChannelImpl.java b/gnu/java/nio/SocketChannelImpl.java index 9564592e0..0bb378c64 100644 --- a/gnu/java/nio/SocketChannelImpl.java +++ b/gnu/java/nio/SocketChannelImpl.java @@ -1,4 +1,4 @@ -/* SocketChannelImpl.java -- +/* SocketChannelImpl.java -- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -62,7 +62,7 @@ public final class SocketChannelImpl extends SocketChannel private boolean connectionPending; private boolean connected; private InetSocketAddress connectAddress; - + public SocketChannelImpl(boolean create) throws IOException { // XXX consider adding security check; this is used by @@ -74,7 +74,7 @@ public final class SocketChannelImpl extends SocketChannel { this(new SelectorProviderImpl(), channel, false); } - + SocketChannelImpl(SelectorProvider provider) throws IOException { this(provider, true); @@ -85,7 +85,7 @@ public final class SocketChannelImpl extends SocketChannel { this(provider, new VMChannel(), create); } - + SocketChannelImpl(SelectorProvider provider, VMChannel channel, boolean create) throws IOException { @@ -96,7 +96,7 @@ public final class SocketChannelImpl extends SocketChannel socket = new NIOSocket(this); configureBlocking(true); } - + /*SocketChannelImpl (SelectorProvider provider, NIOSocket socket) throws IOException @@ -133,18 +133,18 @@ public final class SocketChannelImpl extends SocketChannel protected void implConfigureBlocking (boolean blocking) throws IOException { channel.setBlocking(blocking); - } + } public boolean connect (SocketAddress remote) throws IOException { return connect(remote, 0); } - + public boolean connect (SocketAddress remote, int timeout) throws IOException { if (!isOpen()) throw new ClosedChannelException(); - + if (isConnected()) throw new AlreadyConnectedException(); @@ -153,12 +153,12 @@ public final class SocketChannelImpl extends SocketChannel if (!(remote instanceof InetSocketAddress)) throw new UnsupportedAddressTypeException(); - + connectAddress = (InetSocketAddress) remote; if (connectAddress.isUnresolved()) throw new UnresolvedAddressException(); - + connected = channel.connect(connectAddress, timeout); connectionPending = !connected; return connected; @@ -176,10 +176,10 @@ public final class SocketChannelImpl extends SocketChannel connectionPending = false; return true; } - + if (!connectionPending) throw new NoConnectionPendingException(); - + return false; } @@ -200,12 +200,12 @@ public final class SocketChannelImpl extends SocketChannel return false; } } - + public boolean isConnectionPending () { return connectionPending; } - + public Socket socket () { return socket; @@ -215,25 +215,25 @@ public final class SocketChannelImpl extends SocketChannel { if (!isConnected()) throw new NotYetConnectedException(); - + return channel.read(dst); } - + public long read (ByteBuffer[] dsts, int offset, int length) throws IOException { if (!isConnected()) throw new NotYetConnectedException(); - + if ((offset < 0) || (offset > dsts.length) || (length < 0) || (length > (dsts.length - offset))) throw new IndexOutOfBoundsException(); - + return channel.readScattering(dsts, offset, length); } - + public int write(ByteBuffer src) throws IOException { if (!isConnected()) @@ -247,7 +247,7 @@ public final class SocketChannelImpl extends SocketChannel { if (!isConnected()) throw new NotYetConnectedException(); - + if ((offset < 0) || (offset > srcs.length) || (length < 0) @@ -256,7 +256,7 @@ public final class SocketChannelImpl extends SocketChannel return channel.writeGathering(srcs, offset, length); } - + public VMChannel getVMChannel() { // XXX security check? diff --git a/gnu/java/nio/SocketChannelSelectionKey.java b/gnu/java/nio/SocketChannelSelectionKey.java index 9ceebdec9..100368995 100644 --- a/gnu/java/nio/SocketChannelSelectionKey.java +++ b/gnu/java/nio/SocketChannelSelectionKey.java @@ -1,4 +1,4 @@ -/* SocketChannelSelectionKey.java -- +/* SocketChannelSelectionKey.java -- Copyright (C) 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -49,7 +49,7 @@ public final class SocketChannelSelectionKey { super (channel, selector); } - + // FIXME don't use file descriptor integers public int getNativeFD() { diff --git a/gnu/java/nio/SocketChannelSelectionKeyImpl.java b/gnu/java/nio/SocketChannelSelectionKeyImpl.java index 7557e28c4..786aa361e 100644 --- a/gnu/java/nio/SocketChannelSelectionKeyImpl.java +++ b/gnu/java/nio/SocketChannelSelectionKeyImpl.java @@ -49,7 +49,7 @@ public class SocketChannelSelectionKeyImpl extends SelectionKeyImpl { SocketChannelImpl ch; - + /** * @param ch * @param impl diff --git a/gnu/java/nio/VMChannelOwner.java b/gnu/java/nio/VMChannelOwner.java index 363dea2b2..87cbc1e94 100644 --- a/gnu/java/nio/VMChannelOwner.java +++ b/gnu/java/nio/VMChannelOwner.java @@ -50,7 +50,7 @@ interface VMChannelOwner { /** * Return the underlying platform-specific Channel instance. - * + * * @return The platform channel object. */ VMChannel getVMChannel(); diff --git a/gnu/java/nio/charset/ByteCharset.java b/gnu/java/nio/charset/ByteCharset.java index 043c804b7..60d06fc4b 100644 --- a/gnu/java/nio/charset/ByteCharset.java +++ b/gnu/java/nio/charset/ByteCharset.java @@ -47,10 +47,10 @@ import java.nio.charset.CoderResult; /** * A generic encoding framework for single-byte encodings, utilizing a look-up * table. - * + * * This replaces the gnu.java.io.EncoderEightBitLookup class, created by Aron * Renn. - * + * * @author Sven de Marothy * @modified Ian Rogers */ @@ -96,7 +96,7 @@ abstract class ByteCharset extends Charset { /** Lookup of byte to char mappings */ private final char[] lookup; - + /** Helper to decode loops */ private final ByteDecodeLoopHelper helper = new ByteDecodeLoopHelper() { @@ -109,7 +109,7 @@ abstract class ByteCharset extends Charset return lookup[(int) (b & 0xFF)]; } }; - + // Package-private to avoid a trampoline constructor. Decoder(ByteCharset cs) { @@ -127,7 +127,7 @@ abstract class ByteCharset extends Charset { /** Lookup of char to byte mappings */ private final byte[] lookup; - + /** Helper to encode loops */ private final ByteEncodeLoopHelper helper = new ByteEncodeLoopHelper() { @@ -140,7 +140,7 @@ abstract class ByteCharset extends Charset return lookup[c]; } }; - + // Package-private to avoid a trampoline constructor. Encoder(ByteCharset cs) { diff --git a/gnu/java/nio/charset/ByteDecodeLoopHelper.java b/gnu/java/nio/charset/ByteDecodeLoopHelper.java index a1eb5e206..76dc20913 100644 --- a/gnu/java/nio/charset/ByteDecodeLoopHelper.java +++ b/gnu/java/nio/charset/ByteDecodeLoopHelper.java @@ -43,7 +43,7 @@ import java.nio.charset.CoderResult; /** * Helper class to deal with decoding loops that read a byte at a time - * + * * @author Ian Rogers */ public abstract class ByteDecodeLoopHelper @@ -61,7 +61,7 @@ public abstract class ByteDecodeLoopHelper /** * Encodes one or more characters into one or more bytes, mapping each * character to only one byte - * + * * @param in character buffer to read from * @param out byte buffer to write to * @return the result state of the encoder @@ -120,7 +120,7 @@ public abstract class ByteDecodeLoopHelper int outRemaining = out.remaining(); CoderResult result; - bailOut: + bailOut: if (inRemaining <= outRemaining) { for (int i = 0; i < inRemaining; i++) @@ -131,7 +131,7 @@ public abstract class ByteDecodeLoopHelper { inPos--; result = CoderResult.unmappableForLength(1); - break bailOut; + break bailOut; } char c = mapToChar(b); outArray[outPos] = c; @@ -149,7 +149,7 @@ public abstract class ByteDecodeLoopHelper { inPos--; result = CoderResult.unmappableForLength(1); - break bailOut; + break bailOut; } char c = mapToChar(b); outArray[outPos] = c; diff --git a/gnu/java/nio/charset/ByteEncodeLoopHelper.java b/gnu/java/nio/charset/ByteEncodeLoopHelper.java index b1a4f10da..60e6d9bb0 100644 --- a/gnu/java/nio/charset/ByteEncodeLoopHelper.java +++ b/gnu/java/nio/charset/ByteEncodeLoopHelper.java @@ -43,7 +43,7 @@ import java.nio.charset.CoderResult; /** * Helper class to deal with encoding loops that write a byte at a time - * + * * @author Ian Rogers */ public abstract class ByteEncodeLoopHelper @@ -62,7 +62,7 @@ public abstract class ByteEncodeLoopHelper /** * Encodes one or more characters into one or more bytes, mapping each * character to only one byte - * + * * @param in character buffer to read from * @param out byte buffer to write to * @return the result state of the encoder @@ -121,7 +121,7 @@ public abstract class ByteEncodeLoopHelper int outRemaining = out.remaining(); CoderResult result; - bailOut: + bailOut: if (inRemaining <= outRemaining) { for (int i = 0; i < inRemaining; i++) diff --git a/gnu/java/nio/charset/Cp424.java b/gnu/java/nio/charset/Cp424.java index 44e1eba4f..14915bf47 100644 --- a/gnu/java/nio/charset/Cp424.java +++ b/gnu/java/nio/charset/Cp424.java @@ -45,38 +45,38 @@ public final class Cp424 extends ByteCharset */ private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x009C, 0x0009, 0x0086, 0x007F, - 0x0097, 0x008D, 0x008E, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x009D, 0x0085, 0x0008, 0x0087, - 0x0018, 0x0019, 0x0092, 0x008F, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x000A, 0x0017, 0x001B, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x0005, 0x0006, 0x0007, - 0x0090, 0x0091, 0x0016, 0x0093, 0x0094, 0x0095, 0x0096, 0x0004, - 0x0098, 0x0099, 0x009A, 0x009B, 0x0014, 0x0015, 0x009E, 0x001A, - 0x0020, 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, - 0x05D7, 0x05D8, 0x00A2, 0x002E, 0x003C, 0x0028, 0x002B, 0x007C, - 0x0026, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, - 0x05E0, 0x05E1, 0x0021, 0x0024, 0x002A, 0x0029, 0x003B, 0x00AC, - 0x002D, 0x002F, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, - 0x05E8, 0x05E9, 0x00A6, 0x002C, 0x0025, 0x005F, 0x003E, 0x003F, - NONE, 0x05EA, NONE, NONE, 0x00A0, NONE, NONE, NONE, - 0x2017, 0x0060, 0x003A, 0x0023, 0x0040, 0x0027, 0x003D, 0x0022, - NONE, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x00AB, 0x00BB, NONE, NONE, NONE, 0x00B1, - 0x00B0, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, - 0x0071, 0x0072, NONE, NONE, NONE, 0x00B8, NONE, 0x00A4, - 0x00B5, 0x007E, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, - 0x0079, 0x007A, NONE, NONE, NONE, NONE, NONE, 0x00AE, - 0x005E, 0x00A3, 0x00A5, 0x00B7, 0x00A9, 0x00A7, 0x00B6, 0x00BC, - 0x00BD, 0x00BE, 0x005B, 0x005D, 0x00AF, 0x00A8, 0x00B4, 0x00D7, - 0x007B, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x00AD, NONE, NONE, NONE, NONE, NONE, - 0x007D, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, - 0x0051, 0x0052, 0x00B9, NONE, NONE, NONE, NONE, NONE, - 0x005C, 0x00F7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, - 0x0059, 0x005A, 0x00B2, NONE, NONE, NONE, NONE, NONE, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x00B3, NONE, NONE, NONE, NONE, 0x009F + 0x0000, 0x0001, 0x0002, 0x0003, 0x009C, 0x0009, 0x0086, 0x007F, + 0x0097, 0x008D, 0x008E, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x009D, 0x0085, 0x0008, 0x0087, + 0x0018, 0x0019, 0x0092, 0x008F, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x000A, 0x0017, 0x001B, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x0005, 0x0006, 0x0007, + 0x0090, 0x0091, 0x0016, 0x0093, 0x0094, 0x0095, 0x0096, 0x0004, + 0x0098, 0x0099, 0x009A, 0x009B, 0x0014, 0x0015, 0x009E, 0x001A, + 0x0020, 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, + 0x05D7, 0x05D8, 0x00A2, 0x002E, 0x003C, 0x0028, 0x002B, 0x007C, + 0x0026, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, + 0x05E0, 0x05E1, 0x0021, 0x0024, 0x002A, 0x0029, 0x003B, 0x00AC, + 0x002D, 0x002F, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, + 0x05E8, 0x05E9, 0x00A6, 0x002C, 0x0025, 0x005F, 0x003E, 0x003F, + NONE, 0x05EA, NONE, NONE, 0x00A0, NONE, NONE, NONE, + 0x2017, 0x0060, 0x003A, 0x0023, 0x0040, 0x0027, 0x003D, 0x0022, + NONE, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x00AB, 0x00BB, NONE, NONE, NONE, 0x00B1, + 0x00B0, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, + 0x0071, 0x0072, NONE, NONE, NONE, 0x00B8, NONE, 0x00A4, + 0x00B5, 0x007E, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, + 0x0079, 0x007A, NONE, NONE, NONE, NONE, NONE, 0x00AE, + 0x005E, 0x00A3, 0x00A5, 0x00B7, 0x00A9, 0x00A7, 0x00B6, 0x00BC, + 0x00BD, 0x00BE, 0x005B, 0x005D, 0x00AF, 0x00A8, 0x00B4, 0x00D7, + 0x007B, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x00AD, NONE, NONE, NONE, NONE, NONE, + 0x007D, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, + 0x0051, 0x0052, 0x00B9, NONE, NONE, NONE, NONE, NONE, + 0x005C, 0x00F7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, + 0x0059, 0x005A, 0x00B2, NONE, NONE, NONE, NONE, NONE, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x00B3, NONE, NONE, NONE, NONE, 0x009F }; public Cp424() { diff --git a/gnu/java/nio/charset/Cp437.java b/gnu/java/nio/charset/Cp437.java index e38a48257..f60c3add2 100644 --- a/gnu/java/nio/charset/Cp437.java +++ b/gnu/java/nio/charset/Cp437.java @@ -43,40 +43,40 @@ public final class Cp437 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, - 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, - 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, - 0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192, - 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, - 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, - 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, - 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, - 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, - 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, - 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, - 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, + 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, + 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, + 0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192, + 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, + 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, + 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, + 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, + 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, + 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, + 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, + 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 }; public Cp437() diff --git a/gnu/java/nio/charset/Cp737.java b/gnu/java/nio/charset/Cp737.java index 2187987ea..5dbd4a463 100644 --- a/gnu/java/nio/charset/Cp737.java +++ b/gnu/java/nio/charset/Cp737.java @@ -43,45 +43,45 @@ public final class Cp737 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, - 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, 0x03A0, - 0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, - 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, - 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, - 0x03C1, 0x03C3, 0x03C2, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, - 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, - 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, - 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x03C9, 0x03AC, 0x03AD, 0x03AE, 0x03CA, 0x03AF, 0x03CC, 0x03CD, - 0x03CB, 0x03CE, 0x0386, 0x0388, 0x0389, 0x038A, 0x038C, 0x038E, - 0x038F, 0x00B1, 0x2265, 0x2264, 0x03AA, 0x03AB, 0x00F7, 0x2248, - 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, + 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, 0x03A0, + 0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, + 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, + 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, + 0x03C1, 0x03C3, 0x03C2, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, + 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, + 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, + 0x03C9, 0x03AC, 0x03AD, 0x03AE, 0x03CA, 0x03AF, 0x03CC, 0x03CD, + 0x03CB, 0x03CE, 0x0386, 0x0388, 0x0389, 0x038A, 0x038C, 0x038E, + 0x038F, 0x00B1, 0x2265, 0x2264, 0x03AA, 0x03AB, 0x00F7, 0x2248, + 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 }; public Cp737() { - super("Cp737", new String[] {}, lookup); + super("Cp737", new String[] {}, lookup); } } // class Cp737 diff --git a/gnu/java/nio/charset/Cp775.java b/gnu/java/nio/charset/Cp775.java index f2fba4356..ba3128e30 100644 --- a/gnu/java/nio/charset/Cp775.java +++ b/gnu/java/nio/charset/Cp775.java @@ -43,45 +43,45 @@ public final class Cp775 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0106, 0x00FC, 0x00E9, 0x0101, 0x00E4, 0x0123, 0x00E5, 0x0107, - 0x0142, 0x0113, 0x0156, 0x0157, 0x012B, 0x0179, 0x00C4, 0x00C5, - 0x00C9, 0x00E6, 0x00C6, 0x014D, 0x00F6, 0x0122, 0x00A2, 0x015A, - 0x015B, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x00A4, - 0x0100, 0x012A, 0x00F3, 0x017B, 0x017C, 0x017A, 0x201D, 0x00A6, - 0x00A9, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x0141, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x0104, 0x010C, 0x0118, - 0x0116, 0x2563, 0x2551, 0x2557, 0x255D, 0x012E, 0x0160, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x0172, 0x016A, - 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x017D, - 0x0105, 0x010D, 0x0119, 0x0117, 0x012F, 0x0161, 0x0173, 0x016B, - 0x017E, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x00D3, 0x00DF, 0x014C, 0x0143, 0x00F5, 0x00D5, 0x00B5, 0x0144, - 0x0136, 0x0137, 0x013B, 0x013C, 0x0146, 0x0112, 0x0145, 0x2019, - 0x00AD, 0x00B1, 0x201C, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x201E, - 0x00B0, 0x2219, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0106, 0x00FC, 0x00E9, 0x0101, 0x00E4, 0x0123, 0x00E5, 0x0107, + 0x0142, 0x0113, 0x0156, 0x0157, 0x012B, 0x0179, 0x00C4, 0x00C5, + 0x00C9, 0x00E6, 0x00C6, 0x014D, 0x00F6, 0x0122, 0x00A2, 0x015A, + 0x015B, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x00A4, + 0x0100, 0x012A, 0x00F3, 0x017B, 0x017C, 0x017A, 0x201D, 0x00A6, + 0x00A9, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x0141, 0x00AB, 0x00BB, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x0104, 0x010C, 0x0118, + 0x0116, 0x2563, 0x2551, 0x2557, 0x255D, 0x012E, 0x0160, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x0172, 0x016A, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x017D, + 0x0105, 0x010D, 0x0119, 0x0117, 0x012F, 0x0161, 0x0173, 0x016B, + 0x017E, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, + 0x00D3, 0x00DF, 0x014C, 0x0143, 0x00F5, 0x00D5, 0x00B5, 0x0144, + 0x0136, 0x0137, 0x013B, 0x013C, 0x0146, 0x0112, 0x0145, 0x2019, + 0x00AD, 0x00B1, 0x201C, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x201E, + 0x00B0, 0x2219, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0 }; public Cp775() { - super("Cp775", new String[] {}, lookup); + super("Cp775", new String[] {}, lookup); } } // class Cp775 diff --git a/gnu/java/nio/charset/Cp850.java b/gnu/java/nio/charset/Cp850.java index 48d4fb344..fef468994 100644 --- a/gnu/java/nio/charset/Cp850.java +++ b/gnu/java/nio/charset/Cp850.java @@ -43,45 +43,45 @@ public final class Cp850 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, - 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, - 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, - 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192, - 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, - 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, - 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, - 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, - 0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE, - 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580, - 0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE, - 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4, - 0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, - 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, + 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, + 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, + 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192, + 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, + 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, + 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, + 0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE, + 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580, + 0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE, + 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4, + 0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, + 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0 }; public Cp850() { - super("Cp850", new String[] {}, lookup); + super("Cp850", new String[] {}, lookup); } } // class Cp850 diff --git a/gnu/java/nio/charset/Cp852.java b/gnu/java/nio/charset/Cp852.java index c550944b5..eea99610d 100644 --- a/gnu/java/nio/charset/Cp852.java +++ b/gnu/java/nio/charset/Cp852.java @@ -43,45 +43,45 @@ public final class Cp852 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x016F, 0x0107, 0x00E7, - 0x0142, 0x00EB, 0x0150, 0x0151, 0x00EE, 0x0179, 0x00C4, 0x0106, - 0x00C9, 0x0139, 0x013A, 0x00F4, 0x00F6, 0x013D, 0x013E, 0x015A, - 0x015B, 0x00D6, 0x00DC, 0x0164, 0x0165, 0x0141, 0x00D7, 0x010D, - 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x0104, 0x0105, 0x017D, 0x017E, - 0x0118, 0x0119, 0x00AC, 0x017A, 0x010C, 0x015F, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x011A, - 0x015E, 0x2563, 0x2551, 0x2557, 0x255D, 0x017B, 0x017C, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x0102, 0x0103, - 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, - 0x0111, 0x0110, 0x010E, 0x00CB, 0x010F, 0x0147, 0x00CD, 0x00CE, - 0x011B, 0x2518, 0x250C, 0x2588, 0x2584, 0x0162, 0x016E, 0x2580, - 0x00D3, 0x00DF, 0x00D4, 0x0143, 0x0144, 0x0148, 0x0160, 0x0161, - 0x0154, 0x00DA, 0x0155, 0x0170, 0x00FD, 0x00DD, 0x0163, 0x00B4, - 0x00AD, 0x02DD, 0x02DB, 0x02C7, 0x02D8, 0x00A7, 0x00F7, 0x00B8, - 0x00B0, 0x00A8, 0x02D9, 0x0171, 0x0158, 0x0159, 0x25A0, 0x00A0 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x016F, 0x0107, 0x00E7, + 0x0142, 0x00EB, 0x0150, 0x0151, 0x00EE, 0x0179, 0x00C4, 0x0106, + 0x00C9, 0x0139, 0x013A, 0x00F4, 0x00F6, 0x013D, 0x013E, 0x015A, + 0x015B, 0x00D6, 0x00DC, 0x0164, 0x0165, 0x0141, 0x00D7, 0x010D, + 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x0104, 0x0105, 0x017D, 0x017E, + 0x0118, 0x0119, 0x00AC, 0x017A, 0x010C, 0x015F, 0x00AB, 0x00BB, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x011A, + 0x015E, 0x2563, 0x2551, 0x2557, 0x255D, 0x017B, 0x017C, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x0102, 0x0103, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, + 0x0111, 0x0110, 0x010E, 0x00CB, 0x010F, 0x0147, 0x00CD, 0x00CE, + 0x011B, 0x2518, 0x250C, 0x2588, 0x2584, 0x0162, 0x016E, 0x2580, + 0x00D3, 0x00DF, 0x00D4, 0x0143, 0x0144, 0x0148, 0x0160, 0x0161, + 0x0154, 0x00DA, 0x0155, 0x0170, 0x00FD, 0x00DD, 0x0163, 0x00B4, + 0x00AD, 0x02DD, 0x02DB, 0x02C7, 0x02D8, 0x00A7, 0x00F7, 0x00B8, + 0x00B0, 0x00A8, 0x02D9, 0x0171, 0x0158, 0x0159, 0x25A0, 0x00A0 }; public Cp852() { - super("Cp852", new String[] {}, lookup); + super("Cp852", new String[] {}, lookup); } } // class Cp852 diff --git a/gnu/java/nio/charset/Cp855.java b/gnu/java/nio/charset/Cp855.java index 141e891b6..d148d32b4 100644 --- a/gnu/java/nio/charset/Cp855.java +++ b/gnu/java/nio/charset/Cp855.java @@ -43,45 +43,45 @@ public final class Cp855 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0452, 0x0402, 0x0453, 0x0403, 0x0451, 0x0401, 0x0454, 0x0404, - 0x0455, 0x0405, 0x0456, 0x0406, 0x0457, 0x0407, 0x0458, 0x0408, - 0x0459, 0x0409, 0x045A, 0x040A, 0x045B, 0x040B, 0x045C, 0x040C, - 0x045E, 0x040E, 0x045F, 0x040F, 0x044E, 0x042E, 0x044A, 0x042A, - 0x0430, 0x0410, 0x0431, 0x0411, 0x0446, 0x0426, 0x0434, 0x0414, - 0x0435, 0x0415, 0x0444, 0x0424, 0x0433, 0x0413, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x0445, 0x0425, 0x0438, - 0x0418, 0x2563, 0x2551, 0x2557, 0x255D, 0x0439, 0x0419, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x043A, 0x041A, - 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, - 0x043B, 0x041B, 0x043C, 0x041C, 0x043D, 0x041D, 0x043E, 0x041E, - 0x043F, 0x2518, 0x250C, 0x2588, 0x2584, 0x041F, 0x044F, 0x2580, - 0x042F, 0x0440, 0x0420, 0x0441, 0x0421, 0x0442, 0x0422, 0x0443, - 0x0423, 0x0436, 0x0416, 0x0432, 0x0412, 0x044C, 0x042C, 0x2116, - 0x00AD, 0x044B, 0x042B, 0x0437, 0x0417, 0x0448, 0x0428, 0x044D, - 0x042D, 0x0449, 0x0429, 0x0447, 0x0427, 0x00A7, 0x25A0, 0x00A0 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0452, 0x0402, 0x0453, 0x0403, 0x0451, 0x0401, 0x0454, 0x0404, + 0x0455, 0x0405, 0x0456, 0x0406, 0x0457, 0x0407, 0x0458, 0x0408, + 0x0459, 0x0409, 0x045A, 0x040A, 0x045B, 0x040B, 0x045C, 0x040C, + 0x045E, 0x040E, 0x045F, 0x040F, 0x044E, 0x042E, 0x044A, 0x042A, + 0x0430, 0x0410, 0x0431, 0x0411, 0x0446, 0x0426, 0x0434, 0x0414, + 0x0435, 0x0415, 0x0444, 0x0424, 0x0433, 0x0413, 0x00AB, 0x00BB, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x0445, 0x0425, 0x0438, + 0x0418, 0x2563, 0x2551, 0x2557, 0x255D, 0x0439, 0x0419, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x043A, 0x041A, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, + 0x043B, 0x041B, 0x043C, 0x041C, 0x043D, 0x041D, 0x043E, 0x041E, + 0x043F, 0x2518, 0x250C, 0x2588, 0x2584, 0x041F, 0x044F, 0x2580, + 0x042F, 0x0440, 0x0420, 0x0441, 0x0421, 0x0442, 0x0422, 0x0443, + 0x0423, 0x0436, 0x0416, 0x0432, 0x0412, 0x044C, 0x042C, 0x2116, + 0x00AD, 0x044B, 0x042B, 0x0437, 0x0417, 0x0448, 0x0428, 0x044D, + 0x042D, 0x0449, 0x0429, 0x0447, 0x0427, 0x00A7, 0x25A0, 0x00A0 }; public Cp855() { - super("Cp855", new String[] {"cp-855",}, lookup); + super("Cp855", new String[] {"cp-855",}, lookup); } } // class Cp855 diff --git a/gnu/java/nio/charset/Cp857.java b/gnu/java/nio/charset/Cp857.java index b517b0393..0d990ec2c 100644 --- a/gnu/java/nio/charset/Cp857.java +++ b/gnu/java/nio/charset/Cp857.java @@ -44,45 +44,45 @@ public final class Cp857 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, - 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x0131, 0x00C4, 0x00C5, - 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, - 0x0130, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x015E, 0x015F, - 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x011E, 0x011F, - 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, - 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, - 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, - 0x00BA, 0x00AA, 0x00CA, 0x00CB, 0x00C8, NONE, 0x00CD, 0x00CE, - 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580, - 0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, NONE, - 0x00D7, 0x00DA, 0x00DB, 0x00D9, 0x00EC, 0x00FF, 0x00AF, 0x00B4, - 0x00AD, 0x00B1, NONE, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, - 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, + 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x0131, 0x00C4, 0x00C5, + 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, + 0x0130, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x015E, 0x015F, + 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x011E, 0x011F, + 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, + 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, + 0x00BA, 0x00AA, 0x00CA, 0x00CB, 0x00C8, NONE, 0x00CD, 0x00CE, + 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580, + 0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, NONE, + 0x00D7, 0x00DA, 0x00DB, 0x00D9, 0x00EC, 0x00FF, 0x00AF, 0x00B4, + 0x00AD, 0x00B1, NONE, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, + 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0 }; public Cp857() { - super("Cp857", new String[] {"cp-857"}, lookup); + super("Cp857", new String[] {"cp-857"}, lookup); } } // class Cp857 diff --git a/gnu/java/nio/charset/Cp860.java b/gnu/java/nio/charset/Cp860.java index 58a396446..4e15329ca 100644 --- a/gnu/java/nio/charset/Cp860.java +++ b/gnu/java/nio/charset/Cp860.java @@ -44,45 +44,45 @@ public final class Cp860 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E3, 0x00E0, 0x00C1, 0x00E7, - 0x00EA, 0x00CA, 0x00E8, 0x00CD, 0x00D4, 0x00EC, 0x00C3, 0x00C2, - 0x00C9, 0x00C0, 0x00C8, 0x00F4, 0x00F5, 0x00F2, 0x00DA, 0x00F9, - 0x00CC, 0x00D5, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x20A7, 0x00D3, - 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, - 0x00BF, 0x00D2, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, - 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, - 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, - 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, - 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, - 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, - 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E3, 0x00E0, 0x00C1, 0x00E7, + 0x00EA, 0x00CA, 0x00E8, 0x00CD, 0x00D4, 0x00EC, 0x00C3, 0x00C2, + 0x00C9, 0x00C0, 0x00C8, 0x00F4, 0x00F5, 0x00F2, 0x00DA, 0x00F9, + 0x00CC, 0x00D5, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x20A7, 0x00D3, + 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, + 0x00BF, 0x00D2, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, + 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, + 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, + 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, + 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, + 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, + 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 }; public Cp860() { - super("Cp860", new String[] {"cp-860"}, lookup); + super("Cp860", new String[] {"cp-860"}, lookup); } } // class Cp860 diff --git a/gnu/java/nio/charset/Cp861.java b/gnu/java/nio/charset/Cp861.java index cf5210d0a..e5a103f67 100644 --- a/gnu/java/nio/charset/Cp861.java +++ b/gnu/java/nio/charset/Cp861.java @@ -44,45 +44,45 @@ public final class Cp861 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, - 0x00EA, 0x00EB, 0x00E8, 0x00D0, 0x00F0, 0x00DE, 0x00C4, 0x00C5, - 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00FE, 0x00FB, 0x00DD, - 0x00FD, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192, - 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00C1, 0x00CD, 0x00D3, 0x00DA, - 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, - 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, - 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, - 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, - 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, - 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, - 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, + 0x00EA, 0x00EB, 0x00E8, 0x00D0, 0x00F0, 0x00DE, 0x00C4, 0x00C5, + 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00FE, 0x00FB, 0x00DD, + 0x00FD, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192, + 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00C1, 0x00CD, 0x00D3, 0x00DA, + 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, + 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, + 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, + 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, + 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, + 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, + 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 }; public Cp861() { - super("Cp861", new String[] {"cp-861"}, lookup); + super("Cp861", new String[] {"cp-861"}, lookup); } } // class Cp861 diff --git a/gnu/java/nio/charset/Cp862.java b/gnu/java/nio/charset/Cp862.java index f66118021..873357433 100644 --- a/gnu/java/nio/charset/Cp862.java +++ b/gnu/java/nio/charset/Cp862.java @@ -44,45 +44,45 @@ public final class Cp862 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, - 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, - 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, - 0x05E8, 0x05E9, 0x05EA, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192, - 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, - 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, - 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, - 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, - 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, - 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, - 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, - 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, + 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, + 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, + 0x05E8, 0x05E9, 0x05EA, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192, + 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, + 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, + 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, + 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, + 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, + 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, + 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, + 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 }; public Cp862() { - super("Cp862", new String[] {"Cp-862"}, lookup); + super("Cp862", new String[] {"Cp-862"}, lookup); } } // class Cp862 diff --git a/gnu/java/nio/charset/Cp863.java b/gnu/java/nio/charset/Cp863.java index 03850234e..3a86f3e2d 100644 --- a/gnu/java/nio/charset/Cp863.java +++ b/gnu/java/nio/charset/Cp863.java @@ -44,45 +44,45 @@ public final class Cp863 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00C2, 0x00E0, 0x00B6, 0x00E7, - 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x2017, 0x00C0, 0x00A7, - 0x00C9, 0x00C8, 0x00CA, 0x00F4, 0x00CB, 0x00CF, 0x00FB, 0x00F9, - 0x00A4, 0x00D4, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x00DB, 0x0192, - 0x00A6, 0x00B4, 0x00F3, 0x00FA, 0x00A8, 0x00B8, 0x00B3, 0x00AF, - 0x00CE, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00BE, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, - 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, - 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, - 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, - 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, - 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, - 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00C2, 0x00E0, 0x00B6, 0x00E7, + 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x2017, 0x00C0, 0x00A7, + 0x00C9, 0x00C8, 0x00CA, 0x00F4, 0x00CB, 0x00CF, 0x00FB, 0x00F9, + 0x00A4, 0x00D4, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x00DB, 0x0192, + 0x00A6, 0x00B4, 0x00F3, 0x00FA, 0x00A8, 0x00B8, 0x00B3, 0x00AF, + 0x00CE, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00BE, 0x00AB, 0x00BB, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, + 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, + 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, + 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, + 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, + 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, + 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 }; public Cp863() { - super("Cp863", new String[] {"Cp-863"}, lookup); + super("Cp863", new String[] {"Cp-863"}, lookup); } } // class Cp863 diff --git a/gnu/java/nio/charset/Cp864.java b/gnu/java/nio/charset/Cp864.java index 028235dd3..990e3723d 100644 --- a/gnu/java/nio/charset/Cp864.java +++ b/gnu/java/nio/charset/Cp864.java @@ -44,45 +44,45 @@ public final class Cp864 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x066A, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x00B0, 0x00B7, 0x2219, 0x221A, 0x2592, 0x2500, 0x2502, 0x253C, - 0x2524, 0x252C, 0x251C, 0x2534, 0x2510, 0x250C, 0x2514, 0x2518, - 0x03B2, 0x221E, 0x03C6, 0x00B1, 0x00BD, 0x00BC, 0x2248, 0x00AB, - 0x00BB, 0xFEF7, 0xFEF8, NONE, NONE, 0xFEFB, 0xFEFC, NONE, - 0x00A0, 0x00AD, 0xFE82, 0x00A3, 0x00A4, 0xFE84, NONE, NONE, - 0xFE8E, 0xFE8F, 0xFE95, 0xFE99, 0x060C, 0xFE9D, 0xFEA1, 0xFEA5, - 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, - 0x0668, 0x0669, 0xFED1, 0x061B, 0xFEB1, 0xFEB5, 0xFEB9, 0x061F, - 0x00A2, 0xFE80, 0xFE81, 0xFE83, 0xFE85, 0xFECA, 0xFE8B, 0xFE8D, - 0xFE91, 0xFE93, 0xFE97, 0xFE9B, 0xFE9F, 0xFEA3, 0xFEA7, 0xFEA9, - 0xFEAB, 0xFEAD, 0xFEAF, 0xFEB3, 0xFEB7, 0xFEBB, 0xFEBF, 0xFEC1, - 0xFEC5, 0xFECB, 0xFECF, 0x00A6, 0x00AC, 0x00F7, 0x00D7, 0xFEC9, - 0x0640, 0xFED3, 0xFED7, 0xFEDB, 0xFEDF, 0xFEE3, 0xFEE7, 0xFEEB, - 0xFEED, 0xFEEF, 0xFEF3, 0xFEBD, 0xFECC, 0xFECE, 0xFECD, 0xFEE1, - 0xFE7D, 0x0651, 0xFEE5, 0xFEE9, 0xFEEC, 0xFEF0, 0xFEF2, 0xFED0, - 0xFED5, 0xFEF5, 0xFEF6, 0xFEDD, 0xFED9, 0xFEF1, 0x25A0, NONE + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x066A, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x00B0, 0x00B7, 0x2219, 0x221A, 0x2592, 0x2500, 0x2502, 0x253C, + 0x2524, 0x252C, 0x251C, 0x2534, 0x2510, 0x250C, 0x2514, 0x2518, + 0x03B2, 0x221E, 0x03C6, 0x00B1, 0x00BD, 0x00BC, 0x2248, 0x00AB, + 0x00BB, 0xFEF7, 0xFEF8, NONE, NONE, 0xFEFB, 0xFEFC, NONE, + 0x00A0, 0x00AD, 0xFE82, 0x00A3, 0x00A4, 0xFE84, NONE, NONE, + 0xFE8E, 0xFE8F, 0xFE95, 0xFE99, 0x060C, 0xFE9D, 0xFEA1, 0xFEA5, + 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, + 0x0668, 0x0669, 0xFED1, 0x061B, 0xFEB1, 0xFEB5, 0xFEB9, 0x061F, + 0x00A2, 0xFE80, 0xFE81, 0xFE83, 0xFE85, 0xFECA, 0xFE8B, 0xFE8D, + 0xFE91, 0xFE93, 0xFE97, 0xFE9B, 0xFE9F, 0xFEA3, 0xFEA7, 0xFEA9, + 0xFEAB, 0xFEAD, 0xFEAF, 0xFEB3, 0xFEB7, 0xFEBB, 0xFEBF, 0xFEC1, + 0xFEC5, 0xFECB, 0xFECF, 0x00A6, 0x00AC, 0x00F7, 0x00D7, 0xFEC9, + 0x0640, 0xFED3, 0xFED7, 0xFEDB, 0xFEDF, 0xFEE3, 0xFEE7, 0xFEEB, + 0xFEED, 0xFEEF, 0xFEF3, 0xFEBD, 0xFECC, 0xFECE, 0xFECD, 0xFEE1, + 0xFE7D, 0x0651, 0xFEE5, 0xFEE9, 0xFEEC, 0xFEF0, 0xFEF2, 0xFED0, + 0xFED5, 0xFEF5, 0xFEF6, 0xFEDD, 0xFED9, 0xFEF1, 0x25A0, NONE }; public Cp864() { - super("Cp864", new String[] {"Cp-864"}, lookup); + super("Cp864", new String[] {"Cp-864"}, lookup); } } // class Cp864 diff --git a/gnu/java/nio/charset/Cp865.java b/gnu/java/nio/charset/Cp865.java index c723e80c9..a708a8560 100644 --- a/gnu/java/nio/charset/Cp865.java +++ b/gnu/java/nio/charset/Cp865.java @@ -44,45 +44,45 @@ public final class Cp865 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, - 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, - 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, - 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192, - 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, - 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00A4, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, - 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, - 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, - 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, - 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, - 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, - 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, + 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, + 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, + 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192, + 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, + 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00A4, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, + 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, + 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, + 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, + 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, + 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, + 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 }; public Cp865() { - super("Cp865", new String[] {"Cp-865"}, lookup); + super("Cp865", new String[] {"Cp-865"}, lookup); } } // class Cp865 diff --git a/gnu/java/nio/charset/Cp866.java b/gnu/java/nio/charset/Cp866.java index 103bca7c3..0f3c23044 100644 --- a/gnu/java/nio/charset/Cp866.java +++ b/gnu/java/nio/charset/Cp866.java @@ -44,45 +44,45 @@ public final class Cp866 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, - 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, - 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, - 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, - 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, - 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, - 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, - 0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040E, 0x045E, - 0x00B0, 0x2219, 0x00B7, 0x221A, 0x2116, 0x00A4, 0x25A0, 0x00A0 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, + 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, + 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, + 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, + 0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040E, 0x045E, + 0x00B0, 0x2219, 0x00B7, 0x221A, 0x2116, 0x00A4, 0x25A0, 0x00A0 }; public Cp866() { - super("Cp866", new String[] {"cp-866"}, lookup); + super("Cp866", new String[] {"cp-866"}, lookup); } } // class Cp866 diff --git a/gnu/java/nio/charset/Cp869.java b/gnu/java/nio/charset/Cp869.java index 0632b3741..091e2e7b4 100644 --- a/gnu/java/nio/charset/Cp869.java +++ b/gnu/java/nio/charset/Cp869.java @@ -44,45 +44,45 @@ public final class Cp869 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - NONE, NONE, NONE, NONE, NONE, NONE, 0x0386, NONE, - 0x00B7, 0x00AC, 0x00A6, 0x2018, 0x2019, 0x0388, 0x2015, 0x0389, - 0x038A, 0x03AA, 0x038C, NONE, NONE, 0x038E, 0x03AB, 0x00A9, - 0x038F, 0x00B2, 0x00B3, 0x03AC, 0x00A3, 0x03AD, 0x03AE, 0x03AF, - 0x03CA, 0x0390, 0x03CC, 0x03CD, 0x0391, 0x0392, 0x0393, 0x0394, - 0x0395, 0x0396, 0x0397, 0x00BD, 0x0398, 0x0399, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x039A, 0x039B, 0x039C, - 0x039D, 0x2563, 0x2551, 0x2557, 0x255D, 0x039E, 0x039F, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x03A0, 0x03A1, - 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x03A3, - 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03B1, 0x03B2, - 0x03B3, 0x2518, 0x250C, 0x2588, 0x2584, 0x03B4, 0x03B5, 0x2580, - 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, - 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C3, 0x03C2, 0x03C4, 0x0384, - 0x00AD, 0x00B1, 0x03C5, 0x03C6, 0x03C7, 0x00A7, 0x03C8, 0x0385, - 0x00B0, 0x00A8, 0x03C9, 0x03CB, 0x03B0, 0x03CE, 0x25A0, 0x00A0 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + NONE, NONE, NONE, NONE, NONE, NONE, 0x0386, NONE, + 0x00B7, 0x00AC, 0x00A6, 0x2018, 0x2019, 0x0388, 0x2015, 0x0389, + 0x038A, 0x03AA, 0x038C, NONE, NONE, 0x038E, 0x03AB, 0x00A9, + 0x038F, 0x00B2, 0x00B3, 0x03AC, 0x00A3, 0x03AD, 0x03AE, 0x03AF, + 0x03CA, 0x0390, 0x03CC, 0x03CD, 0x0391, 0x0392, 0x0393, 0x0394, + 0x0395, 0x0396, 0x0397, 0x00BD, 0x0398, 0x0399, 0x00AB, 0x00BB, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x039A, 0x039B, 0x039C, + 0x039D, 0x2563, 0x2551, 0x2557, 0x255D, 0x039E, 0x039F, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x03A0, 0x03A1, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x03A3, + 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03B1, 0x03B2, + 0x03B3, 0x2518, 0x250C, 0x2588, 0x2584, 0x03B4, 0x03B5, 0x2580, + 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, + 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C3, 0x03C2, 0x03C4, 0x0384, + 0x00AD, 0x00B1, 0x03C5, 0x03C6, 0x03C7, 0x00A7, 0x03C8, 0x0385, + 0x00B0, 0x00A8, 0x03C9, 0x03CB, 0x03B0, 0x03CE, 0x25A0, 0x00A0 }; public Cp869() { - super("Cp869", new String[] {"Cp-869"}, lookup); + super("Cp869", new String[] {"Cp-869"}, lookup); } } // class Cp869 diff --git a/gnu/java/nio/charset/Cp874.java b/gnu/java/nio/charset/Cp874.java index f6e52c485..d399c723c 100644 --- a/gnu/java/nio/charset/Cp874.java +++ b/gnu/java/nio/charset/Cp874.java @@ -43,45 +43,45 @@ public final class Cp874 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x20AC, NONE, NONE, NONE, NONE, 0x2026, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, - NONE, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, - 0x00A0, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, - 0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F, - 0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17, - 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F, - 0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27, - 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F, - 0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37, - 0x0E38, 0x0E39, 0x0E3A, NONE, NONE, NONE, NONE, 0x0E3F, - 0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, - 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F, - 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, - 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, NONE, NONE, NONE, NONE + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, NONE, NONE, NONE, NONE, 0x2026, NONE, NONE, + NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, + NONE, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, + 0x00A0, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, + 0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F, + 0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17, + 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F, + 0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27, + 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F, + 0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37, + 0x0E38, 0x0E39, 0x0E3A, NONE, NONE, NONE, NONE, 0x0E3F, + 0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, + 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F, + 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, + 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, NONE, NONE, NONE, NONE }; public Cp874() { - super("Cp874", new String[] {}, lookup); + super("Cp874", new String[] {}, lookup); } } // class Cp874 diff --git a/gnu/java/nio/charset/EncodingHelper.java b/gnu/java/nio/charset/EncodingHelper.java index 479b6e534..f99818551 100644 --- a/gnu/java/nio/charset/EncodingHelper.java +++ b/gnu/java/nio/charset/EncodingHelper.java @@ -7,7 +7,7 @@ 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 @@ -45,7 +45,7 @@ import java.nio.charset.Charset; import java.io.UnsupportedEncodingException; /** - * This class provides some useful utility methods + * This class provides some useful utility methods * for charset encoding for the java.lang and java.io methods. * * @author Sven de Marothy @@ -54,95 +54,95 @@ public class EncodingHelper { /** - * Contains the mapping from java.io canonical names + * Contains the mapping from java.io canonical names * to java.nio canonical names. */ private static final HashMap<String,String> canonicalNames; static { - canonicalNames = new HashMap<String,String>(); - canonicalNames.put("US-ASCII", "ASCII"); - canonicalNames.put("windows-1250", "Cp1250"); - canonicalNames.put("windows-1251", "Cp1251"); - canonicalNames.put("windows-1252", "Cp1252"); - canonicalNames.put("windows-1253", "Cp1253"); - canonicalNames.put("windows-1254", "Cp1254"); - canonicalNames.put("windows-1257", "Cp1257"); - canonicalNames.put("ISO-8859-1", "ISO8859_1"); - canonicalNames.put("ISO-8859-2", "ISO8859_2"); - canonicalNames.put("ISO-8859-4", "ISO8859_4"); - canonicalNames.put("ISO-8859-5", "ISO8859_5"); - canonicalNames.put("ISO-8859-7", "ISO8859_7"); - canonicalNames.put("ISO-8859-9", "ISO8859_9"); - canonicalNames.put("ISO-8859-13", "ISO8859_13"); - canonicalNames.put("ISO-8859-15", "ISO8859_15"); - canonicalNames.put("KOI8-R", "KOI8_R"); - canonicalNames.put("UTF-8", "UTF8"); - canonicalNames.put("UTF-16BE", "UnicodeBigUnmarked"); - canonicalNames.put("UTF-16LE", "UnicodeLittleUnmarked"); - canonicalNames.put("windows-1255", "Cp1255"); - canonicalNames.put("windows-1256", "Cp1256"); - canonicalNames.put("windows-1258", "Cp1258"); - canonicalNames.put("ISO-8859-3", "ISO8859_3"); - canonicalNames.put("ISO-8859-6", "ISO8859_6"); - canonicalNames.put("ISO-8859-8", "ISO8859_8"); + canonicalNames = new HashMap<String,String>(); + canonicalNames.put("US-ASCII", "ASCII"); + canonicalNames.put("windows-1250", "Cp1250"); + canonicalNames.put("windows-1251", "Cp1251"); + canonicalNames.put("windows-1252", "Cp1252"); + canonicalNames.put("windows-1253", "Cp1253"); + canonicalNames.put("windows-1254", "Cp1254"); + canonicalNames.put("windows-1257", "Cp1257"); + canonicalNames.put("ISO-8859-1", "ISO8859_1"); + canonicalNames.put("ISO-8859-2", "ISO8859_2"); + canonicalNames.put("ISO-8859-4", "ISO8859_4"); + canonicalNames.put("ISO-8859-5", "ISO8859_5"); + canonicalNames.put("ISO-8859-7", "ISO8859_7"); + canonicalNames.put("ISO-8859-9", "ISO8859_9"); + canonicalNames.put("ISO-8859-13", "ISO8859_13"); + canonicalNames.put("ISO-8859-15", "ISO8859_15"); + canonicalNames.put("KOI8-R", "KOI8_R"); + canonicalNames.put("UTF-8", "UTF8"); + canonicalNames.put("UTF-16BE", "UnicodeBigUnmarked"); + canonicalNames.put("UTF-16LE", "UnicodeLittleUnmarked"); + canonicalNames.put("windows-1255", "Cp1255"); + canonicalNames.put("windows-1256", "Cp1256"); + canonicalNames.put("windows-1258", "Cp1258"); + canonicalNames.put("ISO-8859-3", "ISO8859_3"); + canonicalNames.put("ISO-8859-6", "ISO8859_6"); + canonicalNames.put("ISO-8859-8", "ISO8859_8"); } /** - * Returns the name of the default encoding, + * Returns the name of the default encoding, * falls back on defaults to Latin-1 if there's a problem. */ public static String getDefaultEncoding() { - try - { - return System.getProperty("file.encoding"); - } catch(SecurityException e) { - } catch(IllegalArgumentException e) { - } - // XXX - Throw an error here? For now, default to the 'safe' encoding. - return "8859_1"; + try + { + return System.getProperty("file.encoding"); + } catch(SecurityException e) { + } catch(IllegalArgumentException e) { + } + // XXX - Throw an error here? For now, default to the 'safe' encoding. + return "8859_1"; } /** - * Returns the java.io canonical name of a charset given with the + * Returns the java.io canonical name of a charset given with the * java.nio canonical name. If the charset does not have a java.io * canonical name, the input string is returned. */ public static String getOldCanonical(String newCanonical) { - String oldCanonical = (String) canonicalNames.get(newCanonical); - return (oldCanonical != null)?oldCanonical : newCanonical; + String oldCanonical = (String) canonicalNames.get(newCanonical); + return (oldCanonical != null)?oldCanonical : newCanonical; } public static boolean isISOLatin1(String s) { - if(s.equals("ISO-8859-1") || - s.equals("8859_1") || - s.equals("ISO_8859-1") || - s.equals("latin1") || - s.equals("ISO8859_1") || - s.equals("ISO_8859_1")) - return true; - return false; + if(s.equals("ISO-8859-1") || + s.equals("8859_1") || + s.equals("ISO_8859-1") || + s.equals("latin1") || + s.equals("ISO8859_1") || + s.equals("ISO_8859_1")) + return true; + return false; } /** - * Gets a charset, throwing the java.io exception and not + * Gets a charset, throwing the java.io exception and not * the java.nio exception if an error occurs. */ - public static Charset getCharset(String name) - throws UnsupportedEncodingException + public static Charset getCharset(String name) + throws UnsupportedEncodingException { - try + try { return Charset.forName(name); - } - catch(IllegalCharsetNameException e) + } + catch(IllegalCharsetNameException e) { throw new UnsupportedEncodingException("Charset "+name+" not found."); - } - catch(UnsupportedCharsetException e) + } + catch(UnsupportedCharsetException e) { throw new UnsupportedEncodingException("Charset "+name+" not found."); } @@ -159,6 +159,3 @@ public class EncodingHelper return new UTF_8(); } } - - - diff --git a/gnu/java/nio/charset/ISO_8859_1.java b/gnu/java/nio/charset/ISO_8859_1.java index 19a538d9f..eb7c5ec59 100644 --- a/gnu/java/nio/charset/ISO_8859_1.java +++ b/gnu/java/nio/charset/ISO_8859_1.java @@ -1,4 +1,4 @@ -/* ISO_8859_1.java -- +/* ISO_8859_1.java -- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -58,7 +58,7 @@ final class ISO_8859_1 extends Charset * http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html */ super ("ISO-8859-1", new String[] { - /* These names are provided by + /* These names are provided by * http://www.iana.org/assignments/character-sets */ "iso-ir-100", @@ -111,7 +111,7 @@ final class ISO_8859_1 extends Charset return (char)(b & 0xFF); } }; - + // Package-private to avoid a trampoline constructor. Decoder (Charset cs) { diff --git a/gnu/java/nio/charset/ISO_8859_13.java b/gnu/java/nio/charset/ISO_8859_13.java index 3bbd42f3b..5e2748974 100644 --- a/gnu/java/nio/charset/ISO_8859_13.java +++ b/gnu/java/nio/charset/ISO_8859_13.java @@ -47,57 +47,56 @@ public final class ISO_8859_13 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x201D, 0x00A2, 0x00A3, 0x00A4, 0x201E, 0x00A6, 0x00A7, - 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x201C, 0x00B5, 0x00B6, 0x00B7, - 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6, - 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, - 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B, - 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, - 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF, - 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, - 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, - 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x201D, 0x00A2, 0x00A3, 0x00A4, 0x201E, 0x00A6, 0x00A7, + 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x201C, 0x00B5, 0x00B6, 0x00B7, + 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6, + 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, + 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B, + 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, + 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF, + 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, + 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, + 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x2019 - }; + }; public ISO_8859_13() { super("ISO-8859-13", new String[] { - "ISO8859_13", - "8859_13", - "ibm-921_P100-1995", - "ibm-921", - "iso_8859_13", - "iso8859_13", - "iso-8859-13", - "8859_13", - "cp921", - "921" + "ISO8859_13", + "8859_13", + "ibm-921_P100-1995", + "ibm-921", + "iso_8859_13", + "iso8859_13", + "iso-8859-13", + "8859_13", + "cp921", + "921" }, lookup); } - -} // class ISO_8859_13 +} // class ISO_8859_13 diff --git a/gnu/java/nio/charset/ISO_8859_15.java b/gnu/java/nio/charset/ISO_8859_15.java index df2265ac5..dc5e9e55a 100644 --- a/gnu/java/nio/charset/ISO_8859_15.java +++ b/gnu/java/nio/charset/ISO_8859_15.java @@ -47,64 +47,63 @@ public final class ISO_8859_15 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AC, 0x00A5, 0x0160, 0x00A7, - 0x0161, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x017D, 0x00B5, 0x00B6, 0x00B7, - 0x017E, 0x00B9, 0x00BA, 0x00BB, 0x0152, 0x0153, 0x0178, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, - 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, - 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF - }; + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AC, 0x00A5, 0x0160, 0x00A7, + 0x0161, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x017D, 0x00B5, 0x00B6, 0x00B7, + 0x017E, 0x00B9, 0x00BA, 0x00BB, 0x0152, 0x0153, 0x0178, 0x00BF, + 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, + 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, + 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, + 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF + }; public ISO_8859_15() { super("ISO-8859-15", new String[] { - "8859_15", - "iso8859_15", - "iso-8859-15", - "8859-15", - "latin9", - "iso_8859_15", - "ibm-923_P100-1998", - "ibm-923", - "Latin-9", - "l9", - "latin0", - "csisolatin0", - "csisolatin9", - "iso8859_15_fdis", - "cp923", - "923", - "windows-28605" + "8859_15", + "iso8859_15", + "iso-8859-15", + "8859-15", + "latin9", + "iso_8859_15", + "ibm-923_P100-1998", + "ibm-923", + "Latin-9", + "l9", + "latin0", + "csisolatin0", + "csisolatin9", + "iso8859_15_fdis", + "cp923", + "923", + "windows-28605" }, lookup); } - -} // class ISO_8859_15 +} // class ISO_8859_15 diff --git a/gnu/java/nio/charset/ISO_8859_2.java b/gnu/java/nio/charset/ISO_8859_2.java index dbe2b4dbf..7a086923d 100644 --- a/gnu/java/nio/charset/ISO_8859_2.java +++ b/gnu/java/nio/charset/ISO_8859_2.java @@ -48,7 +48,7 @@ public final class ISO_8859_2 extends ByteCharset * This is the lookup table for this encoding * Note: ranges 0-1F and 7f-97 aren't defined in the spec file aron used. */ - private static final char[] lookup = + private static final char[] lookup = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, @@ -82,28 +82,27 @@ public final class ISO_8859_2 extends ByteCharset 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 - }; + }; public ISO_8859_2() { super("ISO-8859-2", new String[] { - "ISO8859_2", - "8859_2", - "ibm-912_P100-1995", - "ibm-912", - "iso_8859_2", - "iso8859_2", - "iso-8859-2", - "ISO_8859-2:1987", - "latin2", - "csISOLatin2", - "iso-ir-101", - "l2", - "cp912", - "912", - "windows-28592" + "ISO8859_2", + "8859_2", + "ibm-912_P100-1995", + "ibm-912", + "iso_8859_2", + "iso8859_2", + "iso-8859-2", + "ISO_8859-2:1987", + "latin2", + "csISOLatin2", + "iso-ir-101", + "l2", + "cp912", + "912", + "windows-28592" }, lookup); } - -} // class ISO_8859_2 +} // class ISO_8859_2 diff --git a/gnu/java/nio/charset/ISO_8859_3.java b/gnu/java/nio/charset/ISO_8859_3.java index 567379e7d..a3c1ea692 100644 --- a/gnu/java/nio/charset/ISO_8859_3.java +++ b/gnu/java/nio/charset/ISO_8859_3.java @@ -47,62 +47,61 @@ public final class ISO_8859_3 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, NONE, 0x0124, 0x00A7, - 0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, NONE, 0x017B, - 0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7, - 0x00B8, 0x0131, 0x015F, 0x011F, 0x0135, 0x00BD, NONE, 0x017C, - 0x00C0, 0x00C1, 0x00C2, NONE, 0x00C4, 0x010A, 0x0108, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - NONE, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x0120, 0x00D6, 0x00D7, - 0x011C, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x016C, 0x015C, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, NONE, 0x00E4, 0x010B, 0x0109, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - NONE, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7, - 0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9 - }; + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, NONE, 0x0124, 0x00A7, + 0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, NONE, 0x017B, + 0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7, + 0x00B8, 0x0131, 0x015F, 0x011F, 0x0135, 0x00BD, NONE, 0x017C, + 0x00C0, 0x00C1, 0x00C2, NONE, 0x00C4, 0x010A, 0x0108, 0x00C7, + 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + NONE, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x0120, 0x00D6, 0x00D7, + 0x011C, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x016C, 0x015C, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, NONE, 0x00E4, 0x010B, 0x0109, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + NONE, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7, + 0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9 + }; public ISO_8859_3() { super("ISO-8859-3", new String[] { - "ISO8859_3", - "8859_3", - "ibm-913_P100-2000", - "ibm-913", - "iso_8859_3", - "iso8859_3", - "iso-8859-3", - "ISO_8859-3:1988", - "latin3", - "csISOLatin3", - "iso-ir-109", - "l3", - "cp913", - "913", - "windows-28593" + "ISO8859_3", + "8859_3", + "ibm-913_P100-2000", + "ibm-913", + "iso_8859_3", + "iso8859_3", + "iso-8859-3", + "ISO_8859-3:1988", + "latin3", + "csISOLatin3", + "iso-ir-109", + "l3", + "cp913", + "913", + "windows-28593" }, lookup); } - -} // class ISO_8859_3 +} // class ISO_8859_3 diff --git a/gnu/java/nio/charset/ISO_8859_4.java b/gnu/java/nio/charset/ISO_8859_4.java index ca062278a..3e92dbe64 100644 --- a/gnu/java/nio/charset/ISO_8859_4.java +++ b/gnu/java/nio/charset/ISO_8859_4.java @@ -48,7 +48,7 @@ public final class ISO_8859_4 extends ByteCharset * This is the lookup table for this encoding * Note: ranges 0-1F and 7f-9f aren't defined in the spec file aron used. */ - private static final char[] lookup = + private static final char[] lookup = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, @@ -82,28 +82,27 @@ public final class ISO_8859_4 extends ByteCharset 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x012B, 0x0111, 0x0146, 0x014D, 0x0137, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9 - }; + }; public ISO_8859_4() { super("ISO-8859-4", new String[] { - "ISO8859_4", - "8859_4", - "ibm-914_P100-1995", - "ibm-914", - "iso_8859_4", - "iso8859_4", - "iso-8859-4", - "latin4", - "csISOLatin4", - "iso-ir-110", - "ISO_8859-4:1988", - "l4", - "cp914", - "914", - "windows-28594" + "ISO8859_4", + "8859_4", + "ibm-914_P100-1995", + "ibm-914", + "iso_8859_4", + "iso8859_4", + "iso-8859-4", + "latin4", + "csISOLatin4", + "iso-ir-110", + "ISO_8859-4:1988", + "l4", + "cp914", + "914", + "windows-28594" }, lookup); } - -} // class ISO_8859_4 +} // class ISO_8859_4 diff --git a/gnu/java/nio/charset/ISO_8859_5.java b/gnu/java/nio/charset/ISO_8859_5.java index 70496ce49..17d11e077 100644 --- a/gnu/java/nio/charset/ISO_8859_5.java +++ b/gnu/java/nio/charset/ISO_8859_5.java @@ -47,61 +47,60 @@ public final class ISO_8859_5 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, - 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F, - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, - 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, - 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, - 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, - 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, + 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F, + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, + 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, + 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F - }; + }; public ISO_8859_5() { super("ISO-8859-5", new String[] { - "ISO8859_5", - "8859_5", - "ibm-915_P100-1995", - "ibm-915", - "iso_8859_5", - "iso8859_5", - "iso-8859-5", - "cyrillic", - "csISOLatinCyrillic", - "iso-ir-144", - "ISO_8859-5:1988", - "cp915", - "915", - "windows-28595" + "ISO8859_5", + "8859_5", + "ibm-915_P100-1995", + "ibm-915", + "iso_8859_5", + "iso8859_5", + "iso-8859-5", + "cyrillic", + "csISOLatinCyrillic", + "iso-ir-144", + "ISO_8859-5:1988", + "cp915", + "915", + "windows-28595" }, lookup); } - -} // class ISO_8859_5 +} // class ISO_8859_5 diff --git a/gnu/java/nio/charset/ISO_8859_6.java b/gnu/java/nio/charset/ISO_8859_6.java index dc7a9bef8..47dca4e37 100644 --- a/gnu/java/nio/charset/ISO_8859_6.java +++ b/gnu/java/nio/charset/ISO_8859_6.java @@ -47,65 +47,64 @@ public final class ISO_8859_6 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, NONE, NONE, NONE, 0x00A4, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, 0x060C, 0x00AD, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, 0x061B, NONE, NONE, NONE, 0x061F, - NONE, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, - 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, - 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, - 0x0638, 0x0639, 0x063A, NONE, NONE, NONE, NONE, NONE, - 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, - 0x0648, 0x0649, 0x064A, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, - 0x0650, 0x0651, 0x0652, NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE - }; + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, NONE, NONE, NONE, 0x00A4, NONE, NONE, NONE, + NONE, NONE, NONE, NONE, 0x060C, 0x00AD, NONE, NONE, + NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, + NONE, NONE, NONE, 0x061B, NONE, NONE, NONE, 0x061F, + NONE, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, + 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, + 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, + 0x0638, 0x0639, 0x063A, NONE, NONE, NONE, NONE, NONE, + 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, + 0x0648, 0x0649, 0x064A, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, + 0x0650, 0x0651, 0x0652, NONE, NONE, NONE, NONE, NONE, + NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE + }; public ISO_8859_6() { super("ISO-8859-6", new String[] { - "8859_6", - "ibm-1089_P100-1995", - "ibm-1089", - "iso_8859_6", - "iso8859_6", - "iso-8859-6", - "arabic", - "csISOLatinArabic", - "iso-ir-127", - "ISO_8859-6:1987", - "ECMA-114", - "ASMO-708", - "8859_6", - "cp1089", - "1089", - "windows-28596", - "ISO-8859-6-I", - "ISO-8859-6-E" + "8859_6", + "ibm-1089_P100-1995", + "ibm-1089", + "iso_8859_6", + "iso8859_6", + "iso-8859-6", + "arabic", + "csISOLatinArabic", + "iso-ir-127", + "ISO_8859-6:1987", + "ECMA-114", + "ASMO-708", + "8859_6", + "cp1089", + "1089", + "windows-28596", + "ISO-8859-6-I", + "ISO-8859-6-E" }, lookup); } - -} // class ISO_8859_6 +} // class ISO_8859_6 diff --git a/gnu/java/nio/charset/ISO_8859_7.java b/gnu/java/nio/charset/ISO_8859_7.java index 195f16094..19428cf8a 100644 --- a/gnu/java/nio/charset/ISO_8859_7.java +++ b/gnu/java/nio/charset/ISO_8859_7.java @@ -47,64 +47,63 @@ public final class ISO_8859_7 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x02BD, 0x02BC, 0x00A3, NONE, NONE, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, NONE, 0x00AB, 0x00AC, 0x00AD, NONE, 0x2015, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x0385, 0x0386, 0x00B7, - 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, - 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, - 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, - 0x03A0, 0x03A1, NONE, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, - 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, - 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, - 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, - 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x02BD, 0x02BC, 0x00A3, NONE, NONE, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, NONE, 0x00AB, 0x00AC, 0x00AD, NONE, 0x2015, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x0385, 0x0386, 0x00B7, + 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, + 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, + 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, + 0x03A0, 0x03A1, NONE, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, + 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, + 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, + 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, + 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, NONE - }; + }; public ISO_8859_7() { super("ISO-8859-7", new String[] { - "ISO8859_7", - "8859_7", - "ibm-813_P100-1995", - "ibm-813", - "iso_8859_7", - "iso8859_7", - "iso-8859-7", - "greek", - "greek8", - "ELOT_928", - "ECMA-118", - "csISOLatinGreek", - "iso-ir-126", - "ISO_8859-7:1987", - "cp813", - "813", - "windows-28597" + "ISO8859_7", + "8859_7", + "ibm-813_P100-1995", + "ibm-813", + "iso_8859_7", + "iso8859_7", + "iso-8859-7", + "greek", + "greek8", + "ELOT_928", + "ECMA-118", + "csISOLatinGreek", + "iso-ir-126", + "ISO_8859-7:1987", + "cp813", + "813", + "windows-28597" }, lookup); } - -} // class ISO_8859_7 +} // class ISO_8859_7 diff --git a/gnu/java/nio/charset/ISO_8859_8.java b/gnu/java/nio/charset/ISO_8859_8.java index b58030f17..fc60d39b5 100644 --- a/gnu/java/nio/charset/ISO_8859_8.java +++ b/gnu/java/nio/charset/ISO_8859_8.java @@ -47,63 +47,62 @@ public final class ISO_8859_8 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, NONE, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x203E, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, NONE, - NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, NONE, NONE, 0x2017, - 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, - 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, - 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, - 0x05E8, 0x05E9, 0x05EA, NONE, NONE, NONE, NONE, NONE - }; + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, NONE, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x203E, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, NONE, + NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, + NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, + NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, + NONE, NONE, NONE, NONE, NONE, NONE, NONE, 0x2017, + 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, + 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, + 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, + 0x05E8, 0x05E9, 0x05EA, NONE, NONE, NONE, NONE, NONE + }; public ISO_8859_8() { super("ISO-8859-8", new String[] { - "ISO8859_8", - "8859_8", - "ibm-916_P100-1995", - "ibm-916", - "iso_8859_8", - "iso8859_8", - "iso-8859-8", - "hebrew", - "csISOLatinHebrew", - "iso-ir-138", - "ISO_8859-8:1988", - "ISO-8859-8-I", - "ISO-8859-8-E", - "cp916", - "916", - "windows-28598" + "ISO8859_8", + "8859_8", + "ibm-916_P100-1995", + "ibm-916", + "iso_8859_8", + "iso8859_8", + "iso-8859-8", + "hebrew", + "csISOLatinHebrew", + "iso-ir-138", + "ISO_8859-8:1988", + "ISO-8859-8-I", + "ISO-8859-8-E", + "cp916", + "916", + "windows-28598" }, lookup); } - -} // class ISO_8859_8 +} // class ISO_8859_8 diff --git a/gnu/java/nio/charset/ISO_8859_9.java b/gnu/java/nio/charset/ISO_8859_9.java index 83fb5a222..70d987c8f 100644 --- a/gnu/java/nio/charset/ISO_8859_9.java +++ b/gnu/java/nio/charset/ISO_8859_9.java @@ -47,63 +47,62 @@ public final class ISO_8859_9 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, - 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, + 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, + 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, + 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF - }; + }; public ISO_8859_9() { super("ISO-8859-9", new String[] { - "ISO8859_9", - "8859_9", - "ibm-920_P100-1995", - "ibm-920", - "iso8859_9", - "iso-8859-9", - "iso_8859_9", - "latin5", - "csISOLatin5", - "iso-ir-148", - "ISO_8859-9:1989", - "l5", - "cp920", - "920", - "windows-28599", - "ECMA-128" + "ISO8859_9", + "8859_9", + "ibm-920_P100-1995", + "ibm-920", + "iso8859_9", + "iso-8859-9", + "iso_8859_9", + "latin5", + "csISOLatin5", + "iso-ir-148", + "ISO_8859-9:1989", + "l5", + "cp920", + "920", + "windows-28599", + "ECMA-128" }, lookup); } - -} // class ISO_8859_9 +} // class ISO_8859_9 diff --git a/gnu/java/nio/charset/KOI_8.java b/gnu/java/nio/charset/KOI_8.java index 20eb8b198..f9dc4b1f6 100644 --- a/gnu/java/nio/charset/KOI_8.java +++ b/gnu/java/nio/charset/KOI_8.java @@ -47,7 +47,7 @@ public final class KOI_8 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, @@ -81,21 +81,20 @@ public final class KOI_8 extends ByteCharset 0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, 0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A - }; + }; public KOI_8() { super("KOI8-R", new String[] { - "KOI8_R", - "KOI8", - "KOI-8", - "KOI_8", - "koi8-r", - "koi8r", - "koi-8-r", - "koi" + "KOI8_R", + "KOI8", + "KOI-8", + "KOI_8", + "koi8-r", + "koi8r", + "koi-8-r", + "koi" }, lookup); } - -} // class KOI_8 +} // class KOI_8 diff --git a/gnu/java/nio/charset/MS874.java b/gnu/java/nio/charset/MS874.java index f7cf81a25..ed1f7c64f 100644 --- a/gnu/java/nio/charset/MS874.java +++ b/gnu/java/nio/charset/MS874.java @@ -43,45 +43,45 @@ public final class MS874 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x20AC, NONE, NONE, NONE, NONE, 0x2026, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, - NONE, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, - 0x00A0, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, - 0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F, - 0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17, - 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F, - 0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27, - 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F, - 0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37, - 0x0E38, 0x0E39, 0x0E3A, NONE, NONE, NONE, NONE, 0x0E3F, - 0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, - 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F, - 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, - 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, NONE, NONE, NONE, NONE + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, NONE, NONE, NONE, NONE, 0x2026, NONE, NONE, + NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, + NONE, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, + 0x00A0, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, + 0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F, + 0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17, + 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F, + 0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27, + 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F, + 0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37, + 0x0E38, 0x0E39, 0x0E3A, NONE, NONE, NONE, NONE, 0x0E3F, + 0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, + 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F, + 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, + 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, NONE, NONE, NONE, NONE }; public MS874() { - super("MS874", new String[] {}, lookup); + super("MS874", new String[] {}, lookup); } } // class MS874 diff --git a/gnu/java/nio/charset/MacCentralEurope.java b/gnu/java/nio/charset/MacCentralEurope.java index ce0854365..ee31a5dad 100644 --- a/gnu/java/nio/charset/MacCentralEurope.java +++ b/gnu/java/nio/charset/MacCentralEurope.java @@ -43,45 +43,45 @@ public final class MacCentralEurope extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, NONE, - 0x00C4, 0x0100, 0x0101, 0x00C9, 0x0104, 0x00D6, 0x00DC, 0x00E1, - 0x0105, 0x010C, 0x00E4, 0x010D, 0x0106, 0x0107, 0x00E9, 0x0179, - 0x017A, 0x010E, 0x00ED, 0x010F, 0x0112, 0x0113, 0x0116, 0x00F3, - 0x0117, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x011A, 0x011B, 0x00FC, - 0x2020, 0x00B0, 0x0118, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, - 0x00AE, 0x00A9, 0x2122, 0x0119, 0x00A8, 0x2260, 0x0123, 0x012E, - 0x012F, 0x012A, 0x2264, 0x2265, 0x012B, 0x0136, 0x2202, 0x2211, - 0x0142, 0x013B, 0x013C, 0x013D, 0x013E, 0x0139, 0x013A, 0x0145, - 0x0146, 0x0143, 0x00AC, 0x221A, 0x0144, 0x0147, 0x2206, 0x00AB, - 0x00BB, 0x2026, 0x00A0, 0x0148, 0x0150, 0x00D5, 0x0151, 0x014C, - 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, - 0x014D, 0x0154, 0x0155, 0x0158, 0x2039, 0x203A, 0x0159, 0x0156, - 0x0157, 0x0160, 0x201A, 0x201E, 0x0161, 0x015A, 0x015B, 0x00C1, - 0x0164, 0x0165, 0x00CD, 0x017D, 0x017E, 0x016A, 0x00D3, 0x00D4, - 0x016B, 0x016E, 0x00DA, 0x016F, 0x0170, 0x0171, 0x0172, 0x0173, - 0x00DD, 0x00FD, 0x0137, 0x017B, 0x0141, 0x017C, 0x0122, 0x02C7 - }; + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, NONE, + 0x00C4, 0x0100, 0x0101, 0x00C9, 0x0104, 0x00D6, 0x00DC, 0x00E1, + 0x0105, 0x010C, 0x00E4, 0x010D, 0x0106, 0x0107, 0x00E9, 0x0179, + 0x017A, 0x010E, 0x00ED, 0x010F, 0x0112, 0x0113, 0x0116, 0x00F3, + 0x0117, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x011A, 0x011B, 0x00FC, + 0x2020, 0x00B0, 0x0118, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, + 0x00AE, 0x00A9, 0x2122, 0x0119, 0x00A8, 0x2260, 0x0123, 0x012E, + 0x012F, 0x012A, 0x2264, 0x2265, 0x012B, 0x0136, 0x2202, 0x2211, + 0x0142, 0x013B, 0x013C, 0x013D, 0x013E, 0x0139, 0x013A, 0x0145, + 0x0146, 0x0143, 0x00AC, 0x221A, 0x0144, 0x0147, 0x2206, 0x00AB, + 0x00BB, 0x2026, 0x00A0, 0x0148, 0x0150, 0x00D5, 0x0151, 0x014C, + 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, + 0x014D, 0x0154, 0x0155, 0x0158, 0x2039, 0x203A, 0x0159, 0x0156, + 0x0157, 0x0160, 0x201A, 0x201E, 0x0161, 0x015A, 0x015B, 0x00C1, + 0x0164, 0x0165, 0x00CD, 0x017D, 0x017E, 0x016A, 0x00D3, 0x00D4, + 0x016B, 0x016E, 0x00DA, 0x016F, 0x0170, 0x0171, 0x0172, 0x0173, + 0x00DD, 0x00FD, 0x0137, 0x017B, 0x0141, 0x017C, 0x0122, 0x02C7 + }; public MacCentralEurope() { - super("MacCentralEurope", new String[] {}, lookup); + super("MacCentralEurope", new String[] {}, lookup); } } // class MacCentralEurope diff --git a/gnu/java/nio/charset/MacCroatian.java b/gnu/java/nio/charset/MacCroatian.java index 3bb19f5e2..acf018414 100644 --- a/gnu/java/nio/charset/MacCroatian.java +++ b/gnu/java/nio/charset/MacCroatian.java @@ -43,45 +43,45 @@ public final class MacCroatian extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, NONE, - 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, - 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, - 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, - 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC, - 0x2020, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, - 0x00AE, 0x0160, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x017D, 0x00D8, - 0x221E, 0x00B1, 0x2264, 0x2265, 0x2206, 0x00B5, 0x2202, 0x2211, - 0x220F, 0x0161, 0x222B, 0x00AA, 0x00BA, 0x03A9, 0x017E, 0x00F8, - 0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x0106, 0x00AB, - 0x010C, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153, - 0x0110, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, - 0xF8FF, 0x00A9, 0x2044, 0x20AC, 0x2039, 0x203A, 0x00C6, 0x00BB, - 0x2013, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x0107, 0x00C1, - 0x010D, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4, - 0x0111, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, - 0x00AF, 0x03C0, 0x00CB, 0x02DA, 0x00B8, 0x00CA, 0x00E6, 0x02C7 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, NONE, + 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, + 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, + 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, + 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC, + 0x2020, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, + 0x00AE, 0x0160, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x017D, 0x00D8, + 0x221E, 0x00B1, 0x2264, 0x2265, 0x2206, 0x00B5, 0x2202, 0x2211, + 0x220F, 0x0161, 0x222B, 0x00AA, 0x00BA, 0x03A9, 0x017E, 0x00F8, + 0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x0106, 0x00AB, + 0x010C, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153, + 0x0110, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, + 0xF8FF, 0x00A9, 0x2044, 0x20AC, 0x2039, 0x203A, 0x00C6, 0x00BB, + 0x2013, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x0107, 0x00C1, + 0x010D, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4, + 0x0111, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, + 0x00AF, 0x03C0, 0x00CB, 0x02DA, 0x00B8, 0x00CA, 0x00E6, 0x02C7 }; public MacCroatian() { - super("MacCroatian", new String[] {}, lookup); + super("MacCroatian", new String[] {}, lookup); } } // class MacCroatian diff --git a/gnu/java/nio/charset/MacCyrillic.java b/gnu/java/nio/charset/MacCyrillic.java index b1984e57a..a788fd2ad 100644 --- a/gnu/java/nio/charset/MacCyrillic.java +++ b/gnu/java/nio/charset/MacCyrillic.java @@ -43,45 +43,45 @@ public final class MacCyrillic extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, NONE, - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, - 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, - 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, - 0x2020, 0x00B0, 0x0490, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x0406, - 0x00AE, 0x00A9, 0x2122, 0x0402, 0x0452, 0x2260, 0x0403, 0x0453, - 0x221E, 0x00B1, 0x2264, 0x2265, 0x0456, 0x00B5, 0x0491, 0x0408, - 0x0404, 0x0454, 0x0407, 0x0457, 0x0409, 0x0459, 0x040A, 0x045A, - 0x0458, 0x0405, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, - 0x00BB, 0x2026, 0x00A0, 0x040B, 0x045B, 0x040C, 0x045C, 0x0455, - 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x201E, - 0x040E, 0x045E, 0x040F, 0x045F, 0x2116, 0x0401, 0x0451, 0x044F, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, - 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x20AC + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, NONE, + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, + 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, + 0x2020, 0x00B0, 0x0490, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x0406, + 0x00AE, 0x00A9, 0x2122, 0x0402, 0x0452, 0x2260, 0x0403, 0x0453, + 0x221E, 0x00B1, 0x2264, 0x2265, 0x0456, 0x00B5, 0x0491, 0x0408, + 0x0404, 0x0454, 0x0407, 0x0457, 0x0409, 0x0459, 0x040A, 0x045A, + 0x0458, 0x0405, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, + 0x00BB, 0x2026, 0x00A0, 0x040B, 0x045B, 0x040C, 0x045C, 0x0455, + 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x201E, + 0x040E, 0x045E, 0x040F, 0x045F, 0x2116, 0x0401, 0x0451, 0x044F, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x20AC }; public MacCyrillic() { - super("MacCyrillic", new String[] {}, lookup); + super("MacCyrillic", new String[] {}, lookup); } } // class MacCyrillic diff --git a/gnu/java/nio/charset/MacDingbat.java b/gnu/java/nio/charset/MacDingbat.java index ad2f1c851..71ef82b13 100644 --- a/gnu/java/nio/charset/MacDingbat.java +++ b/gnu/java/nio/charset/MacDingbat.java @@ -43,45 +43,45 @@ public final class MacDingbat extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x2701, 0x2702, 0x2703, 0x2704, 0x260E, 0x2706, 0x2707, - 0x2708, 0x2709, 0x261B, 0x261E, 0x270C, 0x270D, 0x270E, 0x270F, - 0x2710, 0x2711, 0x2712, 0x2713, 0x2714, 0x2715, 0x2716, 0x2717, - 0x2718, 0x2719, 0x271A, 0x271B, 0x271C, 0x271D, 0x271E, 0x271F, - 0x2720, 0x2721, 0x2722, 0x2723, 0x2724, 0x2725, 0x2726, 0x2727, - 0x2605, 0x2729, 0x272A, 0x272B, 0x272C, 0x272D, 0x272E, 0x272F, - 0x2730, 0x2731, 0x2732, 0x2733, 0x2734, 0x2735, 0x2736, 0x2737, - 0x2738, 0x2739, 0x273A, 0x273B, 0x273C, 0x273D, 0x273E, 0x273F, - 0x2740, 0x2741, 0x2742, 0x2743, 0x2744, 0x2745, 0x2746, 0x2747, - 0x2748, 0x2749, 0x274A, 0x274B, 0x25CF, 0x274D, 0x25A0, 0x274F, - 0x2750, 0x2751, 0x2752, 0x25B2, 0x25BC, 0x25C6, 0x2756, 0x25D7, - 0x2758, 0x2759, 0x275A, 0x275B, 0x275C, 0x275D, 0x275E, NONE, - 0x2768, 0x2769, 0x276A, 0x276B, 0x276C, 0x276D, 0x276E, 0x276F, - 0x2770, 0x2771, 0x2772, 0x2773, 0x2774, 0x2775, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, - NONE, 0x2761, 0x2762, 0x2763, 0x2764, 0x2765, 0x2766, 0x2767, - 0x2663, 0x2666, 0x2665, 0x2660, 0x2460, 0x2461, 0x2462, 0x2463, - 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0x2776, 0x2777, - 0x2778, 0x2779, 0x277A, 0x277B, 0x277C, 0x277D, 0x277E, 0x277F, - 0x2780, 0x2781, 0x2782, 0x2783, 0x2784, 0x2785, 0x2786, 0x2787, - 0x2788, 0x2789, 0x278A, 0x278B, 0x278C, 0x278D, 0x278E, 0x278F, - 0x2790, 0x2791, 0x2792, 0x2793, 0x2794, 0x2192, 0x2194, 0x2195, - 0x2798, 0x2799, 0x279A, 0x279B, 0x279C, 0x279D, 0x279E, 0x279F, - 0x27A0, 0x27A1, 0x27A2, 0x27A3, 0x27A4, 0x27A5, 0x27A6, 0x27A7, - 0x27A8, 0x27A9, 0x27AA, 0x27AB, 0x27AC, 0x27AD, 0x27AE, 0x27AF, - NONE, 0x27B1, 0x27B2, 0x27B3, 0x27B4, 0x27B5, 0x27B6, 0x27B7, - 0x27B8, 0x27B9, 0x27BA, 0x27BB, 0x27BC, 0x27BD, 0x27BE, NONE + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x2701, 0x2702, 0x2703, 0x2704, 0x260E, 0x2706, 0x2707, + 0x2708, 0x2709, 0x261B, 0x261E, 0x270C, 0x270D, 0x270E, 0x270F, + 0x2710, 0x2711, 0x2712, 0x2713, 0x2714, 0x2715, 0x2716, 0x2717, + 0x2718, 0x2719, 0x271A, 0x271B, 0x271C, 0x271D, 0x271E, 0x271F, + 0x2720, 0x2721, 0x2722, 0x2723, 0x2724, 0x2725, 0x2726, 0x2727, + 0x2605, 0x2729, 0x272A, 0x272B, 0x272C, 0x272D, 0x272E, 0x272F, + 0x2730, 0x2731, 0x2732, 0x2733, 0x2734, 0x2735, 0x2736, 0x2737, + 0x2738, 0x2739, 0x273A, 0x273B, 0x273C, 0x273D, 0x273E, 0x273F, + 0x2740, 0x2741, 0x2742, 0x2743, 0x2744, 0x2745, 0x2746, 0x2747, + 0x2748, 0x2749, 0x274A, 0x274B, 0x25CF, 0x274D, 0x25A0, 0x274F, + 0x2750, 0x2751, 0x2752, 0x25B2, 0x25BC, 0x25C6, 0x2756, 0x25D7, + 0x2758, 0x2759, 0x275A, 0x275B, 0x275C, 0x275D, 0x275E, NONE, + 0x2768, 0x2769, 0x276A, 0x276B, 0x276C, 0x276D, 0x276E, 0x276F, + 0x2770, 0x2771, 0x2772, 0x2773, 0x2774, 0x2775, NONE, NONE, + NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, + NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, + NONE, 0x2761, 0x2762, 0x2763, 0x2764, 0x2765, 0x2766, 0x2767, + 0x2663, 0x2666, 0x2665, 0x2660, 0x2460, 0x2461, 0x2462, 0x2463, + 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0x2776, 0x2777, + 0x2778, 0x2779, 0x277A, 0x277B, 0x277C, 0x277D, 0x277E, 0x277F, + 0x2780, 0x2781, 0x2782, 0x2783, 0x2784, 0x2785, 0x2786, 0x2787, + 0x2788, 0x2789, 0x278A, 0x278B, 0x278C, 0x278D, 0x278E, 0x278F, + 0x2790, 0x2791, 0x2792, 0x2793, 0x2794, 0x2192, 0x2194, 0x2195, + 0x2798, 0x2799, 0x279A, 0x279B, 0x279C, 0x279D, 0x279E, 0x279F, + 0x27A0, 0x27A1, 0x27A2, 0x27A3, 0x27A4, 0x27A5, 0x27A6, 0x27A7, + 0x27A8, 0x27A9, 0x27AA, 0x27AB, 0x27AC, 0x27AD, 0x27AE, 0x27AF, + NONE, 0x27B1, 0x27B2, 0x27B3, 0x27B4, 0x27B5, 0x27B6, 0x27B7, + 0x27B8, 0x27B9, 0x27BA, 0x27BB, 0x27BC, 0x27BD, 0x27BE, NONE }; public MacDingbat() { - super("MacDingbat", new String[] {}, lookup); + super("MacDingbat", new String[] {}, lookup); } } // class MacDingbat diff --git a/gnu/java/nio/charset/MacGreek.java b/gnu/java/nio/charset/MacGreek.java index 6d1522874..39ca84554 100644 --- a/gnu/java/nio/charset/MacGreek.java +++ b/gnu/java/nio/charset/MacGreek.java @@ -43,45 +43,45 @@ public final class MacGreek extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, NONE, - 0x00C4, 0x00B9, 0x00B2, 0x00C9, 0x00B3, 0x00D6, 0x00DC, 0x0385, - 0x00E0, 0x00E2, 0x00E4, 0x0384, 0x00A8, 0x00E7, 0x00E9, 0x00E8, - 0x00EA, 0x00EB, 0x00A3, 0x2122, 0x00EE, 0x00EF, 0x2022, 0x00BD, - 0x2030, 0x00F4, 0x00F6, 0x00A6, 0x20AC, 0x00F9, 0x00FB, 0x00FC, - 0x2020, 0x0393, 0x0394, 0x0398, 0x039B, 0x039E, 0x03A0, 0x00DF, - 0x00AE, 0x00A9, 0x03A3, 0x03AA, 0x00A7, 0x2260, 0x00B0, 0x00B7, - 0x0391, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x0392, 0x0395, 0x0396, - 0x0397, 0x0399, 0x039A, 0x039C, 0x03A6, 0x03AB, 0x03A8, 0x03A9, - 0x03AC, 0x039D, 0x00AC, 0x039F, 0x03A1, 0x2248, 0x03A4, 0x00AB, - 0x00BB, 0x2026, 0x00A0, 0x03A5, 0x03A7, 0x0386, 0x0388, 0x0153, - 0x2013, 0x2015, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x0389, - 0x038A, 0x038C, 0x038E, 0x03AD, 0x03AE, 0x03AF, 0x03CC, 0x038F, - 0x03CD, 0x03B1, 0x03B2, 0x03C8, 0x03B4, 0x03B5, 0x03C6, 0x03B3, - 0x03B7, 0x03B9, 0x03BE, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BF, - 0x03C0, 0x03CE, 0x03C1, 0x03C3, 0x03C4, 0x03B8, 0x03C9, 0x03C2, - 0x03C7, 0x03C5, 0x03B6, 0x03CA, 0x03CB, 0x0390, 0x03B0, 0x00AD + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, NONE, + 0x00C4, 0x00B9, 0x00B2, 0x00C9, 0x00B3, 0x00D6, 0x00DC, 0x0385, + 0x00E0, 0x00E2, 0x00E4, 0x0384, 0x00A8, 0x00E7, 0x00E9, 0x00E8, + 0x00EA, 0x00EB, 0x00A3, 0x2122, 0x00EE, 0x00EF, 0x2022, 0x00BD, + 0x2030, 0x00F4, 0x00F6, 0x00A6, 0x20AC, 0x00F9, 0x00FB, 0x00FC, + 0x2020, 0x0393, 0x0394, 0x0398, 0x039B, 0x039E, 0x03A0, 0x00DF, + 0x00AE, 0x00A9, 0x03A3, 0x03AA, 0x00A7, 0x2260, 0x00B0, 0x00B7, + 0x0391, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x0392, 0x0395, 0x0396, + 0x0397, 0x0399, 0x039A, 0x039C, 0x03A6, 0x03AB, 0x03A8, 0x03A9, + 0x03AC, 0x039D, 0x00AC, 0x039F, 0x03A1, 0x2248, 0x03A4, 0x00AB, + 0x00BB, 0x2026, 0x00A0, 0x03A5, 0x03A7, 0x0386, 0x0388, 0x0153, + 0x2013, 0x2015, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x0389, + 0x038A, 0x038C, 0x038E, 0x03AD, 0x03AE, 0x03AF, 0x03CC, 0x038F, + 0x03CD, 0x03B1, 0x03B2, 0x03C8, 0x03B4, 0x03B5, 0x03C6, 0x03B3, + 0x03B7, 0x03B9, 0x03BE, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BF, + 0x03C0, 0x03CE, 0x03C1, 0x03C3, 0x03C4, 0x03B8, 0x03C9, 0x03C2, + 0x03C7, 0x03C5, 0x03B6, 0x03CA, 0x03CB, 0x0390, 0x03B0, 0x00AD }; public MacGreek() { - super("MacGreek", new String[] {}, lookup); + super("MacGreek", new String[] {}, lookup); } } // class MacGreek diff --git a/gnu/java/nio/charset/MacIceland.java b/gnu/java/nio/charset/MacIceland.java index a8eb7036c..352314641 100644 --- a/gnu/java/nio/charset/MacIceland.java +++ b/gnu/java/nio/charset/MacIceland.java @@ -43,45 +43,45 @@ public final class MacIceland extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, NONE, - 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, - 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, - 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, - 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC, - 0x00DD, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, - 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8, - 0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, - 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x03A9, 0x00E6, 0x00F8, - 0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, - 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153, - 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, - 0x00FF, 0x0178, 0x2044, 0x20AC, 0x00D0, 0x00F0, 0x00DE, 0x00FE, - 0x00FD, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, - 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4, - 0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, - 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, NONE, + 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, + 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, + 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, + 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC, + 0x00DD, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, + 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8, + 0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, + 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x03A9, 0x00E6, 0x00F8, + 0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, + 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153, + 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, + 0x00FF, 0x0178, 0x2044, 0x20AC, 0x00D0, 0x00F0, 0x00DE, 0x00FE, + 0x00FD, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, + 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4, + 0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, + 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7 }; public MacIceland() { - super("MacIceland", new String[] {}, lookup); + super("MacIceland", new String[] {}, lookup); } } // class MacIceland diff --git a/gnu/java/nio/charset/MacRoman.java b/gnu/java/nio/charset/MacRoman.java index 72738a2aa..f1611b398 100644 --- a/gnu/java/nio/charset/MacRoman.java +++ b/gnu/java/nio/charset/MacRoman.java @@ -43,45 +43,45 @@ public final class MacRoman extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, NONE, - 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, - 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, - 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, - 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC, - 0x2020, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, - 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8, - 0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, - 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x03A9, 0x00E6, 0x00F8, - 0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, - 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153, - 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, - 0x00FF, 0x0178, 0x2044, 0x20AC, 0x2039, 0x203A, 0xFB01, 0xFB02, - 0x2021, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, - 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4, - 0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, - 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, NONE, + 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, + 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, + 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, + 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC, + 0x2020, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, + 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8, + 0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, + 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x03A9, 0x00E6, 0x00F8, + 0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, + 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153, + 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, + 0x00FF, 0x0178, 0x2044, 0x20AC, 0x2039, 0x203A, 0xFB01, 0xFB02, + 0x2021, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, + 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4, + 0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, + 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7 }; public MacRoman() { - super("MacRoman", new String[] {}, lookup); + super("MacRoman", new String[] {}, lookup); } } // class MacRoman diff --git a/gnu/java/nio/charset/MacRomania.java b/gnu/java/nio/charset/MacRomania.java index e05e94025..00a299b1e 100644 --- a/gnu/java/nio/charset/MacRomania.java +++ b/gnu/java/nio/charset/MacRomania.java @@ -43,45 +43,45 @@ public final class MacRomania extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, NONE, - 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, - 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, - 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, - 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC, - 0x2020, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, - 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x0102, 0x0218, - 0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, - 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x03A9, 0x0103, 0x0219, - 0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, - 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153, - 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, - 0x00FF, 0x0178, 0x2044, 0x20AC, 0x2039, 0x203A, 0x021A, 0x021B, - 0x2021, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, - 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4, - 0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, - 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, NONE, + 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, + 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, + 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, + 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC, + 0x2020, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, + 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x0102, 0x0218, + 0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, + 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x03A9, 0x0103, 0x0219, + 0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, + 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153, + 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, + 0x00FF, 0x0178, 0x2044, 0x20AC, 0x2039, 0x203A, 0x021A, 0x021B, + 0x2021, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, + 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4, + 0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, + 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7 }; public MacRomania() { - super("MacRomania", new String[] {}, lookup); + super("MacRomania", new String[] {}, lookup); } } // class MacRomania diff --git a/gnu/java/nio/charset/MacSymbol.java b/gnu/java/nio/charset/MacSymbol.java index 9878efd89..a5e6f9428 100644 --- a/gnu/java/nio/charset/MacSymbol.java +++ b/gnu/java/nio/charset/MacSymbol.java @@ -43,45 +43,45 @@ public final class MacSymbol extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x2200, 0x0023, 0x2203, 0x0025, 0x0026, 0x220D, - 0x0028, 0x0029, 0x2217, 0x002B, 0x002C, 0x2212, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x2245, 0x0391, 0x0392, 0x03A7, 0x0394, 0x0395, 0x03A6, 0x0393, - 0x0397, 0x0399, 0x03D1, 0x039A, 0x039B, 0x039C, 0x039D, 0x039F, - 0x03A0, 0x0398, 0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03C2, 0x03A9, - 0x039E, 0x03A8, 0x0396, 0x005B, 0x2234, 0x005D, 0x22A5, 0x005F, - 0xF8E5, 0x03B1, 0x03B2, 0x03C7, 0x03B4, 0x03B5, 0x03C6, 0x03B3, - 0x03B7, 0x03B9, 0x03D5, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BF, - 0x03C0, 0x03B8, 0x03C1, 0x03C3, 0x03C4, 0x03C5, 0x03D6, 0x03C9, - 0x03BE, 0x03C8, 0x03B6, 0x007B, 0x007C, 0x007D, 0x223C, NONE, - NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, - 0x20AC, 0x03D2, 0x2032, 0x2264, 0x2044, 0x221E, 0x0192, 0x2663, - 0x2666, 0x2665, 0x2660, 0x2194, 0x2190, 0x2191, 0x2192, 0x2193, - 0x00B0, 0x00B1, 0x2033, 0x2265, 0x00D7, 0x221D, 0x2202, 0x2022, - 0x00F7, 0x2260, 0x2261, 0x2248, 0x2026, 0xF8E6, 0x23AF, 0x21B5, - 0x2135, 0x2111, 0x211C, 0x2118, 0x2297, 0x2295, 0x2205, 0x2229, - 0x222A, 0x2283, 0x2287, 0x2284, 0x2282, 0x2286, 0x2208, 0x2209, - 0x2220, 0x2207, 0x00AE, 0x00A9, 0x2122, 0x220F, 0x221A, 0x22C5, - 0x00AC, 0x2227, 0x2228, 0x21D4, 0x21D0, 0x21D1, 0x21D2, 0x21D3, - 0x22C4, 0x3008, NONE, NONE, NONE, 0x2211, 0x239B, 0x239C, - 0x239D, 0x23A1, 0x23A2, 0x23A3, 0x23A7, 0x23A8, 0x23A9, 0x23AA, - 0xF8FF, 0x3009, 0x222B, 0x2320, 0x23AE, 0x2321, 0x239E, 0x239F, - 0x23A0, 0x23A4, 0x23A5, 0x23A6, 0x23AB, 0x23AC, 0x23AD, NONE + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x2200, 0x0023, 0x2203, 0x0025, 0x0026, 0x220D, + 0x0028, 0x0029, 0x2217, 0x002B, 0x002C, 0x2212, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x2245, 0x0391, 0x0392, 0x03A7, 0x0394, 0x0395, 0x03A6, 0x0393, + 0x0397, 0x0399, 0x03D1, 0x039A, 0x039B, 0x039C, 0x039D, 0x039F, + 0x03A0, 0x0398, 0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03C2, 0x03A9, + 0x039E, 0x03A8, 0x0396, 0x005B, 0x2234, 0x005D, 0x22A5, 0x005F, + 0xF8E5, 0x03B1, 0x03B2, 0x03C7, 0x03B4, 0x03B5, 0x03C6, 0x03B3, + 0x03B7, 0x03B9, 0x03D5, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BF, + 0x03C0, 0x03B8, 0x03C1, 0x03C3, 0x03C4, 0x03C5, 0x03D6, 0x03C9, + 0x03BE, 0x03C8, 0x03B6, 0x007B, 0x007C, 0x007D, 0x223C, NONE, + NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, + NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, + NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, + NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, + 0x20AC, 0x03D2, 0x2032, 0x2264, 0x2044, 0x221E, 0x0192, 0x2663, + 0x2666, 0x2665, 0x2660, 0x2194, 0x2190, 0x2191, 0x2192, 0x2193, + 0x00B0, 0x00B1, 0x2033, 0x2265, 0x00D7, 0x221D, 0x2202, 0x2022, + 0x00F7, 0x2260, 0x2261, 0x2248, 0x2026, 0xF8E6, 0x23AF, 0x21B5, + 0x2135, 0x2111, 0x211C, 0x2118, 0x2297, 0x2295, 0x2205, 0x2229, + 0x222A, 0x2283, 0x2287, 0x2284, 0x2282, 0x2286, 0x2208, 0x2209, + 0x2220, 0x2207, 0x00AE, 0x00A9, 0x2122, 0x220F, 0x221A, 0x22C5, + 0x00AC, 0x2227, 0x2228, 0x21D4, 0x21D0, 0x21D1, 0x21D2, 0x21D3, + 0x22C4, 0x3008, NONE, NONE, NONE, 0x2211, 0x239B, 0x239C, + 0x239D, 0x23A1, 0x23A2, 0x23A3, 0x23A7, 0x23A8, 0x23A9, 0x23AA, + 0xF8FF, 0x3009, 0x222B, 0x2320, 0x23AE, 0x2321, 0x239E, 0x239F, + 0x23A0, 0x23A4, 0x23A5, 0x23A6, 0x23AB, 0x23AC, 0x23AD, NONE }; public MacSymbol() { - super("MacSymbol", new String[] {}, lookup); + super("MacSymbol", new String[] {}, lookup); } } // class MacSymbol diff --git a/gnu/java/nio/charset/MacThai.java b/gnu/java/nio/charset/MacThai.java index daed75630..b726c70de 100644 --- a/gnu/java/nio/charset/MacThai.java +++ b/gnu/java/nio/charset/MacThai.java @@ -43,45 +43,45 @@ public final class MacThai extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, NONE, - 0x00AB, 0x00BB, 0x2026, NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, 0x201C, 0x201D, NONE, - NONE, 0x2022, NONE, NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, 0x2018, 0x2019, NONE, - 0x00A0, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, - 0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F, - 0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17, - 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F, - 0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27, - 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F, - 0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37, - 0x0E38, 0x0E39, 0x0E3A, 0x2060, 0x200B, 0x2013, 0x2014, 0x0E3F, - 0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, - 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x2122, 0x0E4F, - 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, - 0x0E58, 0x0E59, 0x00AE, 0x00A9, NONE, NONE, NONE, NONE + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, NONE, + 0x00AB, 0x00BB, 0x2026, NONE, NONE, NONE, NONE, NONE, + NONE, NONE, NONE, NONE, NONE, 0x201C, 0x201D, NONE, + NONE, 0x2022, NONE, NONE, NONE, NONE, NONE, NONE, + NONE, NONE, NONE, NONE, NONE, 0x2018, 0x2019, NONE, + 0x00A0, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, + 0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F, + 0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17, + 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F, + 0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27, + 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F, + 0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37, + 0x0E38, 0x0E39, 0x0E3A, 0x2060, 0x200B, 0x2013, 0x2014, 0x0E3F, + 0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, + 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x2122, 0x0E4F, + 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, + 0x0E58, 0x0E59, 0x00AE, 0x00A9, NONE, NONE, NONE, NONE }; public MacThai() { - super("MacThai", new String[] {}, lookup); + super("MacThai", new String[] {}, lookup); } } // class MacThai diff --git a/gnu/java/nio/charset/MacTurkish.java b/gnu/java/nio/charset/MacTurkish.java index b623ee39a..259802a3f 100644 --- a/gnu/java/nio/charset/MacTurkish.java +++ b/gnu/java/nio/charset/MacTurkish.java @@ -43,45 +43,45 @@ public final class MacTurkish extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, NONE, - 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, - 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, - 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, - 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC, - 0x2020, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, - 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8, - 0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, - 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x03A9, 0x00E6, 0x00F8, - 0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, - 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153, - 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, - 0x00FF, 0x0178, 0x011E, 0x011F, 0x0130, 0x0131, 0x015E, 0x015F, - 0x2021, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, - 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4, - 0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0xF8A0, 0x02C6, 0x02DC, - 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, NONE, + 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, + 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, + 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, + 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC, + 0x2020, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, + 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8, + 0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, + 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x03A9, 0x00E6, 0x00F8, + 0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, + 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153, + 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, + 0x00FF, 0x0178, 0x011E, 0x011F, 0x0130, 0x0131, 0x015E, 0x015F, + 0x2021, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, + 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4, + 0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0xF8A0, 0x02C6, 0x02DC, + 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7 }; public MacTurkish() { - super("MacTurkish", new String[] {}, lookup); + super("MacTurkish", new String[] {}, lookup); } } // class MacTurkish diff --git a/gnu/java/nio/charset/Provider.java b/gnu/java/nio/charset/Provider.java index d3b71a612..8fc42e5f6 100644 --- a/gnu/java/nio/charset/Provider.java +++ b/gnu/java/nio/charset/Provider.java @@ -1,4 +1,4 @@ -/* Provider.java -- +/* Provider.java -- Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -65,7 +65,7 @@ public final class Provider extends CharsetProvider /** * Map from charset name to charset canonical name. The strings * are all lower-case to allow case-insensitive retrieval of - * Charset instances. + * Charset instances. */ private final HashMap<String, String> canonicalNames; @@ -214,9 +214,9 @@ public final class Provider extends CharsetProvider * Returns a Charset instance by converting the given * name to lower-case, looking up the canonical charset * name and finally looking up the Charset with that name. - * + * * <p>The lookup is therefore case-insensitive.</p> - * + * * @returns The Charset having <code>charsetName</code> * as its alias or null if no such Charset exist. */ @@ -234,20 +234,20 @@ public final class Provider extends CharsetProvider /** * Puts a Charset under its canonical name into the 'charsets' map. * Then puts a mapping from all its alias names to the canonical name. - * + * * <p>All names are converted to lower-case</p>. - * + * * @param cs */ private void addCharset (Charset cs) { String canonicalName = cs.name().toLowerCase(); charsets.put (canonicalName, cs); - + /* Adds a mapping between the canonical name * itself making a lookup using that name * no special case. - */ + */ canonicalNames.put(canonicalName, canonicalName); for (Iterator<String> i = cs.aliases ().iterator (); i.hasNext (); ) @@ -259,13 +259,13 @@ public final class Provider extends CharsetProvider // The default provider is safe to instantiate. if (singleton == null) singleton = AccessController.doPrivileged - (new PrivilegedAction<Provider>() - { - public Provider run() - { - return new Provider(); - } - }); + (new PrivilegedAction<Provider>() + { + public Provider run() + { + return new Provider(); + } + }); return singleton; } } diff --git a/gnu/java/nio/charset/US_ASCII.java b/gnu/java/nio/charset/US_ASCII.java index b09c43e61..373b37a1f 100644 --- a/gnu/java/nio/charset/US_ASCII.java +++ b/gnu/java/nio/charset/US_ASCII.java @@ -1,4 +1,4 @@ -/* US_ASCII.java -- +/* US_ASCII.java -- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -58,7 +58,7 @@ final class US_ASCII extends Charset * http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html */ super ("US-ASCII", new String[] { - /* These names are provided by + /* These names are provided by * http://www.iana.org/assignments/character-sets */ "iso-ir-6", @@ -108,7 +108,7 @@ final class US_ASCII extends Charset return (char)b; } }; - + // Package-private to avoid a trampoline constructor. Decoder (Charset cs) { diff --git a/gnu/java/nio/charset/UTF_16.java b/gnu/java/nio/charset/UTF_16.java index b1d7705d4..d91b15a7f 100644 --- a/gnu/java/nio/charset/UTF_16.java +++ b/gnu/java/nio/charset/UTF_16.java @@ -1,4 +1,4 @@ -/* UTF_16.java -- +/* UTF_16.java -- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/nio/charset/UTF_16BE.java b/gnu/java/nio/charset/UTF_16BE.java index 1fe3b5d7c..1299b015e 100644 --- a/gnu/java/nio/charset/UTF_16BE.java +++ b/gnu/java/nio/charset/UTF_16BE.java @@ -1,4 +1,4 @@ -/* UTF_16BE.java -- +/* UTF_16BE.java -- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/nio/charset/UTF_16Decoder.java b/gnu/java/nio/charset/UTF_16Decoder.java index fa1dbc412..e078a6919 100644 --- a/gnu/java/nio/charset/UTF_16Decoder.java +++ b/gnu/java/nio/charset/UTF_16Decoder.java @@ -1,4 +1,4 @@ -/* UTF_16Decoder.java -- +/* UTF_16Decoder.java -- Copyright (C) 2002, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -117,15 +117,15 @@ final class UTF_16Decoder extends CharsetDecoder } } - // FIXME: Change so you only do a single comparison here. + // FIXME: Change so you only do a single comparison here. char c = (byteOrder == BIG_ENDIAN - ? (char) (((b1 & 0xFF) << 8) | (b2 & 0xFF)) - : (char) (((b2 & 0xFF) << 8) | (b1 & 0xFF))); + ? (char) (((b1 & 0xFF) << 8) | (b2 & 0xFF)) + : (char) (((b2 & 0xFF) << 8) | (b1 & 0xFF))); if (0xD800 <= c && c <= 0xDFFF) { // c is a surrogate - + // make sure c is a high surrogate if (c > 0xDBFF) return CoderResult.malformedForLength (2); @@ -134,8 +134,8 @@ final class UTF_16Decoder extends CharsetDecoder byte b3 = in.get (); byte b4 = in.get (); char d = (byteOrder == BIG_ENDIAN - ? (char) (((b3 & 0xFF) << 8) | (b4 & 0xFF)) - : (char) (((b4 & 0xFF) << 8) | (b3 & 0xFF))); + ? (char) (((b3 & 0xFF) << 8) | (b4 & 0xFF)) + : (char) (((b4 & 0xFF) << 8) | (b3 & 0xFF))); // make sure d is a low surrogate if (d < 0xDC00 || d > 0xDFFF) return CoderResult.malformedForLength (2); diff --git a/gnu/java/nio/charset/UTF_16Encoder.java b/gnu/java/nio/charset/UTF_16Encoder.java index d5ab744e0..5283be491 100644 --- a/gnu/java/nio/charset/UTF_16Encoder.java +++ b/gnu/java/nio/charset/UTF_16Encoder.java @@ -1,4 +1,4 @@ -/* UTF_16Encoder.java -- +/* UTF_16Encoder.java -- Copyright (C) 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -68,8 +68,8 @@ final class UTF_16Encoder extends CharsetEncoder byteOrder == BIG_ENDIAN ? new byte[] { (byte) 0xFF, (byte) 0xFD } : new byte[] { (byte) 0xFD, (byte) 0xFF }); - this.byteOrder = (byteOrder == BIG_ENDIAN) ? - ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN; + this.byteOrder = (byteOrder == BIG_ENDIAN) ? + ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN; this.useByteOrderMark = useByteOrderMark; this.needsByteOrderMark = useByteOrderMark; } @@ -84,11 +84,11 @@ final class UTF_16Encoder extends CharsetEncoder if (needsByteOrderMark) { if (out.remaining () < 2) - { - out.order(originalBO); - return CoderResult.OVERFLOW; - } - out.putChar (BYTE_ORDER_MARK); + { + out.order(originalBO); + return CoderResult.OVERFLOW; + } + out.putChar (BYTE_ORDER_MARK); needsByteOrderMark = false; } @@ -118,15 +118,15 @@ final class UTF_16Encoder extends CharsetEncoder else { if (out.remaining () < 2) - { - out.order(originalBO); - return CoderResult.OVERFLOW; - } + { + out.order(originalBO); + return CoderResult.OVERFLOW; + } out.putChar (c); inPos++; } } - out.order(originalBO); + out.order(originalBO); return CoderResult.UNDERFLOW; } finally diff --git a/gnu/java/nio/charset/UTF_16LE.java b/gnu/java/nio/charset/UTF_16LE.java index 6d72a324c..bede38aa8 100644 --- a/gnu/java/nio/charset/UTF_16LE.java +++ b/gnu/java/nio/charset/UTF_16LE.java @@ -1,4 +1,4 @@ -/* UTF_16LE.java -- +/* UTF_16LE.java -- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -53,7 +53,7 @@ final class UTF_16LE extends Charset { super ("UTF-16LE", new String[] { // witnessed by the internet - "UTF16LE", + "UTF16LE", /* These names are provided by * http://oss.software.ibm.com/cgi-bin/icu/convexp?s=ALL */ diff --git a/gnu/java/nio/charset/UTF_8.java b/gnu/java/nio/charset/UTF_8.java index 0e0730eec..0423efe51 100644 --- a/gnu/java/nio/charset/UTF_8.java +++ b/gnu/java/nio/charset/UTF_8.java @@ -1,4 +1,4 @@ -/* UTF_8.java -- +/* UTF_8.java -- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -46,12 +46,12 @@ import java.nio.charset.CoderResult; /** * UTF-8 charset. - * + * * <p> UTF-8 references: * <ul> * <li> <a href="http://ietf.org/rfc/rfc2279.txt">RFC 2279</a> * <li> The <a href="http://www.unicode.org/unicode/standard/standard.html"> - * Unicode standard</a> and + * Unicode standard</a> and * <a href="http://www.unicode.org/versions/corrigendum1.html"> * Corrigendum</a> * </ul> @@ -101,7 +101,7 @@ final class UTF_8 extends Charset protected CoderResult decodeLoop (ByteBuffer in, CharBuffer out) { // TODO: Optimize this in the case in.hasArray() / out.hasArray() - int inPos = in.position(); + int inPos = in.position(); try { while (in.hasRemaining ()) @@ -117,7 +117,7 @@ final class UTF_8 extends Charset return CoderResult.OVERFLOW; out.put ((char) b1); inPos++; - break; + break; case 0xC: case 0xD: byte b2; @@ -159,7 +159,7 @@ final class UTF_8 extends Charset byte b4; if (in.remaining () < 3) return CoderResult.UNDERFLOW; - if((b1&0x0F) > 4) + if((b1&0x0F) > 4) return CoderResult.malformedForLength (4); if (out.remaining () < 2) return CoderResult.OVERFLOW; @@ -169,12 +169,12 @@ final class UTF_8 extends Charset return CoderResult.malformedForLength (2); if (!isContinuation (b4 = in.get ())) return CoderResult.malformedForLength (1); - int n = (((b1 & 0x3) << 18) - | ((b2 & 0x3F) << 12) - | ((b3 & 0x3F) << 6) - | (b4 & 0x3F)) - 0x10000; - char c1 = (char)(0xD800 | (n & 0xFFC00)>>10); - char c2 = (char)(0xDC00 | (n & 0x003FF)); + int n = (((b1 & 0x3) << 18) + | ((b2 & 0x3F) << 12) + | ((b3 & 0x3F) << 6) + | (b4 & 0x3F)) - 0x10000; + char c1 = (char)(0xD800 | (n & 0xFFC00)>>10); + char c2 = (char)(0xDC00 | (n & 0x003FF)); out.put (c1); out.put (c2); inPos += 4; @@ -213,7 +213,7 @@ final class UTF_8 extends Charset // Most Latin-script languages take about 1.1 bytes. Greek, Russian, // Arabic and Hebrew take about 1.7 bytes, and most others (including // Japanese, Chinese, Korean and Hindi) take about 3 bytes. - // We assume we will be dealing with latin scripts, and use 1.1 + // We assume we will be dealing with latin scripts, and use 1.1 // for averageBytesPerChar. super (cs, 1.1f, 4.0f); } diff --git a/gnu/java/nio/charset/UnicodeLittle.java b/gnu/java/nio/charset/UnicodeLittle.java index 63f2855d5..2fa22cf32 100644 --- a/gnu/java/nio/charset/UnicodeLittle.java +++ b/gnu/java/nio/charset/UnicodeLittle.java @@ -1,4 +1,4 @@ -/* UnicodeLittle.java -- +/* UnicodeLittle.java -- Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -45,7 +45,7 @@ import java.nio.charset.CharsetEncoder; /** * UTF-16 little endian with a byte-order mark * Included for java.io completeness. - * ("UTF-16" is equal to UnicodeBig, and + * ("UTF-16" is equal to UnicodeBig, and * UTF-16BE/LE do not have a BOM */ final class UnicodeLittle extends Charset diff --git a/gnu/java/nio/charset/Windows1250.java b/gnu/java/nio/charset/Windows1250.java index f8fc90ae2..5845873e1 100644 --- a/gnu/java/nio/charset/Windows1250.java +++ b/gnu/java/nio/charset/Windows1250.java @@ -39,7 +39,7 @@ exception statement from your version. */ package gnu.java.nio.charset; /** - * Encoding table for Windows-1250-Latin-1, + * Encoding table for Windows-1250-Latin-1, * aka cp1250 or Windows-1250 or whatever. */ public final class Windows1250 extends ByteCharset @@ -48,55 +48,54 @@ public final class Windows1250 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x20AC, 0xFFFD, 0x201A, 0xFFFD, 0x201E, 0x2026, 0x2020, 0x2021, - 0xFFFD, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179, - 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0xFFFD, 0x2122, 0x0161, 0x203A, 0x015B, 0x0165, 0x017E, 0x017A, - 0x00A0, 0x02C7, 0x02D8, 0x0141, 0x00A4, 0x0104, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x015E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x017B, - 0x00B0, 0x00B1, 0x02DB, 0x0142, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x0105, 0x015F, 0x00BB, 0x013D, 0x02DD, 0x013E, 0x017C, - 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, - 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, - 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, - 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, - 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, - 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, - 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, - 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, 0xFFFD, 0x201A, 0xFFFD, 0x201E, 0x2026, 0x2020, 0x2021, + 0xFFFD, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179, + 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0xFFFD, 0x2122, 0x0161, 0x203A, 0x015B, 0x0165, 0x017E, 0x017A, + 0x00A0, 0x02C7, 0x02D8, 0x0141, 0x00A4, 0x0104, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x015E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x017B, + 0x00B0, 0x00B1, 0x02DB, 0x0142, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00B8, 0x0105, 0x015F, 0x00BB, 0x013D, 0x02DD, 0x013E, 0x017C, + 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, + 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, + 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, + 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, + 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, + 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, + 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, + 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 }; public Windows1250() { super("windows-1250", new String[] { - "Windows1250", - "ibm-5346_P100-1998", - "ibm-5346", - "cp1250", - "cp-1250", - "cp_1250", - "windows1250", - "windows_1250" + "Windows1250", + "ibm-5346_P100-1998", + "ibm-5346", + "cp1250", + "cp-1250", + "cp_1250", + "windows1250", + "windows_1250" }, lookup); } - -} // class Windows1250 +} // class Windows1250 diff --git a/gnu/java/nio/charset/Windows1251.java b/gnu/java/nio/charset/Windows1251.java index 51f289e2a..052d0ea38 100644 --- a/gnu/java/nio/charset/Windows1251.java +++ b/gnu/java/nio/charset/Windows1251.java @@ -48,53 +48,52 @@ public final class Windows1251 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, - 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, - 0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - NONE, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F, - 0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7, - 0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407, - 0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7, - 0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457, - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, - 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, - 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, - 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, + 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, + 0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + NONE, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F, + 0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7, + 0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407, + 0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7, + 0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457, + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, + 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F }; public Windows1251() { super("windows-1251", new String[] { - "Windows1251", - "cp1251", - "cp-1251", - "cp_1251", - "windows1251", - "windows_1251" + "Windows1251", + "cp1251", + "cp-1251", + "cp_1251", + "windows1251", + "windows_1251" }, lookup); } - -} // class Windows1251 +} // class Windows1251 diff --git a/gnu/java/nio/charset/Windows1252.java b/gnu/java/nio/charset/Windows1252.java index 03d15802c..738f62a33 100644 --- a/gnu/java/nio/charset/Windows1252.java +++ b/gnu/java/nio/charset/Windows1252.java @@ -39,7 +39,7 @@ exception statement from your version. */ package gnu.java.nio.charset; /** - * Encoding table for Windows-1252-Latin-1, + * Encoding table for Windows-1252-Latin-1, * aka cp1252 or Windows-1252 or whatever. */ public final class Windows1252 extends ByteCharset @@ -48,52 +48,51 @@ public final class Windows1252 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = - { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x20AC, NONE, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, - 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, NONE, 0x017D, NONE, - NONE, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, NONE, 0x017E, 0x0178, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, - 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, + private static final char[] lookup = + { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, NONE, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, + 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, NONE, 0x017D, NONE, + NONE, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, NONE, 0x017E, 0x0178, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, + 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, + 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, + 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF }; public Windows1252() { super("windows-1252", new String[] { - "Windows1252", - "ibm-5348_P100-1997", - "ibm-5348", - "windows-1252", - "cp1252", - "cp-1252" + "Windows1252", + "ibm-5348_P100-1997", + "ibm-5348", + "windows-1252", + "cp1252", + "cp-1252" }, lookup); } - -} // class Windows1252 +} // class Windows1252 diff --git a/gnu/java/nio/charset/Windows1253.java b/gnu/java/nio/charset/Windows1253.java index 9e5b1f769..711215851 100644 --- a/gnu/java/nio/charset/Windows1253.java +++ b/gnu/java/nio/charset/Windows1253.java @@ -48,53 +48,52 @@ public final class Windows1253 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x20AC, NONE, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, - NONE, 0x2030, NONE, 0x2039, NONE, NONE, NONE, NONE, - NONE, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - NONE, 0x2122, NONE, 0x203A, NONE, NONE, NONE, NONE, - 0x00A0, 0x0385, 0x0386, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, NONE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x2015, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x00B5, 0x00B6, 0x00B7, - 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, - 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, - 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, - 0x03A0, 0x03A1, NONE, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, - 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, - 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, - 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, - 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, - 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, NONE + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, NONE, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, + NONE, 0x2030, NONE, 0x2039, NONE, NONE, NONE, NONE, + NONE, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + NONE, 0x2122, NONE, 0x203A, NONE, NONE, NONE, NONE, + 0x00A0, 0x0385, 0x0386, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, NONE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x2015, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x00B5, 0x00B6, 0x00B7, + 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, + 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, + 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, + 0x03A0, 0x03A1, NONE, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, + 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, + 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, + 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, + 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, + 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, NONE }; public Windows1253() { super("windows-1253", new String[] { - "Windows1253", - "cp1253", - "cp-1253", - "cp_1253", - "windows1253", - "windows_1253" + "Windows1253", + "cp1253", + "cp-1253", + "cp_1253", + "windows1253", + "windows_1253" }, lookup); } - -} // class Windows1253 +} // class Windows1253 diff --git a/gnu/java/nio/charset/Windows1254.java b/gnu/java/nio/charset/Windows1254.java index 9025421b3..cad2057ff 100644 --- a/gnu/java/nio/charset/Windows1254.java +++ b/gnu/java/nio/charset/Windows1254.java @@ -48,53 +48,52 @@ public final class Windows1254 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x20AC, NONE, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, - 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, NONE, NONE, NONE, - NONE, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, NONE, NONE, 0x0178, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, - 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, - 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, NONE, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, + 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, NONE, NONE, NONE, + NONE, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, NONE, NONE, 0x0178, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, + 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, + 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, + 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, + 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF }; public Windows1254() { super("windows-1254", new String[] { - "Windows1254", - "cp1254", - "cp-1254", - "cp_1254", - "windows1254", - "windows_1254" + "Windows1254", + "cp1254", + "cp-1254", + "cp_1254", + "windows1254", + "windows_1254" }, lookup); } - -} // class Windows1254 +} // class Windows1254 diff --git a/gnu/java/nio/charset/Windows1255.java b/gnu/java/nio/charset/Windows1255.java index 61787d184..0d954f6ce 100644 --- a/gnu/java/nio/charset/Windows1255.java +++ b/gnu/java/nio/charset/Windows1255.java @@ -48,53 +48,52 @@ public final class Windows1255 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, - 0x02C6, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x02DC, 0x2122, 0xFFFD, 0x203A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AA, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x05B0, 0x05B1, 0x05B2, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7, - 0x05B8, 0x05B9, 0xFFFD, 0x05BB, 0x05BC, 0x05BD, 0x05BE, 0x05BF, - 0x05C0, 0x05C1, 0x05C2, 0x05C3, 0x05F0, 0x05F1, 0x05F2, 0x05F3, - 0x05F4, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, - 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, - 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, - 0x05E8, 0x05E9, 0x05EA, 0xFFFD, 0xFFFD, 0x200E, 0x200F, 0xFFFD + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, + 0x02C6, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0x02DC, 0x2122, 0xFFFD, 0x203A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AA, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, + 0x05B0, 0x05B1, 0x05B2, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7, + 0x05B8, 0x05B9, 0xFFFD, 0x05BB, 0x05BC, 0x05BD, 0x05BE, 0x05BF, + 0x05C0, 0x05C1, 0x05C2, 0x05C3, 0x05F0, 0x05F1, 0x05F2, 0x05F3, + 0x05F4, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, + 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, + 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, + 0x05E8, 0x05E9, 0x05EA, 0xFFFD, 0xFFFD, 0x200E, 0x200F, 0xFFFD }; public Windows1255() { super("windows-1255", new String[] { - "Windows1255", - "cp1255", - "cp-1255", - "cp_1255", - "windows1255", - "windows_1255" + "Windows1255", + "cp1255", + "cp-1255", + "cp_1255", + "windows1255", + "windows_1255" }, lookup); } - -} // class Windows1255 +} // class Windows1255 diff --git a/gnu/java/nio/charset/Windows1256.java b/gnu/java/nio/charset/Windows1256.java index cf88c21b4..ac822e63d 100644 --- a/gnu/java/nio/charset/Windows1256.java +++ b/gnu/java/nio/charset/Windows1256.java @@ -48,53 +48,52 @@ public final class Windows1256 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, - 0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, - 0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x06A9, 0x2122, 0x0691, 0x203A, 0x0153, 0x200C, 0x200D, 0x06BA, - 0x00A0, 0x060C, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x06BE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x061B, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x061F, - 0x06C1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, - 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, - 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00D7, - 0x0637, 0x0638, 0x0639, 0x063A, 0x0640, 0x0641, 0x0642, 0x0643, - 0x00E0, 0x0644, 0x00E2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF, - 0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7, - 0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, + 0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, + 0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0x06A9, 0x2122, 0x0691, 0x203A, 0x0153, 0x200C, 0x200D, 0x06BA, + 0x00A0, 0x060C, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x06BE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00B8, 0x00B9, 0x061B, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x061F, + 0x06C1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, + 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, + 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00D7, + 0x0637, 0x0638, 0x0639, 0x063A, 0x0640, 0x0641, 0x0642, 0x0643, + 0x00E0, 0x0644, 0x00E2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF, + 0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7, + 0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2 }; public Windows1256() { super("windows-1256", new String[] { - "Windows1256", - "cp1256", - "cp-1256", - "cp_1256", - "windows1256", - "windows_1256" + "Windows1256", + "cp1256", + "cp-1256", + "cp_1256", + "windows1256", + "windows_1256" }, lookup); } - -} // class Windows1256 +} // class Windows1256 diff --git a/gnu/java/nio/charset/Windows1257.java b/gnu/java/nio/charset/Windows1257.java index 2d281d9cd..af7b61350 100644 --- a/gnu/java/nio/charset/Windows1257.java +++ b/gnu/java/nio/charset/Windows1257.java @@ -48,53 +48,52 @@ public final class Windows1257 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x20AC, NONE, 0x201A, NONE, 0x201E, 0x2026, 0x2020, 0x2021, - NONE, 0x2030, NONE, 0x2039, NONE, 0x00A8, 0x02C7, 0x00B8, - NONE, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - NONE, 0x2122, NONE, 0x203A, NONE, 0x00AF, 0x02DB, NONE, - 0x00A0, NONE, 0x00A2, 0x00A3, 0x00A4, NONE, 0x00A6, 0x00A7, - 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6, - 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, - 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B, - 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, - 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF, - 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, - 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, - 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, - 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, NONE, 0x201A, NONE, 0x201E, 0x2026, 0x2020, 0x2021, + NONE, 0x2030, NONE, 0x2039, NONE, 0x00A8, 0x02C7, 0x00B8, + NONE, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + NONE, 0x2122, NONE, 0x203A, NONE, 0x00AF, 0x02DB, NONE, + 0x00A0, NONE, 0x00A2, 0x00A3, 0x00A4, NONE, 0x00A6, 0x00A7, + 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6, + 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, + 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B, + 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, + 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF, + 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, + 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, + 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, + 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9 }; public Windows1257() { super("windows-1257", new String[] { - "Windows1257", - "cp1257", - "cp-1257", - "cp_1257", - "windows1257", - "windows_1257" + "Windows1257", + "cp1257", + "cp-1257", + "cp_1257", + "windows1257", + "windows_1257" }, lookup); } - -} // class Windows1257 +} // class Windows1257 diff --git a/gnu/java/nio/charset/Windows1258.java b/gnu/java/nio/charset/Windows1258.java index 63ef37f1a..7fd55d99c 100644 --- a/gnu/java/nio/charset/Windows1258.java +++ b/gnu/java/nio/charset/Windows1258.java @@ -48,53 +48,52 @@ public final class Windows1258 extends ByteCharset /** * This is the lookup table for this encoding */ - private static final char[] lookup = + private static final char[] lookup = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x20AC, NONE, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, - 0x02C6, 0x2030, NONE, 0x2039, 0x0152, NONE, NONE, NONE, - NONE, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x02DC, 0x2122, NONE, 0x203A, 0x0153, NONE, NONE, 0x0178, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x00C5, 0x00C6, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x0300, 0x00CD, 0x00CE, 0x00CF, - 0x0110, 0x00D1, 0x0309, 0x00D3, 0x00D4, 0x01A0, 0x00D6, 0x00D7, - 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x01AF, 0x0303, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x00E5, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0301, 0x00ED, 0x00EE, 0x00EF, - 0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7, - 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, NONE, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, + 0x02C6, 0x2030, NONE, 0x2039, 0x0152, NONE, NONE, NONE, + NONE, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0x02DC, 0x2122, NONE, 0x203A, 0x0153, NONE, NONE, 0x0178, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, + 0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x00C5, 0x00C6, 0x00C7, + 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x0300, 0x00CD, 0x00CE, 0x00CF, + 0x0110, 0x00D1, 0x0309, 0x00D3, 0x00D4, 0x01A0, 0x00D6, 0x00D7, + 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x01AF, 0x0303, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x00E5, 0x00E6, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0301, 0x00ED, 0x00EE, 0x00EF, + 0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7, + 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF }; public Windows1258() { super("windows-1258", new String[] { - "Windows1258", - "cp1258", - "cp-1258", - "cp_1258", - "windows1258", - "windows_1258" + "Windows1258", + "cp1258", + "cp-1258", + "cp_1258", + "windows1258", + "windows_1258" }, lookup); } - -} // class Windows1258 +} // class Windows1258 diff --git a/gnu/java/nio/charset/iconv/IconvCharset.java b/gnu/java/nio/charset/iconv/IconvCharset.java index ffd2a103f..2c59267b5 100644 --- a/gnu/java/nio/charset/iconv/IconvCharset.java +++ b/gnu/java/nio/charset/iconv/IconvCharset.java @@ -63,11 +63,11 @@ public final class IconvCharset extends Charset { try { - return new IconvDecoder(this, info); + return new IconvDecoder(this, info); } catch (IllegalArgumentException e) { - return null; + return null; } } @@ -75,11 +75,11 @@ public final class IconvCharset extends Charset { try { - return new IconvEncoder(this, info); + return new IconvEncoder(this, info); } catch (IllegalArgumentException e) { - return null; + return null; } } } diff --git a/gnu/java/nio/charset/iconv/IconvDecoder.java b/gnu/java/nio/charset/iconv/IconvDecoder.java index f76d3fd5e..86f7107f2 100644 --- a/gnu/java/nio/charset/iconv/IconvDecoder.java +++ b/gnu/java/nio/charset/iconv/IconvDecoder.java @@ -78,20 +78,20 @@ final class IconvDecoder extends CharsetDecoder inArr = in.array(); else { - inArr = new byte[remIn]; - in.get(inArr); + inArr = new byte[remIn]; + in.get(inArr); } if (out.hasArray()) { - ret = decode(inArr, out.array(), inPos, remIn, outPos, remOut); - out.position(outPos + (remOut - outremaining)); + ret = decode(inArr, out.array(), inPos, remIn, outPos, remOut); + out.position(outPos + (remOut - outremaining)); } else { - char[] outArr = new char[remOut]; - ret = decode(inArr, outArr, inPos, remIn, outPos, remOut); - out.put(outArr, 0, (remOut - outremaining)); + char[] outArr = new char[remOut]; + ret = decode(inArr, outArr, inPos, remIn, outPos, remOut); + out.put(outArr, 0, (remOut - outremaining)); } in.position(inPos + (remIn - inremaining)); @@ -108,5 +108,3 @@ final class IconvDecoder extends CharsetDecoder closeIconv(); } } - - diff --git a/gnu/java/nio/charset/iconv/IconvEncoder.java b/gnu/java/nio/charset/iconv/IconvEncoder.java index 47446f98f..4f7a34b28 100644 --- a/gnu/java/nio/charset/iconv/IconvEncoder.java +++ b/gnu/java/nio/charset/iconv/IconvEncoder.java @@ -78,20 +78,20 @@ final class IconvEncoder extends CharsetEncoder inArr = in.array(); else { - inArr = new char[remIn]; - in.get(inArr); + inArr = new char[remIn]; + in.get(inArr); } if (out.hasArray()) { - ret = encode(inArr, out.array(), inPos, remIn, outPos, remOut); - out.position(outPos + (remOut - outremaining)); + ret = encode(inArr, out.array(), inPos, remIn, outPos, remOut); + out.position(outPos + (remOut - outremaining)); } else { - byte[] outArr = new byte[remOut]; - ret = encode(inArr, outArr, inPos, remIn, outPos, remOut); - out.put(outArr, 0, (remOut - outremaining)); + byte[] outArr = new byte[remOut]; + ret = encode(inArr, outArr, inPos, remIn, outPos, remOut); + out.put(outArr, 0, (remOut - outremaining)); } in.position(inPos + (remIn - inremaining)); diff --git a/gnu/java/nio/charset/iconv/IconvProvider.java b/gnu/java/nio/charset/iconv/IconvProvider.java index cf9fc56a2..1d5ca1052 100644 --- a/gnu/java/nio/charset/iconv/IconvProvider.java +++ b/gnu/java/nio/charset/iconv/IconvProvider.java @@ -72,13 +72,13 @@ public final class IconvProvider extends CharsetProvider Vector charsets = new Vector(); for (int i = 0; i < names.size(); i++) { - try - { - charsets.add(new IconvCharset((IconvMetaData) names.elementAt(i))); - } - catch (IllegalArgumentException e) - { - } + try + { + charsets.add(new IconvCharset((IconvMetaData) names.elementAt(i))); + } + catch (IllegalArgumentException e) + { + } } return charsets.iterator(); } @@ -87,17 +87,17 @@ public final class IconvProvider extends CharsetProvider { try { - IconvMetaData info = IconvMetaData.get(charsetName); + IconvMetaData info = IconvMetaData.get(charsetName); - // Try anyway if the set isn't found. - if (info == null) - info = new IconvMetaData(charsetName, 2.0f, 2.0f, 2.0f, 2.0f, - new String[] { }, charsetName); - return new IconvCharset(info); + // Try anyway if the set isn't found. + if (info == null) + info = new IconvMetaData(charsetName, 2.0f, 2.0f, 2.0f, 2.0f, + new String[] { }, charsetName); + return new IconvCharset(info); } catch (IllegalArgumentException e) { - return null; + return null; } } diff --git a/gnu/java/rmi/RMIMarshalledObjectInputStream.java b/gnu/java/rmi/RMIMarshalledObjectInputStream.java index 140069379..f96310750 100644 --- a/gnu/java/rmi/RMIMarshalledObjectInputStream.java +++ b/gnu/java/rmi/RMIMarshalledObjectInputStream.java @@ -7,7 +7,7 @@ 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 @@ -45,21 +45,21 @@ import java.io.IOException; import java.io.ObjectInputStream; /** - * This class is only for java.rmi.MarshalledObject to deserialize object from + * This class is only for java.rmi.MarshalledObject to deserialize object from * objBytes and locBytes */ public class RMIMarshalledObjectInputStream extends RMIObjectInputStream { private ObjectInputStream locStream; - + public RMIMarshalledObjectInputStream(byte[] objBytes, byte[] locBytes) throws IOException { super(new ByteArrayInputStream(objBytes)); if(locBytes != null) locStream = new ObjectInputStream(new ByteArrayInputStream(locBytes)); } - + //This method overrides RMIObjectInputStream's protected Object getAnnotation() throws IOException, ClassNotFoundException { @@ -67,5 +67,5 @@ public class RMIMarshalledObjectInputStream extends RMIObjectInputStream return null; return locStream.readObject(); } - + } // End of RMIMarshalledObjectInputStream diff --git a/gnu/java/rmi/RMIMarshalledObjectOutputStream.java b/gnu/java/rmi/RMIMarshalledObjectOutputStream.java index 2bbbaacb4..3bdf9239f 100644 --- a/gnu/java/rmi/RMIMarshalledObjectOutputStream.java +++ b/gnu/java/rmi/RMIMarshalledObjectOutputStream.java @@ -7,7 +7,7 @@ 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 @@ -46,34 +46,33 @@ import java.io.ObjectOutputStream; import java.io.OutputStream; /** - * This class is only for java.rmi.MarshalledObject to serialize object and + * This class is only for java.rmi.MarshalledObject to serialize object and * got objBytes and locBytes */ public class RMIMarshalledObjectOutputStream extends RMIObjectOutputStream { private ObjectOutputStream locStream; private ByteArrayOutputStream locBytesStream; - + public RMIMarshalledObjectOutputStream(OutputStream objStream) throws IOException { super(objStream); locBytesStream = new ByteArrayOutputStream(256); locStream = new ObjectOutputStream(locBytesStream); } - + //This method overrides RMIObjectOutputStream's. protected void setAnnotation(String annotation) throws IOException{ locStream.writeObject(annotation); } - + public void flush() throws IOException { super.flush(); locStream.flush(); } - + public byte[] getLocBytes(){ return locBytesStream.toByteArray(); } - -} // End of RMIMarshalledObjectOutputStream +} // End of RMIMarshalledObjectOutputStream diff --git a/gnu/java/rmi/activation/ActivationSystemTransient.java b/gnu/java/rmi/activation/ActivationSystemTransient.java index 1557220e1..975e13fd1 100644 --- a/gnu/java/rmi/activation/ActivationSystemTransient.java +++ b/gnu/java/rmi/activation/ActivationSystemTransient.java @@ -59,7 +59,7 @@ import java.util.Map; /** * Provides the default transient activation system. - * + * * @author Audrius Meskauskas (audriusa@bioinformatics.org) */ public class ActivationSystemTransient @@ -69,8 +69,8 @@ public class ActivationSystemTransient /** * Maps group identifiers into group descriptions. */ - protected final BidiTable groupDescs; - + protected final BidiTable groupDescs; + /** * Maps object identifiers into object activation descriptions */ @@ -80,29 +80,29 @@ public class ActivationSystemTransient * Maps group identifiers into already activated groups. */ protected transient final Map groupInstantiators = new Hashtable(); - + /** * The cache of the activated objects, maps activation ids to remote * object stubs. */ protected transient final Map activatedObjects = new HashMap(); - + /** * The object incarnation counter. */ static long groupIncarnations = 0; - + /** * The singleton of this activation system */ static ActivationSystem singleton; - + /** * Set to true to print the event messages to console. */ public static boolean debug = false; - - + + /** * Creates the group which uses the given maps to store the data. */ @@ -112,7 +112,7 @@ public class ActivationSystemTransient descriptions = objectDescriptions; groupDescs = groupDescriptiopns; } - + /** * Creates the group with transient maps. */ @@ -120,14 +120,14 @@ public class ActivationSystemTransient { this (new BidiTable(), new BidiTable()); } - + public static ActivationSystem getInstance() { if (singleton == null) singleton = new ActivationSystemTransient(); return singleton; } - + /** * Activate the given object (try cache first if force = false) */ @@ -149,7 +149,7 @@ public class ActivationSystemTransient throw new UnknownObjectException("Activating unknown object "+ id == null ? "null" : id.toString()); - ActivationInstantiator group = + ActivationInstantiator group = (ActivationInstantiator) groupInstantiators.get(desc.getGroupID()); if (group == null) @@ -159,7 +159,7 @@ public class ActivationSystemTransient ActivationGroupDesc adesc = (ActivationGroupDesc) groupDescs.get(gid); if (adesc == null) - throw new UnknownGroupException("Activating unknown group " + throw new UnknownGroupException("Activating unknown group " + gid + " for "+ id+" this "+this); synchronized (ActivationSystemTransient.class) @@ -179,7 +179,7 @@ public class ActivationSystemTransient } return object; } - + /** * Returns the activation monitor (THIS) and remebers the instantiator, used * by that group. @@ -192,10 +192,10 @@ public class ActivationSystemTransient groupInstantiators.put(id, group); return this; } - + /** * Get the activation descriptor for the given activation id. - * + * * @return the activation descriptor, never null. * @throws UnknownObjectException if such object is unknown. */ @@ -208,10 +208,10 @@ public class ActivationSystemTransient id == null ? "null" : id.toString()); return desc; } - + /** * Get the descriptor of the given activation group. - * + * * @return the activation group descriptor, never null. * @throws UnknownGroupException if such group is unknown */ @@ -245,7 +245,7 @@ public class ActivationSystemTransient return id; } - + /** * Create the object activation id and put this id-descriptor combination into * the group map. The new ID will only be created if this description has not @@ -261,13 +261,13 @@ public class ActivationSystemTransient id = new ActivationID(this); descriptions.put(id, desc); } - + if (debug) System.out.println("Register object " + id +":"+desc+" this "+this); - + return id; } - + /** * Replace the activation descriptor, return the previous descriptor. */ @@ -279,7 +279,7 @@ public class ActivationSystemTransient descriptions.put(id, desc); return prev; } - + /** * Replace the activation group descriptor, return the previous descriptor. */ @@ -292,7 +292,7 @@ public class ActivationSystemTransient groupDescs.put(groupId, groupDesc); return prev; } - + /** * Calls .shutdown on all bidirectional tables (has no effect if these * table are not persistent). @@ -302,7 +302,7 @@ public class ActivationSystemTransient descriptions.shutdown(); groupDescs.shutdown(); } - + /** * Remove the group from the group map */ @@ -311,11 +311,11 @@ public class ActivationSystemTransient { if (! groupDescs.containsKey(groupId)) throw new UnknownGroupException("Unknown group "+groupId); - + groupDescs.removeKey(groupId); groupInstantiators.remove(groupId); } - + /** * Remove the object id from the active object and description maps. */ @@ -331,7 +331,7 @@ public class ActivationSystemTransient activatedObjects.remove(id); } } - + /** * Put the object into active object map. */ @@ -360,7 +360,7 @@ public class ActivationSystemTransient throw un; } } - + /** * Check if the group is known. Remove all active objects, belonging to * that group, from the active object cache. @@ -370,9 +370,9 @@ public class ActivationSystemTransient { if (! groupInstantiators.containsKey(groupId)) throw new UnknownGroupException("Inactivating unkwnon group"); - + groupInstantiators.remove(groupId); - + // Remove all members of this group from the cache. synchronized (activatedObjects) { diff --git a/gnu/java/rmi/activation/BidiTable.java b/gnu/java/rmi/activation/BidiTable.java index 5e421fe8d..ed9d9595a 100644 --- a/gnu/java/rmi/activation/BidiTable.java +++ b/gnu/java/rmi/activation/BidiTable.java @@ -45,26 +45,26 @@ import java.util.Map; /** * The bidirectional hash table, maps both a to b and b to a. - * - * @author Audrius Meskauskas (audriusa@bioinformatics.org) + * + * @author Audrius Meskauskas (audriusa@bioinformatics.org) */ -public class BidiTable +public class BidiTable { /** * Use serialVerionUID for interoperability. */ private static final long serialVersionUID = 1; - + /** * Maps keys to values */ protected Map k2v; - + /** * Maps values to keys (in reverse) */ protected Map v2k; - + /** * Create a new table that is ready to use. */ @@ -73,17 +73,17 @@ public class BidiTable k2v = new HashMap(); v2k = new HashMap(); } - + /** * Create a new instance where the hashtable fields are not initialised * (called from derivatives that intialise hashtables in they own way. - * + * * @param flags currently used to mark the different constructor only. */ protected BidiTable(int flags) { } - + /** * Get key by value */ @@ -91,7 +91,7 @@ public class BidiTable { return v2k.get(value); } - + /** * Put key-value pair. */ @@ -100,7 +100,7 @@ public class BidiTable k2v.put(key, value); v2k.put(value, key); } - + /** * Get value from key */ @@ -108,7 +108,7 @@ public class BidiTable { return k2v.get(key); } - + /** * Remove the key-value pair by key */ @@ -121,7 +121,7 @@ public class BidiTable v2k.remove(value); } } - + /** * Check if the table contains this key. */ @@ -129,7 +129,7 @@ public class BidiTable { return k2v.containsKey(key); } - + /** * This method is called before exit and may be used to write the database * to the disk. The default method does nothing. @@ -137,7 +137,7 @@ public class BidiTable public synchronized void shutdown() { } - + /** * Get the size. */ @@ -145,7 +145,7 @@ public class BidiTable { return k2v.size(); } - + /** * Get the key collection. */ @@ -157,7 +157,7 @@ public class BidiTable Iterator iter = keys.iterator(); for (int i = 0; i < k.length; i++) k[i] = iter.next(); - + return k; } } diff --git a/gnu/java/rmi/activation/DefaultActivationGroup.java b/gnu/java/rmi/activation/DefaultActivationGroup.java index 3a654f246..526d2ef40 100644 --- a/gnu/java/rmi/activation/DefaultActivationGroup.java +++ b/gnu/java/rmi/activation/DefaultActivationGroup.java @@ -55,9 +55,9 @@ import java.rmi.activation.UnknownObjectException; /** * The default activation group class. This activation group assumes that * all classes are accessible via current thread context class loader. - * The remote class loading is not supported for security reasons. The + * The remote class loading is not supported for security reasons. The * activation always occurs in the current jre. - * + * * @author Audrius Meskauskas (audriusa@Bioinformatics.org) */ public class DefaultActivationGroup @@ -67,7 +67,7 @@ public class DefaultActivationGroup * Use the serialVersionUID for interoperability. */ private static final long serialVersionUID = 1; - + /** * Used during the group creation (required constructor). */ @@ -76,23 +76,23 @@ public class DefaultActivationGroup ActivationID.class, MarshalledObject.class }; - - + + /** * Create the new default activation group. - * + * * @param id the group activation id. * @param data may contain the group initialization data (unused and can be * null) * @throws RemoteException if the super constructor does - */ + */ public DefaultActivationGroup(ActivationGroupID id, MarshalledObject data) throws RemoteException { super(id); } - - + + /** * May be overridden and used as a hook. This method is called each time * the new object is instantiated. @@ -108,14 +108,14 @@ public class DefaultActivationGroup * information, stored in the passed descriptor. The method expects the object * class to have the two parameter constructor, the first parameter being the * {@link ActivationID} and the second the {@link MarshalledObject}. - * + * * @param id the object activation id * @param desc the activation descriptor, providing the information, necessary * to create and activate the object * @return the marshalled object, containing the exported stub of the created * object * @throws ActivationException if the activation fails due any reason - */ + */ public MarshalledObject newInstance(ActivationID id, ActivationDesc desc) throws ActivationException, RemoteException { @@ -123,7 +123,7 @@ public class DefaultActivationGroup { if (ActivationSystemTransient.debug) System.out.println("Instantiating "+desc.getClassName()); - + Remote object; Class objectClass; @@ -132,19 +132,19 @@ public class DefaultActivationGroup Constructor constructor = objectClass.getConstructor(cConstructorTypes); object = (Remote) constructor.newInstance( new Object[] { id, desc.getData() }); - + // Make the object accessible and create the stub. ActivatableServerRef ref = UnicastServer.getActivatableRef(id); Remote stub = ref.exportObject(object); - + MarshalledObject marsh = new MarshalledObject(stub); - + // Notify the activation monitor. activeObject(id, marsh); - + // Make call to the hook that may be overridden. activeObject(id, stub); - + return marsh; } catch (Exception e) diff --git a/gnu/java/rmi/activation/DefaultActivationSystem.java b/gnu/java/rmi/activation/DefaultActivationSystem.java index 754b5dcb9..3d1625052 100644 --- a/gnu/java/rmi/activation/DefaultActivationSystem.java +++ b/gnu/java/rmi/activation/DefaultActivationSystem.java @@ -44,7 +44,7 @@ import java.rmi.registry.Registry; /** * Finds and returns the default activation system for this jre. - * + * * @author Audrius Meskauskas (audriusa@bioinformatics.org) */ public abstract class DefaultActivationSystem @@ -53,17 +53,17 @@ public abstract class DefaultActivationSystem * The activation system (assigned if once found). */ static ActivationSystem system; - + /** * The default activation registry port. */ static int ACTIVATION_REGISTRY_PORT; - + /** * The name of the activation system registry port property. */ static String AS_PORT_PROPERTY = "java.rmi.activation.port"; - + /** * The defalut name of the activation system in the activation registry. */ diff --git a/gnu/java/rmi/dgc/DGCImpl.java b/gnu/java/rmi/dgc/DGCImpl.java index a5c036e7b..5efbf2796 100644 --- a/gnu/java/rmi/dgc/DGCImpl.java +++ b/gnu/java/rmi/dgc/DGCImpl.java @@ -68,12 +68,12 @@ public class DGCImpl * The DGCImpl extends UnicastServerRef and not UnicastRemoteObject, because * UnicastRemoteObject must exportObject automatically. */ - + /** * Use the serial version UID for interoperability. */ private static final long serialVersionUID = 1; - + /** * Protects the array of object Id's for the scheduled period of time * (lease). After the time expires, the protector is automatically discarded, @@ -87,11 +87,11 @@ public class DGCImpl * multiple references that are stored to collection. */ Collection[] references; - + /** * Create the new instance of the reference protector that protects the * given array of ids and exists for the given period of time. - * + * * @param ids the ids to protect. */ RefProtector(ObjID[] ids, long timeToLive) @@ -101,11 +101,11 @@ public class DGCImpl { references[i] = UnicastServer.getExported(ids[i]); } - + // Schedule the existence. LeaseRenewingTask.timer.schedule(this, timeToLive); } - + /** * Break all links, ensuring easy collection of the references by the gc. */ @@ -118,16 +118,16 @@ public class DGCImpl } } } - + /** * This defauld lease value is used if the lease value, passed to the * {@link #dirty} is equal to zero. */ static final long LEASE_VALUE = 600000L; - + /** * Create the new DGC implementation. - * + * * @throws RemoteException if the super constructor throws or the * socket factory fails. */ @@ -138,7 +138,7 @@ public class DGCImpl /** * Mark the given objects referecnes as used on the client side. - * + * * @param ids the ids of the used objects. * @param sequenceNum the number of the call (used to detect and discard late * calls). @@ -147,17 +147,17 @@ public class DGCImpl */ public Lease dirty(ObjID[] ids, long sequenceNum, Lease lease) throws RemoteException - { + { // We do not fill in VMID because in this implementation it is not used. long leaseValue = lease.getValue(); - + // Grant the maximal default lease time if the passed value is zero. if (leaseValue <= 0) leaseValue = LEASE_VALUE; - + // Create (and shedule of the given existence) the new reference // protector. - new RefProtector(ids, leaseValue); + new RefProtector(ids, leaseValue); lease = new Lease(lease.getVMID(), leaseValue); return lease; @@ -165,7 +165,7 @@ public class DGCImpl /** * Mark the given objects as no longer used on the client side. - * + * * @param ids the ids of the objects that are no longer used. * @param sequenceNum the number of the call (used to detect and discard late * calls) diff --git a/gnu/java/rmi/dgc/DGCImpl_Skel.java b/gnu/java/rmi/dgc/DGCImpl_Skel.java index 5f032e72f..a40b48ca0 100644 --- a/gnu/java/rmi/dgc/DGCImpl_Skel.java +++ b/gnu/java/rmi/dgc/DGCImpl_Skel.java @@ -44,16 +44,16 @@ public final class DGCImpl_Skel implements java.rmi.server.Skeleton { private static final long interfaceHash = -669196253586618813L; - + private static final java.rmi.server.Operation[] operations = { new java.rmi.server.Operation("void clean(java.rmi.server.ObjID[], long, java.rmi.dgc.VMID, boolean"), new java.rmi.server.Operation("java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease") }; - + public java.rmi.server.Operation[] getOperations() { return ((java.rmi.server.Operation[]) operations.clone()); } - + public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call, int opnum, long hash) throws java.lang.Exception { if (opnum < 0) { if (hash == -5803803475088455571L) { @@ -69,7 +69,7 @@ public final class DGCImpl_Skel else if (hash != interfaceHash) { throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch"); } - + gnu.java.rmi.dgc.DGCImpl server = (gnu.java.rmi.dgc.DGCImpl)obj; switch (opnum) { case 0: @@ -84,7 +84,7 @@ public final class DGCImpl_Skel $param_1 = (long)in.readLong(); $param_2 = (java.rmi.dgc.VMID)in.readObject(); $param_3 = (boolean)in.readBoolean(); - + } catch (java.io.IOException e) { throw new java.rmi.UnmarshalException("error unmarshalling arguments", e); @@ -104,7 +104,7 @@ public final class DGCImpl_Skel } break; } - + case 1: { java.rmi.server.ObjID[] $param_0; @@ -115,7 +115,7 @@ public final class DGCImpl_Skel $param_0 = (java.rmi.server.ObjID[])in.readObject(); $param_1 = (long)in.readLong(); $param_2 = (java.rmi.dgc.Lease)in.readObject(); - + } catch (java.io.IOException e) { throw new java.rmi.UnmarshalException("error unmarshalling arguments", e); @@ -136,7 +136,7 @@ public final class DGCImpl_Skel } break; } - + default: throw new java.rmi.UnmarshalException("invalid method number"); } diff --git a/gnu/java/rmi/dgc/DGCImpl_Stub.java b/gnu/java/rmi/dgc/DGCImpl_Stub.java index 9f18d129e..dac8b6f4c 100644 --- a/gnu/java/rmi/dgc/DGCImpl_Stub.java +++ b/gnu/java/rmi/dgc/DGCImpl_Stub.java @@ -45,39 +45,39 @@ public final class DGCImpl_Stub implements java.rmi.dgc.DGC { private static final long serialVersionUID = 2L; - + private static final long interfaceHash = -669196253586618813L; - + private static boolean useNewInvoke; - + private static final java.rmi.server.Operation[] operations = { new java.rmi.server.Operation("void clean(java.rmi.server.ObjID[], long, java.rmi.dgc.VMID, boolean)"), new java.rmi.server.Operation("java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)") }; - + private static java.lang.reflect.Method $method_clean_0; private static java.lang.reflect.Method $method_dirty_1; - + static { try { java.rmi.server.RemoteRef.class.getMethod("invoke", new java.lang.Class[] { java.rmi.Remote.class, java.lang.reflect.Method.class, java.lang.Object[].class, long.class }); useNewInvoke = true; $method_clean_0 = gnu.java.rmi.dgc.DGCImpl.class.getMethod("clean", new java.lang.Class[] {java.rmi.server.ObjID[].class, long.class, java.rmi.dgc.VMID.class, boolean.class}); $method_dirty_1 = gnu.java.rmi.dgc.DGCImpl.class.getMethod("dirty", new java.lang.Class[] {java.rmi.server.ObjID[].class, long.class, java.rmi.dgc.Lease.class}); - + } catch (java.lang.NoSuchMethodException e) { useNewInvoke = false; } } - + public DGCImpl_Stub() { super(); } public DGCImpl_Stub(java.rmi.server.RemoteRef ref) { super(ref); } - + public void clean(java.rmi.server.ObjID[] $param_0, long $param_1, java.rmi.dgc.VMID $param_2, boolean $param_3) throws java.rmi.RemoteException { try { if (useNewInvoke) { @@ -114,7 +114,7 @@ public final class DGCImpl_Stub throw new java.rmi.UnexpectedException("undeclared checked exception", e); } } - + public java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[] $param_0, long $param_1, java.rmi.dgc.Lease $param_2) throws java.rmi.RemoteException { try { if (useNewInvoke) { @@ -154,5 +154,5 @@ public final class DGCImpl_Stub throw new java.rmi.UnexpectedException("undeclared checked exception", e); } } - + } diff --git a/gnu/java/rmi/dgc/LeaseRenewingTask.java b/gnu/java/rmi/dgc/LeaseRenewingTask.java index ffb5560af..7995af744 100644 --- a/gnu/java/rmi/dgc/LeaseRenewingTask.java +++ b/gnu/java/rmi/dgc/LeaseRenewingTask.java @@ -54,11 +54,11 @@ import java.util.WeakHashMap; * sheduled task does not prevent it from being garbage collected. If the * reference has not been garbage collected, the task is resheduled after * the lease is renewed. - * + * * @author Audrius Meskauskas (Audriusa@Bioinformatics.org) */ public class LeaseRenewingTask -{ +{ /** * The sheduled timer task to call the renew() method. */ @@ -69,12 +69,12 @@ public class LeaseRenewingTask renew(); } } - + /** * The default requested lease duration time (one minute by default). */ public static long REQUEST_LEASE_DURATION = 60000; - + /** * The reference to the UnicastRef that must renew its lease until not * garbage collected. The different members of this list may point to the @@ -84,28 +84,28 @@ public class LeaseRenewingTask * frequent deletions from the middle easy. */ LinkedList ref = new LinkedList(); - + /** * The granted (or supposed) lease. */ Lease lease = new Lease(null, REQUEST_LEASE_DURATION); - + /** * The timer, shared by all lease renewing tasks. The same instance is also * used for the reference protector discarding in DGCImpl. */ static Timer timer = new Timer(true); - + /** * Maps the UnicastRef to its renewing task. */ - static WeakHashMap existingTasks = new WeakHashMap(); - + static WeakHashMap existingTasks = new WeakHashMap(); + /** * Creates the lease renewing task that renews the lease of the given * UnicastRef until it is not collected. This constructor requests the lease * value from the server and schedules the lease renewal action. - * + * * @param renewIt the reference that must be renewed. */ public LeaseRenewingTask(UnicastRef renewIt) @@ -117,10 +117,10 @@ public class LeaseRenewingTask ref.add(new WeakReference(renewIt)); } } - + /** * Schedule periodic leases for the given UnicastRef reference. - * + * * @param renewIt the reference, for that the leases must be scheduled. */ public static void scheduleLeases(UnicastRef renewIt) @@ -155,23 +155,23 @@ public class LeaseRenewingTask throw ierr; } } - + /** * Shedule the renewing call, taking into consideration that the following * lease was granted. - * + * * @param lease the lease that was granted. */ public void schedule(Lease lease) { long value = lease.getValue(); - + // Shedule a 10 % earlier because some time is needed for the message // to reach the server. long reduced = (value * 90)/100; if (reduced == 0) reduced = value; - + timer.schedule(new LeaseTimerTask(), reduced); } @@ -197,11 +197,11 @@ public class LeaseRenewingTask iter.remove(); } } - + if (renewIt!=null) { Lease lease = notifyDGC( (UnicastRef) renewIt); - + // Schedule the next renewing session. if (lease!=null) schedule(lease); @@ -210,10 +210,10 @@ public class LeaseRenewingTask // All references collected - discard this entry. } } - + /** * Notify DGC that we still hold this reference. - * + * * @param renewIt the reference we still have (must not be null). */ public Lease notifyDGC(UnicastRef renewIt) diff --git a/gnu/java/rmi/registry/RegistryImpl.java b/gnu/java/rmi/registry/RegistryImpl.java index 7dcca612a..51d49a4f3 100644 --- a/gnu/java/rmi/registry/RegistryImpl.java +++ b/gnu/java/rmi/registry/RegistryImpl.java @@ -8,7 +8,7 @@ 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 @@ -56,99 +56,99 @@ import java.util.Enumeration; import java.util.Hashtable; public class RegistryImpl - extends UnicastRemoteObject implements Registry { + extends UnicastRemoteObject implements Registry { private Hashtable bindings = new Hashtable(); public RegistryImpl(int port) throws RemoteException { - this(port, RMISocketFactory.getSocketFactory(), RMISocketFactory.getSocketFactory()); + this(port, RMISocketFactory.getSocketFactory(), RMISocketFactory.getSocketFactory()); } public RegistryImpl(int port, RMIClientSocketFactory cf, RMIServerSocketFactory sf) throws RemoteException { - super(new UnicastServerRef(new ObjID(ObjID.REGISTRY_ID), port, sf)); - // The following is unnecessary, because UnicastRemoteObject export itself automatically. - //((UnicastServerRef)getRef()).exportObject(this); + super(new UnicastServerRef(new ObjID(ObjID.REGISTRY_ID), port, sf)); + // The following is unnecessary, because UnicastRemoteObject export itself automatically. + //((UnicastServerRef)getRef()).exportObject(this); } public Remote lookup(String name) throws RemoteException, NotBoundException, AccessException { - Object obj = bindings.get(name); - if (obj == null) { - throw new NotBoundException(name); - } - return ((Remote)obj); + Object obj = bindings.get(name); + if (obj == null) { + throw new NotBoundException(name); + } + return ((Remote)obj); } public void bind(String name, Remote obj) throws RemoteException, AlreadyBoundException, AccessException { - if (bindings.containsKey(name)) { - throw new AlreadyBoundException(name); - } - bindings.put(name, obj); + if (bindings.containsKey(name)) { + throw new AlreadyBoundException(name); + } + bindings.put(name, obj); } public void unbind(String name) throws RemoteException, NotBoundException, AccessException { - Object obj = bindings.remove(name); - if (obj == null) { - throw new NotBoundException(name); - } + Object obj = bindings.remove(name); + if (obj == null) { + throw new NotBoundException(name); + } } public void rebind(String name, Remote obj) throws RemoteException, AccessException { - bindings.put(name, obj); + bindings.put(name, obj); } public String[] list() throws RemoteException, AccessException { - int size = bindings.size(); - String[] strings = new String[size]; - Enumeration e = bindings.keys(); - for (int i = 0; i < size; i++) { - strings[i] = (String)e.nextElement(); - } - return (strings); + int size = bindings.size(); + String[] strings = new String[size]; + Enumeration e = bindings.keys(); + for (int i = 0; i < size; i++) { + strings[i] = (String)e.nextElement(); + } + return (strings); } public static void version() { - System.out.println("rmiregistry (" - + System.getProperty("java.vm.name") - + ") " - + System.getProperty("java.vm.version")); - System.out.println("Copyright 2006 Free Software Foundation, Inc."); - System.out.println("This is free software; see the source for copying conditions. There is NO"); - System.out.println("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."); - System.exit(0); + System.out.println("rmiregistry (" + + System.getProperty("java.vm.name") + + ") " + + System.getProperty("java.vm.version")); + System.out.println("Copyright 2006 Free Software Foundation, Inc."); + System.out.println("This is free software; see the source for copying conditions. There is NO"); + System.out.println("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."); + System.exit(0); } public static void help() { - System.out.println( + System.out.println( "Usage: rmiregistry [OPTION | PORT]\n" + "\n" + " --help Print this help, then exit\n" + " --version Print version number, then exit\n"); - System.exit(0); + System.exit(0); } public static void main(String[] args) { - int port = Registry.REGISTRY_PORT; - if (args.length > 0) { - if (args[0].equals("--version")) { - version(); - } - else if (args[0].equals("--help")) { - help(); - } - try { - port = Integer.parseInt(args[0]); - } - catch (NumberFormatException _) { - System.err.println("Bad port number - using default"); - } - } - - try { - Registry impl = LocateRegistry.createRegistry(port); - } - catch (RemoteException _) { - System.err.println("Registry failed"); - } + int port = Registry.REGISTRY_PORT; + if (args.length > 0) { + if (args[0].equals("--version")) { + version(); + } + else if (args[0].equals("--help")) { + help(); + } + try { + port = Integer.parseInt(args[0]); + } + catch (NumberFormatException _) { + System.err.println("Bad port number - using default"); + } + } + + try { + Registry impl = LocateRegistry.createRegistry(port); + } + catch (RemoteException _) { + System.err.println("Registry failed"); + } } } diff --git a/gnu/java/rmi/registry/RegistryImpl_Skel.java b/gnu/java/rmi/registry/RegistryImpl_Skel.java index 8cf14ccc0..defa3bf61 100644 --- a/gnu/java/rmi/registry/RegistryImpl_Skel.java +++ b/gnu/java/rmi/registry/RegistryImpl_Skel.java @@ -44,7 +44,7 @@ public final class RegistryImpl_Skel implements java.rmi.server.Skeleton { private static final long interfaceHash = 4905912898345647071L; - + private static final java.rmi.server.Operation[] operations = { new java.rmi.server.Operation("void bind(java.lang.String, java.rmi.Remote"), new java.rmi.server.Operation("java.lang.String[] list("), @@ -52,11 +52,11 @@ public final class RegistryImpl_Skel new java.rmi.server.Operation("void rebind(java.lang.String, java.rmi.Remote"), new java.rmi.server.Operation("void unbind(java.lang.String") }; - + public java.rmi.server.Operation[] getOperations() { return ((java.rmi.server.Operation[]) operations.clone()); } - + public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call, int opnum, long hash) throws java.lang.Exception { if (opnum < 0) { if (hash == 7583982177005850366L) { @@ -81,7 +81,7 @@ public final class RegistryImpl_Skel else if (hash != interfaceHash) { throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch"); } - + gnu.java.rmi.registry.RegistryImpl server = (gnu.java.rmi.registry.RegistryImpl)obj; switch (opnum) { case 0: @@ -92,7 +92,7 @@ public final class RegistryImpl_Skel java.io.ObjectInput in = call.getInputStream(); $param_0 = (java.lang.String)in.readObject(); $param_1 = (java.rmi.Remote)in.readObject(); - + } catch (java.io.IOException e) { throw new java.rmi.UnmarshalException("error unmarshalling arguments", e); @@ -112,12 +112,12 @@ public final class RegistryImpl_Skel } break; } - + case 1: { try { java.io.ObjectInput in = call.getInputStream(); - + } catch (java.io.IOException e) { throw new java.rmi.UnmarshalException("error unmarshalling arguments", e); @@ -135,14 +135,14 @@ public final class RegistryImpl_Skel } break; } - + case 2: { java.lang.String $param_0; try { java.io.ObjectInput in = call.getInputStream(); $param_0 = (java.lang.String)in.readObject(); - + } catch (java.io.IOException e) { throw new java.rmi.UnmarshalException("error unmarshalling arguments", e); @@ -163,7 +163,7 @@ public final class RegistryImpl_Skel } break; } - + case 3: { java.lang.String $param_0; @@ -172,7 +172,7 @@ public final class RegistryImpl_Skel java.io.ObjectInput in = call.getInputStream(); $param_0 = (java.lang.String)in.readObject(); $param_1 = (java.rmi.Remote)in.readObject(); - + } catch (java.io.IOException e) { throw new java.rmi.UnmarshalException("error unmarshalling arguments", e); @@ -192,14 +192,14 @@ public final class RegistryImpl_Skel } break; } - + case 4: { java.lang.String $param_0; try { java.io.ObjectInput in = call.getInputStream(); $param_0 = (java.lang.String)in.readObject(); - + } catch (java.io.IOException e) { throw new java.rmi.UnmarshalException("error unmarshalling arguments", e); @@ -219,7 +219,7 @@ public final class RegistryImpl_Skel } break; } - + default: throw new java.rmi.UnmarshalException("invalid method number"); } diff --git a/gnu/java/rmi/registry/RegistryImpl_Stub.java b/gnu/java/rmi/registry/RegistryImpl_Stub.java index b289426b4..786a5e180 100644 --- a/gnu/java/rmi/registry/RegistryImpl_Stub.java +++ b/gnu/java/rmi/registry/RegistryImpl_Stub.java @@ -45,11 +45,11 @@ public final class RegistryImpl_Stub implements java.rmi.registry.Registry { private static final long serialVersionUID = 2L; - + private static final long interfaceHash = 4905912898345647071L; - + private static boolean useNewInvoke; - + private static final java.rmi.server.Operation[] operations = { new java.rmi.server.Operation("void bind(java.lang.String, java.rmi.Remote)"), new java.rmi.server.Operation("java.lang.String[] list()"), @@ -57,13 +57,13 @@ public final class RegistryImpl_Stub new java.rmi.server.Operation("void rebind(java.lang.String, java.rmi.Remote)"), new java.rmi.server.Operation("void unbind(java.lang.String)") }; - + private static java.lang.reflect.Method $method_bind_0; private static java.lang.reflect.Method $method_list_1; private static java.lang.reflect.Method $method_lookup_2; private static java.lang.reflect.Method $method_rebind_3; private static java.lang.reflect.Method $method_unbind_4; - + static { try { java.rmi.server.RemoteRef.class.getMethod("invoke", new java.lang.Class[] { java.rmi.Remote.class, java.lang.reflect.Method.class, java.lang.Object[].class, long.class }); @@ -73,20 +73,20 @@ public final class RegistryImpl_Stub $method_lookup_2 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("lookup", new java.lang.Class[] {java.lang.String.class}); $method_rebind_3 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("rebind", new java.lang.Class[] {java.lang.String.class, java.rmi.Remote.class}); $method_unbind_4 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("unbind", new java.lang.Class[] {java.lang.String.class}); - + } catch (java.lang.NoSuchMethodException e) { useNewInvoke = false; } } - + public RegistryImpl_Stub() { super(); } public RegistryImpl_Stub(java.rmi.server.RemoteRef ref) { super(ref); } - + public void bind(java.lang.String $param_0, java.rmi.Remote $param_1) throws java.rmi.AccessException, java.rmi.AlreadyBoundException, java.rmi.RemoteException { try { if (useNewInvoke) { @@ -127,7 +127,7 @@ public final class RegistryImpl_Stub throw new java.rmi.UnexpectedException("undeclared checked exception", e); } } - + public java.lang.String[] list() throws java.rmi.AccessException, java.rmi.RemoteException { try { if (useNewInvoke) { @@ -167,7 +167,7 @@ public final class RegistryImpl_Stub throw new java.rmi.UnexpectedException("undeclared checked exception", e); } } - + public java.rmi.Remote lookup(java.lang.String $param_0) throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException { try { if (useNewInvoke) { @@ -211,7 +211,7 @@ public final class RegistryImpl_Stub throw new java.rmi.UnexpectedException("undeclared checked exception", e); } } - + public void rebind(java.lang.String $param_0, java.rmi.Remote $param_1) throws java.rmi.AccessException, java.rmi.RemoteException { try { if (useNewInvoke) { @@ -249,7 +249,7 @@ public final class RegistryImpl_Stub throw new java.rmi.UnexpectedException("undeclared checked exception", e); } } - + public void unbind(java.lang.String $param_0) throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException { try { if (useNewInvoke) { @@ -289,5 +289,5 @@ public final class RegistryImpl_Stub throw new java.rmi.UnexpectedException("undeclared checked exception", e); } } - + } diff --git a/gnu/java/rmi/server/ActivatableRef.java b/gnu/java/rmi/server/ActivatableRef.java index e7580bcd7..a6faaca2e 100644 --- a/gnu/java/rmi/server/ActivatableRef.java +++ b/gnu/java/rmi/server/ActivatableRef.java @@ -58,7 +58,7 @@ import java.rmi.server.RemoteRef; * appears to be not accessible, it tries to reactivate it before reporting * any errors. Apart the fields of the UnicastRef, the activatable reference * contains the ActivationID that is used for this activation. - * + * * @author Audrius Meskauskas (Audriusa@Bioinformatics.org) */ public class ActivatableRef extends UnicastRef @@ -67,12 +67,12 @@ public class ActivatableRef extends UnicastRef * Use serial version UID for iteroperability */ private static final long serialVersionUID = 1; - + /** * The activation id. */ ActivationID actId; - + /** * Delegate call to the superclass. */ @@ -128,7 +128,7 @@ public class ActivatableRef extends UnicastRef out.writeUTF("UnicastRef2"); super.writeExternal(out); } - + /** * Invoke the remote method on the given object and try to activate the object * if it is not reacheable with the current manager. @@ -153,10 +153,10 @@ public class ActivatableRef extends UnicastRef } else if (Proxy.isProxyClass(reactivated.getClass())) { - RemoteObjectInvocationHandler hander = - (RemoteObjectInvocationHandler) + RemoteObjectInvocationHandler hander = + (RemoteObjectInvocationHandler) Proxy.getInvocationHandler(reactivated); - + RemoteRef ref = hander.getRef(); manager = ((UnicastRef) ref).manager; } diff --git a/gnu/java/rmi/server/ActivatableServerRef.java b/gnu/java/rmi/server/ActivatableServerRef.java index 5b7dadfd2..31e825a25 100644 --- a/gnu/java/rmi/server/ActivatableServerRef.java +++ b/gnu/java/rmi/server/ActivatableServerRef.java @@ -54,7 +54,7 @@ import java.rmi.server.Skeleton; * additionally activates the associated object on demand, during the first * incoming call. When UnicastServerReference takes the working reference, * the ActivatableServerRef takes the activation id instead. - * + * * @author Audrius Meskauskas (Audriusa@Bioinformatics.org) */ public class ActivatableServerRef extends UnicastServerRef @@ -63,7 +63,7 @@ public class ActivatableServerRef extends UnicastServerRef * Use SVUID for interoperability */ private static final long serialVersionUID = 1; - + /** * The object activation id. */ @@ -76,7 +76,7 @@ public class ActivatableServerRef extends UnicastServerRef { super(); } - + /** * Create the new activatable server reference that will activate object on * the first call using the given activation id. @@ -87,13 +87,13 @@ public class ActivatableServerRef extends UnicastServerRef { super(id, aPort, ssFactory); actId = anId; - + // The object ID will be placed in the object map and should deliver // incoming call to {@link #incommingMessageCall}. The object itself // is currently null. UnicastServer.exportActivatableObject(this); } - + /** * Inactivate the object (stop the server). */ @@ -101,7 +101,7 @@ public class ActivatableServerRef extends UnicastServerRef { manager.stopServer(); } - + /** * Activate the object (normally during the first call). */ @@ -110,7 +110,7 @@ public class ActivatableServerRef extends UnicastServerRef try { Remote self = actId.activate(false); - + // This will call UnicastServer.exportObject, replacing null by // the activated object (self) in the object map. exportObject(self); @@ -139,7 +139,7 @@ public class ActivatableServerRef extends UnicastServerRef } /** - * Export object and ensure it is present in the server activation table + * Export object and ensure it is present in the server activation table * as well. */ public Remote exportObject(Remote obj) throws RemoteException @@ -148,11 +148,11 @@ public class ActivatableServerRef extends UnicastServerRef UnicastServer.registerActivatable(this); return r; } - + /** * Export object and ensure it is present in the server activation table as * well. - * + * * @param aClass the class being exported, must implement Remote. */ public Remote exportClass(Class aClass) throws RemoteException @@ -161,17 +161,17 @@ public class ActivatableServerRef extends UnicastServerRef throw new InternalError(aClass.getName()+" must implement Remote"); String ignoreStubs; - - ClassLoader loader =aClass.getClassLoader(); - + + ClassLoader loader =aClass.getClassLoader(); + // Stubs are always searched for the bootstrap classes that may have // obsolete pattern and may still need also skeletons. if (loader==null) ignoreStubs = "false"; else - ignoreStubs = System.getProperty("java.rmi.server.ignoreStubClasses", + ignoreStubs = System.getProperty("java.rmi.server.ignoreStubClasses", "false"); - + if (! ignoreStubs.equals("true")) { // Find and install the stub @@ -223,5 +223,5 @@ public class ActivatableServerRef extends UnicastServerRef super.writeExternal(out); out.writeObject(actId); } - + } diff --git a/gnu/java/rmi/server/CombinedClassLoader.java b/gnu/java/rmi/server/CombinedClassLoader.java index 6225fb30b..3d01d0987 100644 --- a/gnu/java/rmi/server/CombinedClassLoader.java +++ b/gnu/java/rmi/server/CombinedClassLoader.java @@ -49,8 +49,8 @@ import java.util.ArrayList; * This class supports the multiple class loaders to load the resources. It is * used for constructing proxy classes that implement interfaces, loaded by * the several different class loaders. - * - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) */ public class CombinedClassLoader extends ClassLoader { @@ -58,20 +58,20 @@ public class CombinedClassLoader extends ClassLoader * The class loader array. */ ClassLoader[] loaders; - + /** * Create a new combined class loader that uses the given collection of * loaders to load the classes and resources. The loader order is equal to * the order, returned by the collection interator. The duplicate loaders * are discarded and the system class loader is added as the last loader. - * + * * @param a_loaders the loadery collection (may contain duplicate instances * that will be discarded. */ public CombinedClassLoader(Collection a_loaders) { ArrayList sLoaders = new ArrayList(a_loaders.size()); - + Iterator iter = a_loaders.iterator(); Object cl; while (iter.hasNext()) @@ -80,7 +80,7 @@ public class CombinedClassLoader extends ClassLoader if (cl!=null && !sLoaders.contains(cl)) sLoaders.add(cl); } - + loaders = new ClassLoader[sLoaders.size()]; for (int i = 0; i < loaders.length; i++) diff --git a/gnu/java/rmi/server/ConnectionRunnerPool.java b/gnu/java/rmi/server/ConnectionRunnerPool.java index 9f2b3706e..86660fea7 100644 --- a/gnu/java/rmi/server/ConnectionRunnerPool.java +++ b/gnu/java/rmi/server/ConnectionRunnerPool.java @@ -7,7 +7,7 @@ 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 @@ -45,61 +45,61 @@ import java.util.Arrays; class ConnectionRunnerPool { - - public static + + public static class ConnectionRunner extends Thread{ private UnicastConnection conn; private volatile boolean exiting = false; - + public ConnectionRunner(ThreadGroup group, String id){ super(group, id); } - + public synchronized void run(){ while(!exiting){ - if(conn == null) - try{ - wait(); - }catch(InterruptedException e){ - continue; - } - else{ - conn.run(); - conn = null; - synchronized(ConnectionRunnerPool.class){ - freelist.add(this); - if(freelist.size() == 1) - ConnectionRunnerPool.class.notifyAll(); - } - } + if(conn == null) + try{ + wait(); + }catch(InterruptedException e){ + continue; + } + else{ + conn.run(); + conn = null; + synchronized(ConnectionRunnerPool.class){ + freelist.add(this); + if(freelist.size() == 1) + ConnectionRunnerPool.class.notifyAll(); + } + } } } - + public synchronized void dispatch(UnicastConnection conn){ this.conn = conn; notify(); } - + void exit(){ exiting = true; if(conn != null) - try{ - join(500); - }catch(InterruptedException e){} + try{ + join(500); + }catch(InterruptedException e){} interrupt(); } - + } - + // Should this value equal to number of CPU? private static int size = 5; private static int max_size = 10; - + // Package-private to avoid a trampoline. static ArrayList freelist; - + private static ThreadGroup group = new ThreadGroup("pool"); - + static { ConnectionRunner[] pools = new ConnectionRunner[size]; for(int i = 0; i < pools.length; i++){ @@ -109,42 +109,42 @@ class ConnectionRunnerPool } freelist = new ArrayList(Arrays.asList(pools)); } - + public static void setSize(int size_){ size = size_; } - + public static void setMaxSize(int size){ max_size = size; } - + private static synchronized ConnectionRunner getConnectionRunner() { if(freelist.size() == 0){ if(size < max_size){ - ++size; - ConnectionRunner a = new ConnectionRunner(group, Integer.toString(size)); - a.start(); - freelist.add(a); + ++size; + ConnectionRunner a = new ConnectionRunner(group, Integer.toString(size)); + a.start(); + freelist.add(a); }else - while(freelist.size() == 0) - try{ - ConnectionRunnerPool.class.wait(); - }catch(InterruptedException e){} + while(freelist.size() == 0) + try{ + ConnectionRunnerPool.class.wait(); + }catch(InterruptedException e){} } - + // always let the first in pool most busy or other scheduling plan?? ConnectionRunner a = (ConnectionRunner)freelist.get(0); freelist.remove(a); return a; } - + public static void dispatchConnection(UnicastConnection conn) { ConnectionRunner r = getConnectionRunner(); r.dispatch(conn); } - + public static void exit() { Thread[] list = new Thread[group.activeCount()]; @@ -152,5 +152,5 @@ class ConnectionRunnerPool for(int i = 0; i < list.length; i++) ((ConnectionRunner)list[i]).exit(); } - + } diff --git a/gnu/java/rmi/server/ProtocolConstants.java b/gnu/java/rmi/server/ProtocolConstants.java index 30fb5e89b..72fbefe61 100644 --- a/gnu/java/rmi/server/ProtocolConstants.java +++ b/gnu/java/rmi/server/ProtocolConstants.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/rmi/server/RMIClassLoaderImpl.java b/gnu/java/rmi/server/RMIClassLoaderImpl.java index 9c3edef76..b090d3444 100644 --- a/gnu/java/rmi/server/RMIClassLoaderImpl.java +++ b/gnu/java/rmi/server/RMIClassLoaderImpl.java @@ -90,21 +90,21 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi private final String annotation; } - /** - * This class is used to identify a cached classloader by its codebase and + /** + * This class is used to identify a cached classloader by its codebase and * the context classloader that is its parent. - */ + */ private static class CacheKey { private String mCodeBase; private ClassLoader mContextClassLoader; - + public CacheKey (String theCodebase, ClassLoader theContextClassLoader) { mCodeBase = theCodebase; mContextClassLoader = theContextClassLoader; } - + /** * @return true if the codebase and the context classloader are equal */ @@ -113,13 +113,13 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi if (theOther instanceof CacheKey) { CacheKey key = (CacheKey) theOther; - + return (equals (this.mCodeBase,key.mCodeBase) && equals (this.mContextClassLoader, key.mContextClassLoader)); } return false; } - + /** * Test if the two objects are equal or both null. * @param theOne @@ -132,17 +132,17 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi } /** - * @return hashCode + * @return hashCode */ public int hashCode() { - return ((mCodeBase != null ? mCodeBase.hashCode() : 0) + return ((mCodeBase != null ? mCodeBase.hashCode() : 0) ^(mContextClassLoader != null ? mContextClassLoader.hashCode() : -1)); } public String toString() { - return "[" + mCodeBase + "," + mContextClassLoader + "]"; + return "[" + mCodeBase + "," + mContextClassLoader + "]"; } } @@ -214,7 +214,7 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi ClassLoader defaultLoader) throws MalformedURLException, ClassNotFoundException { - try + try { if (defaultLoader != null) return Class.forName(name, false, defaultLoader); @@ -236,7 +236,7 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi { clss[i] = loadClass(codeBase, interfaces[i], defaultLoader); } - + // Chain all class loaders (they may differ). ArrayList loaders = new ArrayList(clss.length); ClassLoader loader = null; @@ -266,11 +266,11 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi /** * Gets a classloader for the given codebase and with the current * context classloader as parent. - * + * * @param codebase - * + * * @return a classloader for the given codebase - * + * * @throws MalformedURLException if the codebase contains a malformed URL */ public ClassLoader getClassLoader(String codebase) @@ -283,23 +283,23 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi CacheKey loaderKey = new CacheKey (codebase, Thread.currentThread().getContextClassLoader()); loader = (ClassLoader) cacheLoaders.get (loaderKey); - + if (loader == null) { //create an entry in cacheLoaders mapping a loader to codebases. // codebases are separated by " " StringTokenizer tok = new StringTokenizer (codebase, " "); ArrayList urls = new ArrayList(); - + while (tok.hasMoreTokens()) urls.add (new URL(tok.nextToken())); - + loader = new MyClassLoader((URL[]) urls.toArray(new URL [urls.size()]), Thread.currentThread().getContextClassLoader(), codebase); cacheLoaders.put (loaderKey, loader); } - + return loader; } @@ -315,38 +315,38 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi public String getClassAnnotation(Class cl) { ClassLoader loader = cl.getClassLoader(); - + if (loader == null || loader == ClassLoader.getSystemClassLoader()) { return System.getProperty ("java.rmi.server.codebase"); } - + if (loader instanceof MyClassLoader) { return ((MyClassLoader) loader).getClassAnnotation(); } - + String s = (String) cacheAnnotations.get (loader); - + if (s != null) return s; - + if (loader instanceof URLClassLoader) { URL[] urls = ((URLClassLoader) loader).getURLs(); - + if (urls.length == 0) return null; - + CPStringBuilder annotation = new CPStringBuilder (64 * urls.length); - + for (int i = 0; i < urls.length; i++) { annotation.append (urls [i].toExternalForm()); annotation.append (' '); } - + s = annotation.toString(); cacheAnnotations.put (loader, s); return s; diff --git a/gnu/java/rmi/server/RMIDefaultSocketFactory.java b/gnu/java/rmi/server/RMIDefaultSocketFactory.java index 628e1cc87..7115ba543 100644 --- a/gnu/java/rmi/server/RMIDefaultSocketFactory.java +++ b/gnu/java/rmi/server/RMIDefaultSocketFactory.java @@ -7,7 +7,7 @@ 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 @@ -43,17 +43,17 @@ import java.net.Socket; import java.rmi.server.RMISocketFactory; public class RMIDefaultSocketFactory - extends RMISocketFactory { + extends RMISocketFactory { public RMIDefaultSocketFactory() { } public Socket createSocket(String host, int port) throws IOException { - return (new Socket(host, port)); + return (new Socket(host, port)); } public ServerSocket createServerSocket(int port) throws IOException { - return (new ServerSocket(port)); + return (new ServerSocket(port)); } } diff --git a/gnu/java/rmi/server/RMIHashes.java b/gnu/java/rmi/server/RMIHashes.java index c3665a4e7..03eb09fd0 100644 --- a/gnu/java/rmi/server/RMIHashes.java +++ b/gnu/java/rmi/server/RMIHashes.java @@ -7,7 +7,7 @@ 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 @@ -51,7 +51,7 @@ public class RMIHashes { //There're other places using DigestOutputStream to generate hash in classpath, but I think the way I used //here is more efficient, anyway, you can switch to DigestOutputStream by doing like "//or:" comments say. - + //or:add this statement: private static final NullOutputStream nullOutputStream = new NullOutputStream (); public static long getMethodHash(Method meth) { @@ -62,7 +62,7 @@ public class RMIHashes //or:remove this statement: DigestOutputStream digest_out = new DigestOutputStream (nullOutputStream, md); ByteArrayOutputStream digest_out = new ByteArrayOutputStream(); DataOutputStream data_out = new DataOutputStream (digest_out); - + CPStringBuilder sbuf = new CPStringBuilder(); sbuf.append(meth.getName()); sbuf.append('('); @@ -75,7 +75,7 @@ public class RMIHashes sbuf.append(TypeSignature.getEncodingOfClass(rcls)); else sbuf.append('V'); - + data_out.writeUTF (sbuf.toString()); data_out.flush(); data_out.close (); @@ -97,4 +97,3 @@ public class RMIHashes return clazz.hashCode (); } } - diff --git a/gnu/java/rmi/server/RMIIncomingThread.java b/gnu/java/rmi/server/RMIIncomingThread.java index 990d37bc5..352b48b31 100644 --- a/gnu/java/rmi/server/RMIIncomingThread.java +++ b/gnu/java/rmi/server/RMIIncomingThread.java @@ -7,7 +7,7 @@ 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 @@ -35,24 +35,24 @@ 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 gnu.java.rmi.server; - -public class RMIIncomingThread extends Thread { - - private String clientHost = null; - - public RMIIncomingThread(Runnable runnable, String s_clientHost) { - super(runnable); - clientHost = s_clientHost; - } - - public String toString() { - return "RMIIncoming from " + clientHost + " " + super.toString(); - } - - public String getClientHost() { - return clientHost; - } - +package gnu.java.rmi.server; + +public class RMIIncomingThread extends Thread { + + private String clientHost = null; + + public RMIIncomingThread(Runnable runnable, String s_clientHost) { + super(runnable); + clientHost = s_clientHost; + } + + public String toString() { + return "RMIIncoming from " + clientHost + " " + super.toString(); + } + + public String getClientHost() { + return clientHost; + } + } diff --git a/gnu/java/rmi/server/RMIObjectInputStream.java b/gnu/java/rmi/server/RMIObjectInputStream.java index 65a13f991..4ac7a0ae8 100644 --- a/gnu/java/rmi/server/RMIObjectInputStream.java +++ b/gnu/java/rmi/server/RMIObjectInputStream.java @@ -8,7 +8,7 @@ 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 @@ -48,44 +48,44 @@ import java.net.MalformedURLException; import java.rmi.server.RMIClassLoader; public class RMIObjectInputStream - extends ObjectInputStream { + extends ObjectInputStream { public RMIObjectInputStream(InputStream strm) throws IOException { - super(strm); - enableResolveObject(true); + super(strm); + enableResolveObject(true); } protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { - try { + try { return RMIClassLoader.loadClass( (String)getAnnotation(), desc.getName(), VMStackWalker.firstNonNullClassLoader()); - } - catch (MalformedURLException x) { - throw new ClassNotFoundException(desc.getName(), x); - } + } + catch (MalformedURLException x) { + throw new ClassNotFoundException(desc.getName(), x); + } } //Separate it for override by MarshalledObject protected Object getAnnotation() - throws IOException, ClassNotFoundException + throws IOException, ClassNotFoundException { return readObject(); } - + protected Class resolveProxyClass(String intfs[]) throws IOException, ClassNotFoundException { - try + try { return RMIClassLoader.loadProxyClass( (String)getAnnotation(), intfs, VMStackWalker.firstNonNullClassLoader()); } - catch (MalformedURLException x) + catch (MalformedURLException x) { throw new ClassNotFoundException(null, x); } diff --git a/gnu/java/rmi/server/RMIObjectOutputStream.java b/gnu/java/rmi/server/RMIObjectOutputStream.java index d42908a41..aaf09860c 100644 --- a/gnu/java/rmi/server/RMIObjectOutputStream.java +++ b/gnu/java/rmi/server/RMIObjectOutputStream.java @@ -8,7 +8,7 @@ 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 @@ -47,11 +47,11 @@ import java.rmi.server.RMIClassLoader; import java.rmi.server.RemoteStub; public class RMIObjectOutputStream - extends ObjectOutputStream { + extends ObjectOutputStream { public RMIObjectOutputStream(OutputStream strm) throws IOException { - super(strm); - enableReplaceObject(true); + super(strm); + enableReplaceObject(true); } //Separate it for override by MarshalledObject @@ -60,7 +60,7 @@ protected void setAnnotation(String annotation) throws IOException{ } protected void annotateClass(Class cls) throws IOException { - setAnnotation(RMIClassLoader.getClassAnnotation(cls)); + setAnnotation(RMIClassLoader.getClassAnnotation(cls)); } protected void annotateProxyClass(Class cls) @@ -68,14 +68,14 @@ protected void annotateProxyClass(Class cls) { annotateClass(cls); } - + protected Object replaceObject(Object obj) throws IOException { if((obj instanceof Remote) && !(obj instanceof RemoteStub)){ - UnicastServerRef ref = UnicastServer.getExportedRef((Remote)obj); - if (ref != null) - return ref.getStub(); + UnicastServerRef ref = UnicastServer.getExportedRef((Remote)obj); + if (ref != null) + return ref.getStub(); } return obj; } diff --git a/gnu/java/rmi/server/UnicastConnection.java b/gnu/java/rmi/server/UnicastConnection.java index 216e453e7..8245e0469 100644 --- a/gnu/java/rmi/server/UnicastConnection.java +++ b/gnu/java/rmi/server/UnicastConnection.java @@ -8,7 +8,7 @@ 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 @@ -49,8 +49,8 @@ import java.io.ObjectOutputStream; import java.net.Socket; import java.rmi.RemoteException; -public class UnicastConnection - implements Runnable, ProtocolConstants { +public class UnicastConnection + implements Runnable, ProtocolConstants { UnicastConnectionManager manager; Socket sock; @@ -64,78 +64,78 @@ long reviveTime = 0; long expireTime = Long.MAX_VALUE; UnicastConnection(UnicastConnectionManager man, Socket sock) { - this.manager = man; - this.sock = sock; + this.manager = man; + this.sock = sock; } void acceptConnection() throws IOException { //System.out.println("Accepting connection on " + sock); //Use BufferedXXXStream would be more efficient - din = new DataInputStream(new BufferedInputStream(sock.getInputStream())); - dout = new DataOutputStream(new BufferedOutputStream(sock.getOutputStream())); - - int sig = din.readInt(); - if (sig != PROTOCOL_HEADER) { - throw new IOException("bad protocol header"); - } - short ver = din.readShort(); - if (ver != PROTOCOL_VERSION) { - throw new IOException("bad protocol version"); - } - int protocol = din.readUnsignedByte(); - if (protocol != SINGLE_OP_PROTOCOL) { - // Send an ACK - dout.writeByte(PROTOCOL_ACK); - - // Send my hostname and port - dout.writeUTF(manager.serverName); - dout.writeInt(manager.serverPort); - dout.flush(); - - // Read their hostname and port - String rhost = din.readUTF(); - int rport = din.readInt(); - } - // Okay, ready to roll ... + din = new DataInputStream(new BufferedInputStream(sock.getInputStream())); + dout = new DataOutputStream(new BufferedOutputStream(sock.getOutputStream())); + + int sig = din.readInt(); + if (sig != PROTOCOL_HEADER) { + throw new IOException("bad protocol header"); + } + short ver = din.readShort(); + if (ver != PROTOCOL_VERSION) { + throw new IOException("bad protocol version"); + } + int protocol = din.readUnsignedByte(); + if (protocol != SINGLE_OP_PROTOCOL) { + // Send an ACK + dout.writeByte(PROTOCOL_ACK); + + // Send my hostname and port + dout.writeUTF(manager.serverName); + dout.writeInt(manager.serverPort); + dout.flush(); + + // Read their hostname and port + String rhost = din.readUTF(); + int rport = din.readInt(); + } + // Okay, ready to roll ... } void makeConnection(int protocol) throws IOException { //Use BufferedXXXStream would be more efficient - din = new DataInputStream(new BufferedInputStream(sock.getInputStream())); + din = new DataInputStream(new BufferedInputStream(sock.getInputStream())); - dout = new DataOutputStream(new BufferedOutputStream(sock.getOutputStream())); + dout = new DataOutputStream(new BufferedOutputStream(sock.getOutputStream())); - // Send header - dout.writeInt(PROTOCOL_HEADER); - dout.writeShort(PROTOCOL_VERSION); - dout.writeByte(protocol); + // Send header + dout.writeInt(PROTOCOL_HEADER); + dout.writeShort(PROTOCOL_VERSION); + dout.writeByte(protocol); dout.flush(); - - if (protocol != SINGLE_OP_PROTOCOL) { - // Get back ack. - int ack = din.readUnsignedByte(); - if (ack != PROTOCOL_ACK) { - throw new RemoteException("Unsupported protocol"); - } - - // Read in host and port - String dicard_rhost = din.readUTF(); - int discard_rport = din.readInt(); - - // Send them my endpoint - dout.writeUTF(manager.serverName); - dout.writeInt(manager.serverPort); - dout.flush(); - } - // Okay, ready to roll ... + + if (protocol != SINGLE_OP_PROTOCOL) { + // Get back ack. + int ack = din.readUnsignedByte(); + if (ack != PROTOCOL_ACK) { + throw new RemoteException("Unsupported protocol"); + } + + // Read in host and port + String dicard_rhost = din.readUTF(); + int discard_rport = din.readInt(); + + // Send them my endpoint + dout.writeUTF(manager.serverName); + dout.writeInt(manager.serverPort); + dout.flush(); + } + // Okay, ready to roll ... } DataInputStream getDataInputStream() throws IOException { - return (din); + return (din); } DataOutputStream getDataOutputStream() throws IOException { - return (dout); + return (dout); } /* @@ -144,10 +144,10 @@ DataOutputStream getDataOutputStream() throws IOException { * */ ObjectInputStream getObjectInputStream() throws IOException { - if (oin == null) { - throw new IOException("no ObjectInputtream for reading more objects"); - } - return (oin); + if (oin == null) { + throw new IOException("no ObjectInputtream for reading more objects"); + } + return (oin); } /** @@ -156,7 +156,7 @@ ObjectInputStream getObjectInputStream() throws IOException { * */ ObjectInputStream startObjectInputStream() throws IOException { - return (oin = new RMIObjectInputStream(din)); + return (oin = new RMIObjectInputStream(din)); } /** @@ -165,10 +165,10 @@ ObjectInputStream startObjectInputStream() throws IOException { * */ ObjectOutputStream getObjectOutputStream() throws IOException { - if (oout == null) { - throw new IOException("no ObjectOutputStream for sending more objects"); - } - return (oout); + if (oout == null) { + throw new IOException("no ObjectOutputStream for sending more objects"); + } + return (oout); } /** @@ -177,23 +177,23 @@ ObjectOutputStream getObjectOutputStream() throws IOException { * */ ObjectOutputStream startObjectOutputStream() throws IOException { - return (oout = new RMIObjectOutputStream(dout)); -} + return (oout = new RMIObjectOutputStream(dout)); +} void disconnect() { - try { - if(oout != null) - oout.close(); + try { + if(oout != null) + oout.close(); sock.close(); - } - catch (IOException _) { + } + catch (IOException _) { } - oin = null; + oin = null; oout = null; - din = null; - dout = null; - sock = null; + din = null; + dout = null; + sock = null; } public static final long CONNECTION_TIMEOUT = 10000L; @@ -215,15 +215,15 @@ static void resetTime(UnicastConnection conn){ */ public void run() { do{ - try { - UnicastServer.dispatch(this); + try { + UnicastServer.dispatch(this); //don't discardConnection explicitly, only when - // exception happens or the connection's expireTime + // exception happens or the connection's expireTime // comes } catch (Exception e ){ - manager.discardConnection(this); + manager.discardConnection(this); break; - } + } }while(true); } diff --git a/gnu/java/rmi/server/UnicastConnectionManager.java b/gnu/java/rmi/server/UnicastConnectionManager.java index a9992af9f..981d11792 100644 --- a/gnu/java/rmi/server/UnicastConnectionManager.java +++ b/gnu/java/rmi/server/UnicastConnectionManager.java @@ -8,7 +8,7 @@ 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 @@ -56,7 +56,7 @@ import java.util.Hashtable; import java.util.Iterator; public class UnicastConnectionManager - implements Runnable, ProtocolConstants { + implements Runnable, ProtocolConstants { private static String localhost; // use different maps for server/client type UnicastConnectionManager @@ -100,8 +100,8 @@ static { catch (UnknownHostException _) { localhost = "localhost"; } - - + + } //Only one scavenger thread running globally @@ -134,7 +134,7 @@ private static void startScavenger(){ if (UnicastConnection.isExpired(conn, l)){ conns.remove(last); conn.disconnect(); - conn = null; + conn = null; }else liveon = true; //there're still live connections } @@ -159,11 +159,11 @@ private static void startScavenger(){ * Client UnicastConnectionManager constructor */ private UnicastConnectionManager(String host, int port, RMIClientSocketFactory csf) { - ssock = null; - serverName = host; - serverPort = port; - serverFactory = null; - clientFactory = csf; + ssock = null; + serverName = host; + serverPort = port; + serverFactory = null; + clientFactory = csf; connections = new ArrayList(); } @@ -172,24 +172,24 @@ private UnicastConnectionManager(String host, int port, RMIClientSocketFactory c */ private UnicastConnectionManager(int port, RMIServerSocketFactory ssf) throws RemoteException { - try { - ssock = ssf.createServerSocket(port); - serverPort = ssock.getLocalPort(); - } - catch (IOException ioex) { - ssock = null; - serverPort = 0; - throw new java.rmi.server.ExportException("can not create Server Socket on port " + port,ioex); - } - // Note that for compatibility the serverName is "localhost", - // not UnicastConnectionManager.localhost, which is the name - // of the local box. A server listening on localhost:port is - // listening on the loopback interface, 127.0.0.1, but - // UnicastConnectionManager.localhost is an externally - // accessible IP address. - serverName = "localhost"; - serverFactory = ssf; - clientFactory = null; + try { + ssock = ssf.createServerSocket(port); + serverPort = ssock.getLocalPort(); + } + catch (IOException ioex) { + ssock = null; + serverPort = 0; + throw new java.rmi.server.ExportException("can not create Server Socket on port " + port,ioex); + } + // Note that for compatibility the serverName is "localhost", + // not UnicastConnectionManager.localhost, which is the name + // of the local box. A server listening on localhost:port is + // listening on the loopback interface, 127.0.0.1, but + // UnicastConnectionManager.localhost is an externally + // accessible IP address. + serverName = "localhost"; + serverFactory = ssf; + clientFactory = null; } /** @@ -198,31 +198,31 @@ private UnicastConnectionManager(int port, RMIServerSocketFactory ssf) throws Re */ public static synchronized UnicastConnectionManager getInstance(String host, int port, RMIClientSocketFactory csf) { //System.out.println("getInstance: " + host + "," + port + "," + csf); - if (csf == null) { + if (csf == null) { csf = defaultSocketFactory; - } - // change host name to host address to avoid name resolving issues - try{ - host = InetAddress.getByName(host).getHostAddress(); + } + // change host name to host address to avoid name resolving issues + try{ + host = InetAddress.getByName(host).getHostAddress(); }catch(Exception _){} - - TripleKey key = new TripleKey(host, port, csf); - UnicastConnectionManager man = (UnicastConnectionManager)clients.get(key); - if (man == null) { - man = new UnicastConnectionManager(host, port, csf); + + TripleKey key = new TripleKey(host, port, csf); + UnicastConnectionManager man = (UnicastConnectionManager)clients.get(key); + if (man == null) { + man = new UnicastConnectionManager(host, port, csf); if (debug) { ncmanager++; System.out.println("\n\n ====== " + ncmanager + " client managers.\n\n"); } - clients.put(key, man); - + clients.put(key, man); + // Detect if client and server are in the same VM, i.e., their keys are equal UnicastConnectionManager svrman = (UnicastConnectionManager)servers.get(key); if(svrman != null){ // server and client are in the same VM man.serverobj = svrman.serverobj; } - } - return (man); + } + return (man); } /** @@ -231,50 +231,50 @@ public static synchronized UnicastConnectionManager getInstance(String host, int */ public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) throws RemoteException { //System.out.println("getInstance: " + port + "," + ssf); - if (ssf == null) { + if (ssf == null) { ssf = defaultSocketFactory; - } - TripleKey key = new TripleKey(localhost, port, ssf); - UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key); - if (man == null) { - man = new UnicastConnectionManager(port, ssf); + } + TripleKey key = new TripleKey(localhost, port, ssf); + UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key); + if (man == null) { + man = new UnicastConnectionManager(port, ssf); if (debug) { nsmanager++; System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n"); } - // The provided port might not be the set port. - key.port = man.serverPort; - servers.put(key, man); - } - return (man); + // The provided port might not be the set port. + key.port = man.serverPort; + servers.put(key, man); + } + return (man); } /** * Get a connection from this manager. */ public UnicastConnection getConnection() throws IOException { - if (ssock == null) { - return (getClientConnection()); - } - else { - return (getServerConnection()); - } + if (ssock == null) { + return (getClientConnection()); + } + else { + return (getServerConnection()); + } } /** * Accept a connection to this server. */ private UnicastConnection getServerConnection() throws IOException { - Socket sock = ssock.accept(); + Socket sock = ssock.accept(); sock.setTcpNoDelay(true); //?? - UnicastConnection conn = new UnicastConnection(this, sock); - conn.acceptConnection(); + UnicastConnection conn = new UnicastConnection(this, sock); + conn.acceptConnection(); if (debug){ nssock++; System.out.println("\n\n ****** " + nssock + " server socks.\n\n"); } //System.out.println("Server connection " + sock); - return (conn); + return (conn); } /** @@ -283,37 +283,37 @@ private UnicastConnection getServerConnection() throws IOException { private UnicastConnection getClientConnection() throws IOException { ArrayList conns = connections; UnicastConnection conn; - + synchronized(conns) { int nconn = conns.size() - 1; - + // if there're free connections in connection pool if(nconn >= 0) { conn = (UnicastConnection)conns.get(nconn); //Should we check if conn is alive using Ping?? conns.remove(nconn); - + // Check if the connection is already expired long l = System.currentTimeMillis(); if (!UnicastConnection.isExpired(conn, l)){ return conn; }else { conn.disconnect(); - conn = null; + conn = null; } } } - - Socket sock = clientFactory.createSocket(serverName, serverPort); + + Socket sock = clientFactory.createSocket(serverName, serverPort); conn = new UnicastConnection(this, sock); - conn.makeConnection(DEFAULT_PROTOCOL); - + conn.makeConnection(DEFAULT_PROTOCOL); + if (debug) { ncsock++; System.out.println("\n\n ====== " + ncsock + " client socks.\n\n"); } - return (conn); + return (conn); } /** @@ -332,13 +332,13 @@ public void discardConnection(UnicastConnection conn) { //System.out.println("Discarding connection " + conn); //conn.disconnect(); if (ssock != null) //server connection - conn.disconnect(); + conn.disconnect(); else { // To client connection, we'd like to return back to pool UnicastConnection.resetTime(conn); //Ensure there're only one scavenger globally synchronized(GLOBAL_LOCK) { - connections.add(conn); //borrow this lock to garantee thread safety + connections.add(conn); //borrow this lock to garantee thread safety if (scavenger == null) startScavenger(); } @@ -350,15 +350,15 @@ public void discardConnection(UnicastConnection conn) { * already got one running. */ public void startServer() { - synchronized(this) { - if (ssock == null || serverThread != null) { - return; - } - serverThread = new Thread(this); + synchronized(this) { + if (ssock == null || serverThread != null) { + return; + } + serverThread = new Thread(this); // The following is not necessary when java.lang.Thread's constructor do this. // serverThread.setContextClassLoader(Thread.currentThread().getContextClassLoader()); - } - serverThread.start(); + } + serverThread.start(); } /** @@ -366,12 +366,12 @@ public void startServer() { */ public void stopServer() { synchronized(this) { - if(serverThread != null){ - serverThread = null; - try{ - ssock.close(); - }catch(Exception _){} - } + if(serverThread != null){ + serverThread = null; + try{ + ssock.close(); + }catch(Exception _){} + } } } @@ -379,26 +379,26 @@ public void stopServer() { * Server thread for connection manager. */ public void run() { - for (;serverThread != null;) { // if serverThread==null, then exit thread - try { + for (;serverThread != null;) { // if serverThread==null, then exit thread + try { //System.out.println("Waiting for connection on " + serverPort); - UnicastConnection conn = getServerConnection(); + UnicastConnection conn = getServerConnection(); - // get address of remote host for the RMIIncomingThread object - String remoteHost = null; - if (conn.sock != null) { - remoteHost = conn.sock.getInetAddress().getHostAddress(); - } + // get address of remote host for the RMIIncomingThread object + String remoteHost = null; + if (conn.sock != null) { + remoteHost = conn.sock.getInetAddress().getHostAddress(); + } - // use a thread pool to improve performance + // use a thread pool to improve performance //ConnectionRunnerPool.dispatchConnection(conn); (new RMIIncomingThread(conn, remoteHost)).start(); -// (new Thread(conn)).start(); - } - catch (Exception e) { +// (new Thread(conn)).start(); + } + catch (Exception e) { e.printStackTrace(); - } - } + } + } } /** @@ -432,9 +432,9 @@ int port; Object other; TripleKey(String host, int port, Object other) { - this.host = host; - this.port = port; - this.other = other; + this.host = host; + this.port = port; + this.other = other; } /** @@ -442,19 +442,19 @@ TripleKey(String host, int port, Object other) { * this has unusual matching behaviour. */ public int hashCode() { - return (host.hashCode() ^ other.hashCode()); + return (host.hashCode() ^ other.hashCode()); } public boolean equals(Object obj) { - if (obj instanceof TripleKey) { - TripleKey other = (TripleKey)obj; - if (this.host.equals(other.host) && - this.other == other.other && + if (obj instanceof TripleKey) { + TripleKey other = (TripleKey)obj; + if (this.host.equals(other.host) && + this.other == other.other && (this.port == other.port /* || this.port == 0 || other.port == 0*/)) { - return (true); - } - } - return (false); + return (true); + } + } + return (false); } /** diff --git a/gnu/java/rmi/server/UnicastRef.java b/gnu/java/rmi/server/UnicastRef.java index def1acdcf..ca2bab51a 100644 --- a/gnu/java/rmi/server/UnicastRef.java +++ b/gnu/java/rmi/server/UnicastRef.java @@ -8,7 +8,7 @@ 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 @@ -461,7 +461,7 @@ public class UnicastRef { return ("UnicastRef"); } - + /** * Return the string representing the remote reference information. */ @@ -497,7 +497,7 @@ public class UnicastRef /** * Check if this UnicastRef points to the object as the passed UnicastRef. * Both the object Id and manager must be the same. - * + * * @return true if the passed reference points to the same remote object as * this reference, false otherwise. */ diff --git a/gnu/java/rmi/server/UnicastRemoteCall.java b/gnu/java/rmi/server/UnicastRemoteCall.java index c5206e76d..d0d77304c 100644 --- a/gnu/java/rmi/server/UnicastRemoteCall.java +++ b/gnu/java/rmi/server/UnicastRemoteCall.java @@ -54,7 +54,7 @@ import java.rmi.server.UID; import java.util.Vector; public class UnicastRemoteCall - implements RemoteCall, ProtocolConstants + implements RemoteCall, ProtocolConstants { private UnicastConnection conn; @@ -89,12 +89,12 @@ public class UnicastRemoteCall this.hash = hash; this.objid = objid; } - + UnicastConnection getConnection() { return conn; } - + public ObjectOutput getOutputStream() throws IOException { if (vec == null) @@ -106,33 +106,33 @@ public class UnicastRemoteCall { if (vec != null) { - oout = conn.getObjectOutputStream(); - - for (int i = 0; i < vec.size(); i += 2) - { - boolean primitive = ((Boolean)vec.elementAt(i)).booleanValue(); - Object data = vec.elementAt(i+1); - - // No type, this is - if (!primitive) - oout.writeObject(data); - else - { - if (data instanceof Boolean) - oout.writeBoolean(((Boolean)data).booleanValue()); - else if (data instanceof Character) - oout.writeChar(((Character)data).charValue()); - else if (data instanceof Byte) - oout.writeByte(((Byte)data).byteValue()); - else if (data instanceof Short) - oout.writeShort(((Short)data).shortValue()); - else if (data instanceof Integer) - oout.writeInt(((Integer)data).intValue()); - else if (data instanceof Long) - oout.writeLong(((Long)data).longValue()); - } - } - vec = null; + oout = conn.getObjectOutputStream(); + + for (int i = 0; i < vec.size(); i += 2) + { + boolean primitive = ((Boolean)vec.elementAt(i)).booleanValue(); + Object data = vec.elementAt(i+1); + + // No type, this is + if (!primitive) + oout.writeObject(data); + else + { + if (data instanceof Boolean) + oout.writeBoolean(((Boolean)data).booleanValue()); + else if (data instanceof Character) + oout.writeChar(((Character)data).charValue()); + else if (data instanceof Byte) + oout.writeByte(((Byte)data).byteValue()); + else if (data instanceof Short) + oout.writeShort(((Short)data).shortValue()); + else if (data instanceof Integer) + oout.writeInt(((Integer)data).intValue()); + else if (data instanceof Long) + oout.writeLong(((Long)data).longValue()); + } + } + vec = null; } if(oout != null) oout.flush(); @@ -142,14 +142,14 @@ public class UnicastRemoteCall * * (re)starts ObjectInputStream * - */ + */ public ObjectInput startInputStream() throws IOException { - if (conn != null) { - return (oin = conn.startObjectInputStream()); - } else { - return getInputStream(); // dummy Input Stream - } + if (conn != null) { + return (oin = conn.startObjectInputStream()); + } else { + return getInputStream(); // dummy Input Stream + } } @@ -157,15 +157,15 @@ public class UnicastRemoteCall { if (conn != null) { - if(oin == null) - return (oin = conn.getObjectInputStream()); - else - return oin; + if(oin == null) + return (oin = conn.getObjectInputStream()); + else + return oin; } else { - ptr = 0; - return (new DummyObjectInputStream()); + ptr = 0; + return (new DummyObjectInputStream()); } } @@ -180,34 +180,34 @@ public class UnicastRemoteCall vec = new Vector(); return new DummyObjectOutputStream(); } - + public void executeCall() throws Exception { byte returncode; ObjectInput oin; - + // signal the call when constructing try { - DataOutputStream dout = conn.getDataOutputStream(); - dout.write(MESSAGE_CALL); - - oout = conn.startObjectOutputStream(); // (re)start ObjectOutputStream - objid.write(oout); - oout.writeInt(opnum); - oout.writeLong(hash); + DataOutputStream dout = conn.getDataOutputStream(); + dout.write(MESSAGE_CALL); + + oout = conn.startObjectOutputStream(); // (re)start ObjectOutputStream + objid.write(oout); + oout.writeInt(opnum); + oout.writeLong(hash); } catch(IOException ex) { - throw new MarshalException("Try to write header but failed.", ex); + throw new MarshalException("Try to write header but failed.", ex); } try { - releaseOutputStream(); - DataInputStream din = conn.getDataInputStream(); + releaseOutputStream(); + DataInputStream din = conn.getDataInputStream(); if (din.readByte() != MESSAGE_CALL_ACK) - throw new RemoteException("Call not acked"); + throw new RemoteException("Call not acked"); oin = startInputStream(); returncode = oin.readByte(); @@ -217,31 +217,31 @@ public class UnicastRemoteCall { throw new UnmarshalException("Try to read header but failed:", ex); } - + //check return code switch(returncode) { case RETURN_ACK: //it's ok - return; + return; case RETURN_NACK: - Object returnobj; - try - { - returnobj = oin.readObject(); - } - catch(Exception ex2) - { - throw new UnmarshalException - ("Try to read exception object but failed", ex2); - } - - if(!(returnobj instanceof Exception)) - throw new UnmarshalException("Should be Exception type here: " - + returnobj); - throw (Exception)returnobj; - + Object returnobj; + try + { + returnobj = oin.readObject(); + } + catch(Exception ex2) + { + throw new UnmarshalException + ("Try to read exception object but failed", ex2); + } + + if(!(returnobj instanceof Exception)) + throw new UnmarshalException("Should be Exception type here: " + + returnobj); + throw (Exception)returnobj; + default: - throw new UnmarshalException("Invalid return code"); + throw new UnmarshalException("Invalid return code"); } } @@ -254,7 +254,7 @@ public class UnicastRemoteCall { return vec.size() > 0; } - + Object returnValue() { // This is not the first one (Boolean) but the second. diff --git a/gnu/java/rmi/server/UnicastRemoteStub.java b/gnu/java/rmi/server/UnicastRemoteStub.java index 87e932de5..179f30179 100644 --- a/gnu/java/rmi/server/UnicastRemoteStub.java +++ b/gnu/java/rmi/server/UnicastRemoteStub.java @@ -7,7 +7,7 @@ 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 @@ -41,10 +41,10 @@ import java.rmi.server.RemoteRef; import java.rmi.server.RemoteStub; public class UnicastRemoteStub - extends RemoteStub { + extends RemoteStub { public static void setStubRef(RemoteStub stub, RemoteRef ref) { - setRef(stub, ref); + setRef(stub, ref); } } diff --git a/gnu/java/rmi/server/UnicastServer.java b/gnu/java/rmi/server/UnicastServer.java index 7fe539546..db2bd2ff8 100644 --- a/gnu/java/rmi/server/UnicastServer.java +++ b/gnu/java/rmi/server/UnicastServer.java @@ -8,7 +8,7 @@ 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 @@ -75,21 +75,21 @@ public class UnicastServer * Mapping obj itself to server ref by identity. */ static private Map refcache = Collections.synchronizedMap(new WeakIdentityHashMap()); - + /** * Mapping the registered activatable objects into they server references. */ public static Map actIds = new Hashtable(); - + /** - * The reference to the local distributed garbage collector. + * The reference to the local distributed garbage collector. */ static private DGCImpl dgc; - + /** * Connect this server reference to the server, allowing the local * implementation, associated with this object, to receive remote calls. - * + * * @param obj the server reference, encloses the (usually local) remote * object. */ @@ -100,7 +100,7 @@ public class UnicastServer refcache.put(obj.myself, obj); obj.manager.startServer(); } - + /** * Register the activatable object into the table of the activatable * objects. @@ -109,7 +109,7 @@ public class UnicastServer { actIds.put(ref.actId, ref); } - + /** * Export tha activatable object. The object id is placed into the map, * but the object itself not. This is enough to deliver call to @@ -123,8 +123,8 @@ public class UnicastServer ref.manager.startServer(); actIds.put(ref.actId, ref); } - - + + /** * Get the activatable server reference that is handling activation of the * given activation id. @@ -137,15 +137,15 @@ public class UnicastServer throw new ActivationException(id + " was not registered with this server"); return ref; } - + /** * Unregister the previously registered activatable server reference. */ public static void unregisterActivatable(ActivationID id) { - actIds.remove(id); + actIds.remove(id); } - + // FIX ME: I haven't handle force parameter /** * Remove the given server reference. The remote object, associated with @@ -156,7 +156,7 @@ public class UnicastServer objects.remove(obj.objid); refcache.remove(obj.myself); obj.manager.stopServer(); - + if (obj instanceof ActivatableServerRef) { ActivationID id = ((ActivatableServerRef) obj).actId; @@ -164,15 +164,15 @@ public class UnicastServer } return true; } - + /** * Get the exported reference of the given Remote. The identity map is used, * the non-null value will only be returned if exactly the passed remote - * is part of the registered UnicastServerRef. - * - * @param remote the Remote that is connected to this server via + * is part of the registered UnicastServerRef. + * + * @param remote the Remote that is connected to this server via * {@link UnicastServerRef}. - * + * * @return the UnicastServerRef that is used to connect the passed * remote with this server or null, if this Remote is not connected * to this server. @@ -186,7 +186,7 @@ public class UnicastServer * Get the server references to the object, previously exported via this * server. As the identity map is scanned, more than one reference may match * this Id. - * + * * @param id the id of the exported object * @return the server reference to this object, null if none. */ @@ -244,10 +244,10 @@ public class UnicastServer throw new Exception("bad method type"); } } - + /** * This method is invoked when the remote call is received. The method - * dispatches the call to the responsible object, connected to this + * dispatches the call to the responsible object, connected to this * server via UnicastServerReference. */ private static void incomingMessageCall(UnicastConnection conn) @@ -287,7 +287,7 @@ public class UnicastServer catch (Error e) { returnval = new ServerError( - "Server error, ObjID: " + objid + + "Server error, ObjID: " + objid + ", method: " + method + ", hash: "+ hash, e); returncode = RETURN_NACK; } diff --git a/gnu/java/rmi/server/UnicastServerRef.java b/gnu/java/rmi/server/UnicastServerRef.java index 2f7cb9a2d..59a9f080b 100644 --- a/gnu/java/rmi/server/UnicastServerRef.java +++ b/gnu/java/rmi/server/UnicastServerRef.java @@ -8,7 +8,7 @@ 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 @@ -60,39 +60,39 @@ import java.util.Iterator; /** * This class connects the local, remotely available (exported) object to - * the local RMI server that accepts the remote calls. + * the local RMI server that accepts the remote calls. */ public class UnicastServerRef extends UnicastRef -{ +{ /** * Use GNU Classpath v 0.20 SVUID for interoperability */ private static final long serialVersionUID = - 5585608108300801246L; - + /** - * The class array, defining parameters of the jdk 1.2 RMI stub constructor. + * The class array, defining parameters of the jdk 1.2 RMI stub constructor. */ private static final Class[] stubprototype = new Class[] { RemoteRef.class }; - + /** * The exported remote object itself. */ Remote myself; // save the remote object itself - + /** * The skeleton (if any), associated with the exported remote object. */ protected Skeleton skel; - + /** * The stub, associated with the exported remote object (may be proxy class). */ protected Remote stub; - + /** - * The method table (RMI hash code to method) of the methods of the + * The method table (RMI hash code to method) of the methods of the * exported object. */ protected Hashtable methods = new Hashtable(); @@ -110,15 +110,15 @@ public class UnicastServerRef super(id); manager = UnicastConnectionManager.getInstance(port, ssf); } - + /** * Export the object and return its remote stub. The method tries to locate * existing stubs and skeletons. If this fails, the method instantiates the * proxy stub class. - * - * Stubs and skeletons are always ignored (even if present) if the + * + * Stubs and skeletons are always ignored (even if present) if the * java.rmi.server.ignoreStubClasses property is set to true. - * + * * @param obj the object being exported. * @return the stub (existing class or proxy) of the exported object. * @throws RemoteException if the export failed due any reason @@ -133,17 +133,17 @@ public class UnicastServerRef manager.serverobj = obj; String ignoreStubs; - - ClassLoader loader =obj.getClass().getClassLoader(); - + + ClassLoader loader =obj.getClass().getClassLoader(); + // Stubs are always searched for the bootstrap classes that may have // obsolete pattern and may still need also skeletons. if (loader==null) ignoreStubs = "false"; else - ignoreStubs = System.getProperty("java.rmi.server.ignoreStubClasses", + ignoreStubs = System.getProperty("java.rmi.server.ignoreStubClasses", "false"); - + if (! ignoreStubs.equals("true")) { // Find and install the stub @@ -172,21 +172,21 @@ public class UnicastServerRef return stub; } - + /** * Get the stub (actual class or proxy) of the exported remote object. - * + * * @return the remote stub (null if exportObject has not been called). */ public Remote getStub() { return stub; } - + /** - * Unexport the object (remove methods from the method hashcode table + * Unexport the object (remove methods from the method hashcode table * and call UnicastServer.unexportObject. - * + * * @param obj the object being unexported * @param force passed to the UnicastServer.unexportObject. * @return value, returned by the UnicastServer.unexportObject. @@ -202,7 +202,7 @@ public class UnicastServerRef * Return the class in the hierarchy for that the stub class is defined. * The Subs/Skels might not there for the actual class, but maybe for one of * the superclasses. - * + * * @return the class having stub defined, null if none. */ protected Class findStubSkelClass(Class startCls) @@ -231,17 +231,17 @@ public class UnicastServerRef } } } - + /** - * Get the helper (assisting) class with the given type. - * + * Get the helper (assisting) class with the given type. + * * @param cls the class, for that the helper class is requested. This class * and the requested helper class must share the same class loader. - * + * * @param type the type of the assisting helper. The only currently supported * non deprecated value is "_Stub" (load jdk 1.1 or 1.2 RMI stub). Another * (deprecated) value is "_Skel" (load skeleton). - * + * * @return the instantiated instance of the helper class or null if the * helper class cannot be found or instantiated. */ @@ -303,14 +303,14 @@ public class UnicastServerRef { return RemoteServer.getClientHost(); } - + /** * Build the method has code table and put it into {@link #methods} * (mapping RMI hashcode tos method). The same method is used to remove * the table. - * - * @param cls the class for that the method table is built. - * @param build if true, the class methods are added to the table. If + * + * @param cls the class for that the method table is built. + * @param build if true, the class methods are added to the table. If * false, they are removed from the table. */ protected void buildMethodHash(Class cls, boolean build) @@ -342,7 +342,7 @@ public class UnicastServerRef else return null; } - + /** * This method is called from the {@link UnicastServer#incomingMessageCall} * to deliver the remote call to this object. @@ -422,7 +422,7 @@ public class UnicastServerRef { if (skel == null) throw new NoSuchMethodException("JDK 1.1 call - Skeleton required"); - + UnicastRemoteCall call = new UnicastRemoteCall(conn); skel.dispatch(myself, call, method, hash); if (! call.isReturnValue()) @@ -431,16 +431,16 @@ public class UnicastServerRef return (call.returnValue()); } } - + /** * Create the 1.2 proxy stub in the case when the pre-generated stub is not * available of the system is explicitly instructed to use proxy stubs. - * + * * @param stubFor the class for that the proxy class must be constructed. * @param reference the remote reference, used to find the given object - * + * * @return the applicable proxy stub. - * + * * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) */ Remote createProxyStub(Class stubFor, RemoteRef reference) @@ -467,17 +467,15 @@ public class UnicastServerRef for (int i = 0; i < intfs.length; i++) intfs[i] = (Class) it.next(); - - RemoteObjectInvocationHandler handler = + + RemoteObjectInvocationHandler handler = new RemoteObjectInvocationHandler(reference); - - Object proxy = + + Object proxy = Proxy.newProxyInstance(stubFor.getClassLoader(), intfs, handler); return (Remote) proxy; } - - -} +} diff --git a/gnu/java/security/Engine.java b/gnu/java/security/Engine.java index 6c39d46ac..969fcef6c 100644 --- a/gnu/java/security/Engine.java +++ b/gnu/java/security/Engine.java @@ -58,7 +58,7 @@ import java.util.Enumeration; * represents. * * @see Provider - * @author Casey Marshall + * @author Casey Marshall */ public final class Engine { @@ -85,7 +85,7 @@ public final class Engine * Return the implementation for <i>algorithm</i> for service <i>service</i> * from <i>provider</i>. The service is e.g. "Signature", and the algorithm * "DSA". - * + * * @param service The service name. * @param algorithm The name of the algorithm to get. * @param provider The provider to get the implementation from. @@ -111,7 +111,7 @@ public final class Engine * constructor (which cannot be null; pass a zero-length array if the SPI * takes no arguments). The service is e.g. "Signature", and the algorithm * "DSA". - * + * * @param service The service name. * @param algorithm The name of the algorithm to get. * @param provider The provider to get the implementation from. @@ -159,7 +159,7 @@ public final class Engine if (key.equalsIgnoreCase(service + "." + algorithm)) { // remove the service portion from the key - algorithm = key.substring(service.length() + 1); + algorithm = key.substring(service.length() + 1); algorithmFound = true; break; } diff --git a/gnu/java/security/OID.java b/gnu/java/security/OID.java index a3d70e220..c7efe6557 100644 --- a/gnu/java/security/OID.java +++ b/gnu/java/security/OID.java @@ -75,7 +75,7 @@ public class OID implements Cloneable, Comparable, java.io.Serializable /* Serial version id for serialization. */ static final long serialVersionUID = 5722492029044597779L; - + /** * The numeric ID structure. */ diff --git a/gnu/java/security/PolicyFile.java b/gnu/java/security/PolicyFile.java index e9c811644..0560bce07 100644 --- a/gnu/java/security/PolicyFile.java +++ b/gnu/java/security/PolicyFile.java @@ -154,7 +154,7 @@ public final class PolicyFile extends Policy // Added to cut redundant AccessController.doPrivileged calls private static GetPropertyAction prop = new GetPropertyAction("file.separator"); private static final String fs = (String) AccessController.doPrivileged(prop); - + private static final String DEFAULT_POLICY = (String) AccessController.doPrivileged(prop.setParameters("java.home")) + fs + "lib" + fs + "security" + fs + "java.policy"; @@ -536,7 +536,7 @@ public final class PolicyFile extends Policy if (clazz == null) { currentPerms.add(new UnresolvedPermission(className, - null, null, (Certificate[]) currentCerts.toArray(new Certificate[currentCerts.size()]))); + null, null, (Certificate[]) currentCerts.toArray(new Certificate[currentCerts.size()]))); continue; } try @@ -558,7 +558,7 @@ public final class PolicyFile extends Policy if (clazz == null) { currentPerms.add(new UnresolvedPermission(className, - target, null, (Certificate[]) currentCerts.toArray(new Certificate[currentCerts.size()]))); + target, null, (Certificate[]) currentCerts.toArray(new Certificate[currentCerts.size()]))); continue; } try @@ -601,7 +601,7 @@ public final class PolicyFile extends Policy if (clazz == null) { currentPerms.add(new UnresolvedPermission(className, - target, action, (Certificate[]) currentCerts.toArray(new Certificate[currentCerts.size()]))); + target, action, (Certificate[]) currentCerts.toArray(new Certificate[currentCerts.size()]))); continue; } else diff --git a/gnu/java/security/Properties.java b/gnu/java/security/Properties.java index a515a5428..2213bde06 100644 --- a/gnu/java/security/Properties.java +++ b/gnu/java/security/Properties.java @@ -90,7 +90,7 @@ public final class Properties /** * Returns the string representation of the library global configuration * property with the designated <code>key</code>. - * + * * @param key the case-insensitive, non-null and non-empty name of a * configuration property. * @return the string representation of the designated property, or @@ -113,7 +113,7 @@ public final class Properties /** * Sets the value of a designated library global configuration property, to a * string representation of what should be a legal value. - * + * * @param key the case-insensitive, non-null and non-empty name of a * configuration property. * @param value the non-null, non-empty string representation of a legal value @@ -151,7 +151,7 @@ public final class Properties * A convenience method that returns, as a boolean, the library global * configuration property indicating if the default Pseudo Random Number * Generator produces, or not, the same bit stream when instantiated. - * + * * @return <code>true</code> if the default PRNG produces the same bit * stream with every VM instance. Returns <code>false</code> if the * default PRNG is seeded with the time of day of its first @@ -171,7 +171,7 @@ public final class Properties * block ciphers check, or not, for possible/potential weak and semi-weak keys * that may be produced in the course of generating round encryption and/or * decryption keys. - * + * * @return <code>true</code> if the cipher implementations check for weak * and semi-weak keys. Returns <code>false</code> if the cipher * implementations do not check for weak or semi-weak keys. @@ -188,7 +188,7 @@ public final class Properties * A convenience method that returns, as a boolean, the library global * configuration property indicating if RSA decryption (RSADP primitive), * does, or not, blinding against timing attacks. - * + * * @return <code>true</code> if the RSA decryption primitive includes a * blinding operation. Returns <code>false</code> if the RSA * decryption primitive does not include the additional blinding @@ -205,7 +205,7 @@ public final class Properties /** * A convenience method to set the global property for reproducibility of the * default PRNG bit stream output. - * + * * @param value if <code>true</code> then the default PRNG bit stream output * is the same with every invocation of the VM. */ @@ -221,7 +221,7 @@ public final class Properties /** * A convenience method to set the global property for checking for weak and * semi-weak cipher keys. - * + * * @param value if <code>true</code> then the cipher implementations will * invoke additional checks for weak and semi-weak key values that * may get generated. @@ -238,7 +238,7 @@ public final class Properties /** * A convenience method to set the global property fo adding a blinding * operation when executing the RSA decryption primitive. - * + * * @param value if <code>true</code> then the code for performing the RSA * decryption primitive will include a blinding operation. */ diff --git a/gnu/java/security/Registry.java b/gnu/java/security/Registry.java index 053d71778..4ce5044ab 100644 --- a/gnu/java/security/Registry.java +++ b/gnu/java/security/Registry.java @@ -1,4 +1,4 @@ -/* Registry.java -- +/* Registry.java -- Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/Requires.java b/gnu/java/security/Requires.java index c820336c0..6b52bd168 100644 --- a/gnu/java/security/Requires.java +++ b/gnu/java/security/Requires.java @@ -46,8 +46,8 @@ import static java.lang.annotation.RetentionPolicy.CLASS; import java.security.Permission; /** - * - * + * + * * @author Casey Marshall (csm@gnu.org) */ @Documented @Retention(CLASS) @Target(METHOD) diff --git a/gnu/java/security/action/GetPropertyAction.java b/gnu/java/security/action/GetPropertyAction.java index 0c8141a4d..7295d8d5a 100644 --- a/gnu/java/security/action/GetPropertyAction.java +++ b/gnu/java/security/action/GetPropertyAction.java @@ -57,7 +57,7 @@ public class GetPropertyAction implements PrivilegedAction<String> public GetPropertyAction() { } - + public GetPropertyAction(String propName) { setParameters(propName); @@ -67,12 +67,12 @@ public class GetPropertyAction implements PrivilegedAction<String> { setParameters(propName, defaultValue); } - + public String run() { return System.getProperty(name, value); } - + public GetPropertyAction setParameters(String propName) { this.name = propName; diff --git a/gnu/java/security/action/SetAccessibleAction.java b/gnu/java/security/action/SetAccessibleAction.java index 77e5fc988..d3e3c0f90 100644 --- a/gnu/java/security/action/SetAccessibleAction.java +++ b/gnu/java/security/action/SetAccessibleAction.java @@ -41,7 +41,7 @@ import java.lang.reflect.AccessibleObject; import java.security.PrivilegedAction; /** - * PrivilegedAction implementation that calls setAccessible(true) on the + * PrivilegedAction implementation that calls setAccessible(true) on the * AccessibleObject passed to its constructor. * * Example of use: @@ -53,22 +53,22 @@ import java.security.PrivilegedAction; public class SetAccessibleAction implements PrivilegedAction { AccessibleObject member; - + public SetAccessibleAction() { } - + public SetAccessibleAction(AccessibleObject member) { this.member = member; } - + public Object run() { member.setAccessible(true); return null; } - + public SetAccessibleAction setMember(AccessibleObject member) { this.member = member; diff --git a/gnu/java/security/der/DERValue.java b/gnu/java/security/der/DERValue.java index d98ce78ec..2cbe34573 100644 --- a/gnu/java/security/der/DERValue.java +++ b/gnu/java/security/der/DERValue.java @@ -173,11 +173,11 @@ public class DERValue implements DER public String toString() { String start = "DERValue ( ["; - if (tagClass == DER.UNIVERSAL) + if (tagClass == DER.UNIVERSAL) start = start + "UNIVERSAL "; - else if (tagClass == DER.PRIVATE) + else if (tagClass == DER.PRIVATE) start = start + "PRIVATE "; - else if (tagClass == DER.APPLICATION) + else if (tagClass == DER.APPLICATION) start = start + "APPLICATION "; start = start + tag + "] constructed=" + constructed + ", value="; if (constructed) diff --git a/gnu/java/security/hash/BaseHash.java b/gnu/java/security/hash/BaseHash.java index ff1750aea..bab930f28 100644 --- a/gnu/java/security/hash/BaseHash.java +++ b/gnu/java/security/hash/BaseHash.java @@ -1,4 +1,4 @@ -/* BaseHash.java -- +/* BaseHash.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -61,7 +61,7 @@ public abstract class BaseHash /** * Trivial constructor for use by concrete subclasses. - * + * * @param name the canonical name prefix of this instance. * @param hashSize the block size of the output in bytes. * @param blockSize the block size of the internal transform. @@ -156,7 +156,7 @@ public abstract class BaseHash /** * Returns the byte array to use as padding before completing a hash * operation. - * + * * @return the bytes to pad the remaining bytes in the buffer before * completing a hash operation. */ @@ -164,7 +164,7 @@ public abstract class BaseHash /** * Constructs the result from the contents of the current context. - * + * * @return the output of the completed hash operation. */ protected abstract byte[] getResult(); @@ -174,7 +174,7 @@ public abstract class BaseHash /** * The block digest transformation per se. - * + * * @param in the <i>blockSize</i> long block, as an array of bytes to digest. * @param offset the index where the data to digest is located within the * input buffer. diff --git a/gnu/java/security/hash/HashFactory.java b/gnu/java/security/hash/HashFactory.java index 2a4e48785..1210ff4db 100644 --- a/gnu/java/security/hash/HashFactory.java +++ b/gnu/java/security/hash/HashFactory.java @@ -1,4 +1,4 @@ -/* HashFactory.java -- +/* HashFactory.java -- Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -57,7 +57,7 @@ public class HashFactory /** * Return an instance of a hash algorithm given its name. - * + * * @param name the name of the hash algorithm. * @return an instance of the hash algorithm, or null if none found. * @exception InternalError if the implementation does not pass its self- @@ -111,7 +111,7 @@ public class HashFactory /** * Returns a {@link Set} of names of hash algorithms supported by this * <i>Factory</i>. - * + * * @return a {@link Set} of hash names (Strings). */ public static final Set getNames() diff --git a/gnu/java/security/hash/Haval.java b/gnu/java/security/hash/Haval.java index 662934f34..15c303934 100644 --- a/gnu/java/security/hash/Haval.java +++ b/gnu/java/security/hash/Haval.java @@ -1,4 +1,4 @@ -/* Haval.java -- +/* Haval.java -- Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -105,7 +105,7 @@ public class Haval /** * Calls the constructor with two arguments using the designated output size, * and {@link #HAVAL_3_ROUND} for the value of number of rounds. - * + * * @param size the output size in bytes of this instance. * @throws IllegalArgumentException if the designated output size is invalid. * @see #HAVAL_128_BIT @@ -125,7 +125,7 @@ public class Haval * <code>20</code>, <code>24</code>, <code>28</code> and * <code>32</code>. Valid values for <code>rounds</code> are in the range * <code>3..5</code> inclusive. - * + * * @param size the output size in bytes of this instance. * @param rounds the number of rounds to apply when transforming data. * @throws IllegalArgumentException if the designated output size is invalid, @@ -160,7 +160,7 @@ public class Haval /** * Private constructor for cloning purposes. - * + * * @param md the instance to clone. */ private Haval(Haval md) diff --git a/gnu/java/security/hash/IMessageDigest.java b/gnu/java/security/hash/IMessageDigest.java index 2c5bdd41a..9b716e596 100644 --- a/gnu/java/security/hash/IMessageDigest.java +++ b/gnu/java/security/hash/IMessageDigest.java @@ -1,4 +1,4 @@ -/* IMessageDigest.java -- +/* IMessageDigest.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -49,28 +49,28 @@ public interface IMessageDigest { /** * Returns the canonical name of this algorithm. - * + * * @return the canonical name of this instance. */ String name(); /** * Returns the output length in bytes of this message digest algorithm. - * + * * @return the output length in bytes of this message digest algorithm. */ int hashSize(); /** * Returns the algorithm's (inner) block size in bytes. - * + * * @return the algorithm's inner block size in bytes. */ int blockSize(); /** * Continues a message digest operation using the input byte. - * + * * @param b the input byte to digest. */ void update(byte b); @@ -79,7 +79,7 @@ public interface IMessageDigest * Continues a message digest operation, by filling the buffer, processing * data in the algorithm's HASH_SIZE-bit block(s), updating the context and * count, and buffering the remaining bytes in buffer for the next operation. - * + * * @param in the input block. */ void update(byte[] in); @@ -88,7 +88,7 @@ public interface IMessageDigest * Continues a message digest operation, by filling the buffer, processing * data in the algorithm's HASH_SIZE-bit block(s), updating the context and * count, and buffering the remaining bytes in buffer for the next operation. - * + * * @param in the input block. * @param offset start of meaningful bytes in input block. * @param length number of bytes, in input block, to consider. @@ -98,7 +98,7 @@ public interface IMessageDigest /** * Completes the message digest by performing final operations such as padding * and resetting the instance. - * + * * @return the array of bytes representing the hash value. */ byte[] digest(); @@ -112,7 +112,7 @@ public interface IMessageDigest /** * A basic test. Ensures that the digest of a pre-determined message is equal * to a known pre-computed value. - * + * * @return <code>true</code> if the implementation passes a basic self-test. * Returns <code>false</code> otherwise. */ @@ -120,7 +120,7 @@ public interface IMessageDigest /** * Returns a clone copy of this instance. - * + * * @return a clone copy of this instance. */ Object clone(); diff --git a/gnu/java/security/hash/MD2.java b/gnu/java/security/hash/MD2.java index 8f6b265b0..d78af93fa 100644 --- a/gnu/java/security/hash/MD2.java +++ b/gnu/java/security/hash/MD2.java @@ -1,4 +1,4 @@ -/* MD2.java -- +/* MD2.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/hash/MD4.java b/gnu/java/security/hash/MD4.java index dfc1c6bd6..e6ac11bc8 100644 --- a/gnu/java/security/hash/MD4.java +++ b/gnu/java/security/hash/MD4.java @@ -1,4 +1,4 @@ -/* MD4.java -- +/* MD4.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/hash/MD5.java b/gnu/java/security/hash/MD5.java index 653078512..dfffd3c80 100644 --- a/gnu/java/security/hash/MD5.java +++ b/gnu/java/security/hash/MD5.java @@ -1,4 +1,4 @@ -/* MD5.java -- +/* MD5.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/hash/RipeMD128.java b/gnu/java/security/hash/RipeMD128.java index 62f5a05e5..bd0adc5e0 100644 --- a/gnu/java/security/hash/RipeMD128.java +++ b/gnu/java/security/hash/RipeMD128.java @@ -1,4 +1,4 @@ -/* RipeMD128.java -- +/* RipeMD128.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/hash/RipeMD160.java b/gnu/java/security/hash/RipeMD160.java index 7949bc254..795f5a4b0 100644 --- a/gnu/java/security/hash/RipeMD160.java +++ b/gnu/java/security/hash/RipeMD160.java @@ -1,4 +1,4 @@ -/* RipeMD160.java -- +/* RipeMD160.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/hash/Sha160.java b/gnu/java/security/hash/Sha160.java index 6adeba070..88bf0e405 100644 --- a/gnu/java/security/hash/Sha160.java +++ b/gnu/java/security/hash/Sha160.java @@ -1,4 +1,4 @@ -/* Sha160.java -- +/* Sha160.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/hash/Sha256.java b/gnu/java/security/hash/Sha256.java index 536b1c8ba..76e28d4e0 100644 --- a/gnu/java/security/hash/Sha256.java +++ b/gnu/java/security/hash/Sha256.java @@ -1,4 +1,4 @@ -/* Sha256.java -- +/* Sha256.java -- Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/hash/Sha384.java b/gnu/java/security/hash/Sha384.java index a47eb67db..5fea4f3b1 100644 --- a/gnu/java/security/hash/Sha384.java +++ b/gnu/java/security/hash/Sha384.java @@ -1,4 +1,4 @@ -/* Sha384.java -- +/* Sha384.java -- Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/hash/Sha512.java b/gnu/java/security/hash/Sha512.java index e6f553ed4..17c4323fa 100644 --- a/gnu/java/security/hash/Sha512.java +++ b/gnu/java/security/hash/Sha512.java @@ -1,4 +1,4 @@ -/* Sha512.java -- +/* Sha512.java -- Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/hash/Tiger.java b/gnu/java/security/hash/Tiger.java index 101df39ef..d2993db9f 100644 --- a/gnu/java/security/hash/Tiger.java +++ b/gnu/java/security/hash/Tiger.java @@ -1,4 +1,4 @@ -/* Tiger.java -- +/* Tiger.java -- Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/hash/Whirlpool.java b/gnu/java/security/hash/Whirlpool.java index aebe1acb6..574104074 100644 --- a/gnu/java/security/hash/Whirlpool.java +++ b/gnu/java/security/hash/Whirlpool.java @@ -1,4 +1,4 @@ -/* Whirlpool.java -- +/* Whirlpool.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -548,7 +548,7 @@ public final class Whirlpool // so far. hence the minimal number of bytes added to the message proper // are 33 (1 for the 1-bit followed by the 0-bits and the encoding of // the count framed in a 256-bit block). our formula is then: - // count + 33 + padding = 0 (mod BLOCK_SIZE) + // count + 33 + padding = 0 (mod BLOCK_SIZE) int n = (int)((count + 33) % BLOCK_SIZE); int padding = n == 0 ? 33 : BLOCK_SIZE - n + 33; byte[] result = new byte[padding]; diff --git a/gnu/java/security/jce/hash/HavalSpi.java b/gnu/java/security/jce/hash/HavalSpi.java index 159ba3dd8..7c0a6027b 100644 --- a/gnu/java/security/jce/hash/HavalSpi.java +++ b/gnu/java/security/jce/hash/HavalSpi.java @@ -1,4 +1,4 @@ -/* HavalSpi.java -- +/* HavalSpi.java -- Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/hash/MD2Spi.java b/gnu/java/security/jce/hash/MD2Spi.java index 268f2fa69..76def7acb 100644 --- a/gnu/java/security/jce/hash/MD2Spi.java +++ b/gnu/java/security/jce/hash/MD2Spi.java @@ -1,4 +1,4 @@ -/* MD2Spi.java -- +/* MD2Spi.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/hash/MD4Spi.java b/gnu/java/security/jce/hash/MD4Spi.java index c050ef2df..125943d30 100644 --- a/gnu/java/security/jce/hash/MD4Spi.java +++ b/gnu/java/security/jce/hash/MD4Spi.java @@ -1,4 +1,4 @@ -/* MD4Spi.java -- +/* MD4Spi.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/hash/MD5Spi.java b/gnu/java/security/jce/hash/MD5Spi.java index 629741694..25d9240b4 100644 --- a/gnu/java/security/jce/hash/MD5Spi.java +++ b/gnu/java/security/jce/hash/MD5Spi.java @@ -1,4 +1,4 @@ -/* MD5Spi.java -- +/* MD5Spi.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/hash/MessageDigestAdapter.java b/gnu/java/security/jce/hash/MessageDigestAdapter.java index 7342ee551..2651ecf92 100644 --- a/gnu/java/security/jce/hash/MessageDigestAdapter.java +++ b/gnu/java/security/jce/hash/MessageDigestAdapter.java @@ -1,4 +1,4 @@ -/* MessageDigestAdapter.java -- +/* MessageDigestAdapter.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -69,7 +69,7 @@ class MessageDigestAdapter /** * Trivial protected constructor. - * + * * @param mdName the canonical name of the hash algorithm. */ protected MessageDigestAdapter(String mdName) @@ -79,7 +79,7 @@ class MessageDigestAdapter /** * Private constructor for cloning purposes. - * + * * @param adaptee a clone of the underlying hash algorithm instance. */ private MessageDigestAdapter(IMessageDigest adaptee) diff --git a/gnu/java/security/jce/hash/RipeMD128Spi.java b/gnu/java/security/jce/hash/RipeMD128Spi.java index 159a1173c..499996c02 100644 --- a/gnu/java/security/jce/hash/RipeMD128Spi.java +++ b/gnu/java/security/jce/hash/RipeMD128Spi.java @@ -1,4 +1,4 @@ -/* RipeMD128Spi.java -- +/* RipeMD128Spi.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/hash/RipeMD160Spi.java b/gnu/java/security/jce/hash/RipeMD160Spi.java index 579ccb26f..a62bea6c0 100644 --- a/gnu/java/security/jce/hash/RipeMD160Spi.java +++ b/gnu/java/security/jce/hash/RipeMD160Spi.java @@ -1,4 +1,4 @@ -/* RipeMD160Spi.java -- +/* RipeMD160Spi.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/hash/Sha160Spi.java b/gnu/java/security/jce/hash/Sha160Spi.java index 901cac191..ea2dfe24c 100644 --- a/gnu/java/security/jce/hash/Sha160Spi.java +++ b/gnu/java/security/jce/hash/Sha160Spi.java @@ -1,4 +1,4 @@ -/* Sha160Spi.java -- +/* Sha160Spi.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/hash/Sha256Spi.java b/gnu/java/security/jce/hash/Sha256Spi.java index 9d471e65a..39d31d07b 100644 --- a/gnu/java/security/jce/hash/Sha256Spi.java +++ b/gnu/java/security/jce/hash/Sha256Spi.java @@ -1,4 +1,4 @@ -/* Sha256Spi.java -- +/* Sha256Spi.java -- Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/hash/Sha384Spi.java b/gnu/java/security/jce/hash/Sha384Spi.java index 30d5fce09..fa1e3f948 100644 --- a/gnu/java/security/jce/hash/Sha384Spi.java +++ b/gnu/java/security/jce/hash/Sha384Spi.java @@ -1,4 +1,4 @@ -/* Sha384Spi.java -- +/* Sha384Spi.java -- Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/hash/Sha512Spi.java b/gnu/java/security/jce/hash/Sha512Spi.java index a2d44ab24..4bd39daed 100644 --- a/gnu/java/security/jce/hash/Sha512Spi.java +++ b/gnu/java/security/jce/hash/Sha512Spi.java @@ -1,4 +1,4 @@ -/* Sha512Spi.java -- +/* Sha512Spi.java -- Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/hash/TigerSpi.java b/gnu/java/security/jce/hash/TigerSpi.java index a21e5fe10..3d38c847f 100644 --- a/gnu/java/security/jce/hash/TigerSpi.java +++ b/gnu/java/security/jce/hash/TigerSpi.java @@ -1,4 +1,4 @@ -/* TigerSpi.java -- +/* TigerSpi.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/hash/WhirlpoolSpi.java b/gnu/java/security/jce/hash/WhirlpoolSpi.java index d7a7a4504..68a3a7059 100644 --- a/gnu/java/security/jce/hash/WhirlpoolSpi.java +++ b/gnu/java/security/jce/hash/WhirlpoolSpi.java @@ -1,4 +1,4 @@ -/* WhirlpoolSpi.java -- +/* WhirlpoolSpi.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/prng/HavalRandomSpi.java b/gnu/java/security/jce/prng/HavalRandomSpi.java index c3d4b9412..ebf80f2d7 100644 --- a/gnu/java/security/jce/prng/HavalRandomSpi.java +++ b/gnu/java/security/jce/prng/HavalRandomSpi.java @@ -1,4 +1,4 @@ -/* HavalRandomSpi.java -- +/* HavalRandomSpi.java -- Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/prng/MD2RandomSpi.java b/gnu/java/security/jce/prng/MD2RandomSpi.java index 8ba286804..8b9abe4e9 100644 --- a/gnu/java/security/jce/prng/MD2RandomSpi.java +++ b/gnu/java/security/jce/prng/MD2RandomSpi.java @@ -1,4 +1,4 @@ -/* MD2RandomSpi.java -- +/* MD2RandomSpi.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/prng/MD4RandomSpi.java b/gnu/java/security/jce/prng/MD4RandomSpi.java index d4d182970..2a71d6a0d 100644 --- a/gnu/java/security/jce/prng/MD4RandomSpi.java +++ b/gnu/java/security/jce/prng/MD4RandomSpi.java @@ -1,4 +1,4 @@ -/* MD4RandomSpi.java -- +/* MD4RandomSpi.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/prng/MD5RandomSpi.java b/gnu/java/security/jce/prng/MD5RandomSpi.java index be38add0a..8fb50e16f 100644 --- a/gnu/java/security/jce/prng/MD5RandomSpi.java +++ b/gnu/java/security/jce/prng/MD5RandomSpi.java @@ -1,4 +1,4 @@ -/* MD5RandomSpi.java -- +/* MD5RandomSpi.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/prng/RipeMD128RandomSpi.java b/gnu/java/security/jce/prng/RipeMD128RandomSpi.java index 530c3ec21..6f8dde0e0 100644 --- a/gnu/java/security/jce/prng/RipeMD128RandomSpi.java +++ b/gnu/java/security/jce/prng/RipeMD128RandomSpi.java @@ -1,4 +1,4 @@ -/* RipeMD128RandomSpi.java -- +/* RipeMD128RandomSpi.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/prng/RipeMD160RandomSpi.java b/gnu/java/security/jce/prng/RipeMD160RandomSpi.java index 6875cdfa9..6bb4e2b50 100644 --- a/gnu/java/security/jce/prng/RipeMD160RandomSpi.java +++ b/gnu/java/security/jce/prng/RipeMD160RandomSpi.java @@ -1,4 +1,4 @@ -/* RipeMD160RandomSpi.java -- +/* RipeMD160RandomSpi.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/prng/SecureRandomAdapter.java b/gnu/java/security/jce/prng/SecureRandomAdapter.java index 5877e3edb..9307cfa7f 100644 --- a/gnu/java/security/jce/prng/SecureRandomAdapter.java +++ b/gnu/java/security/jce/prng/SecureRandomAdapter.java @@ -1,4 +1,4 @@ -/* SecureRandomAdapter.java -- +/* SecureRandomAdapter.java -- Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -68,7 +68,7 @@ import java.net.URL; * <p>All the abstract methods in the {@link SecureRandomSpi} class are * implemented by this class and all its sub-classes.</p> */ -public abstract class SecureRandomAdapter +public abstract class SecureRandomAdapter extends SecureRandomSpi { @@ -100,7 +100,7 @@ public abstract class SecureRandomAdapter } public static final byte[] getSeed(int numBytes) - { + { URL sourceUrl = null; String urlStr = null; @@ -117,7 +117,7 @@ public abstract class SecureRandomAdapter catch (MalformedURLException ignored) { logger.log(Level.WARNING, - SECURERANDOM_SOURCE + " property is malformed: {0}", + SECURERANDOM_SOURCE + " property is malformed: {0}", urlStr); } @@ -132,7 +132,7 @@ public abstract class SecureRandomAdapter catch (MalformedURLException mue) { logger.log(Level.WARNING, - JAVA_SECURITY_EGD + " property is malformed: {0}", + JAVA_SECURITY_EGD + " property is malformed: {0}", urlStr); } } diff --git a/gnu/java/security/jce/prng/Sha160RandomSpi.java b/gnu/java/security/jce/prng/Sha160RandomSpi.java index 9fded67e0..ba4d22265 100644 --- a/gnu/java/security/jce/prng/Sha160RandomSpi.java +++ b/gnu/java/security/jce/prng/Sha160RandomSpi.java @@ -1,4 +1,4 @@ -/* Sha160RandomSpi.java -- +/* Sha160RandomSpi.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/prng/Sha256RandomSpi.java b/gnu/java/security/jce/prng/Sha256RandomSpi.java index e3999ffe6..a6ddb70af 100644 --- a/gnu/java/security/jce/prng/Sha256RandomSpi.java +++ b/gnu/java/security/jce/prng/Sha256RandomSpi.java @@ -1,4 +1,4 @@ -/* Sha256RandomSpi.java -- +/* Sha256RandomSpi.java -- Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/prng/Sha384RandomSpi.java b/gnu/java/security/jce/prng/Sha384RandomSpi.java index 978c8fe38..4954b1be7 100644 --- a/gnu/java/security/jce/prng/Sha384RandomSpi.java +++ b/gnu/java/security/jce/prng/Sha384RandomSpi.java @@ -1,4 +1,4 @@ -/* Sha384RandomSpi.java -- +/* Sha384RandomSpi.java -- Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/prng/Sha512RandomSpi.java b/gnu/java/security/jce/prng/Sha512RandomSpi.java index a89e26f00..27de7f319 100644 --- a/gnu/java/security/jce/prng/Sha512RandomSpi.java +++ b/gnu/java/security/jce/prng/Sha512RandomSpi.java @@ -1,4 +1,4 @@ -/* Sha512RandomSpi.java -- +/* Sha512RandomSpi.java -- Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/prng/TigerRandomSpi.java b/gnu/java/security/jce/prng/TigerRandomSpi.java index ba4b22fb8..722ab3279 100644 --- a/gnu/java/security/jce/prng/TigerRandomSpi.java +++ b/gnu/java/security/jce/prng/TigerRandomSpi.java @@ -1,4 +1,4 @@ -/* TigerRandomSpi.java -- +/* TigerRandomSpi.java -- Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/prng/WhirlpoolRandomSpi.java b/gnu/java/security/jce/prng/WhirlpoolRandomSpi.java index 9d937e65f..5da43d77e 100644 --- a/gnu/java/security/jce/prng/WhirlpoolRandomSpi.java +++ b/gnu/java/security/jce/prng/WhirlpoolRandomSpi.java @@ -1,4 +1,4 @@ -/* WhirlpoolRandomSpi.java -- +/* WhirlpoolRandomSpi.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/sig/DSSKeyFactory.java b/gnu/java/security/jce/sig/DSSKeyFactory.java index 7b57dba70..ec993432c 100644 --- a/gnu/java/security/jce/sig/DSSKeyFactory.java +++ b/gnu/java/security/jce/sig/DSSKeyFactory.java @@ -61,7 +61,7 @@ import java.security.spec.X509EncodedKeySpec; /** * DSA key factory. - * + * * @author Casey Marshall (rsdio@metastatic.org) */ public class DSSKeyFactory diff --git a/gnu/java/security/jce/sig/DSSKeyPairGeneratorSpi.java b/gnu/java/security/jce/sig/DSSKeyPairGeneratorSpi.java index c44538106..2d33e1621 100644 --- a/gnu/java/security/jce/sig/DSSKeyPairGeneratorSpi.java +++ b/gnu/java/security/jce/sig/DSSKeyPairGeneratorSpi.java @@ -1,4 +1,4 @@ -/* DSSKeyPairGeneratorSpi.java -- +/* DSSKeyPairGeneratorSpi.java -- Copyright 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/sig/DSSParameters.java b/gnu/java/security/jce/sig/DSSParameters.java index 8a1cb4ca5..fbf778dae 100644 --- a/gnu/java/security/jce/sig/DSSParameters.java +++ b/gnu/java/security/jce/sig/DSSParameters.java @@ -99,8 +99,8 @@ public class DSSParameters /** * Decodes the set of DSS parameters as per RFC-2459; i.e. the DER-encoded - * form of the following ASN.1 construct: - * + * form of the following ASN.1 construct: + * * <pre> * DssParams ::= SEQUENCE { * p INTEGER, @@ -152,8 +152,8 @@ public class DSSParameters /** * Encodes the set of DSS parameters as per RFC-2459; i.e. as the DER-encoded - * form of the following ASN.1 construct: - * + * form of the following ASN.1 construct: + * * <pre> * DssParams ::= SEQUENCE { * p INTEGER, diff --git a/gnu/java/security/jce/sig/DSSRawSignatureSpi.java b/gnu/java/security/jce/sig/DSSRawSignatureSpi.java index 9b20c03b1..edee4e577 100644 --- a/gnu/java/security/jce/sig/DSSRawSignatureSpi.java +++ b/gnu/java/security/jce/sig/DSSRawSignatureSpi.java @@ -1,4 +1,4 @@ -/* DSSRawSignatureSpi.java -- +/* DSSRawSignatureSpi.java -- Copyright 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java b/gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java index bcbbe477d..9d3e5efdd 100644 --- a/gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java +++ b/gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java @@ -1,4 +1,4 @@ -/* KeyPairGeneratorAdapter.java -- +/* KeyPairGeneratorAdapter.java -- Copyright 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -72,7 +72,7 @@ public abstract class KeyPairGeneratorAdapter /** * Trivial protected constructor. - * + * * @param kpgName the canonical name of the keypair generator algorithm. */ protected KeyPairGeneratorAdapter(String kpgName) diff --git a/gnu/java/security/jce/sig/RSAPSSRawSignatureSpi.java b/gnu/java/security/jce/sig/RSAPSSRawSignatureSpi.java index f1ccbde4d..496c9caa6 100644 --- a/gnu/java/security/jce/sig/RSAPSSRawSignatureSpi.java +++ b/gnu/java/security/jce/sig/RSAPSSRawSignatureSpi.java @@ -1,4 +1,4 @@ -/* RSAPSSRawSignatureSpi.java -- +/* RSAPSSRawSignatureSpi.java -- Copyright 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/jce/sig/SignatureAdapter.java b/gnu/java/security/jce/sig/SignatureAdapter.java index a65d727ee..0ed1e2f41 100644 --- a/gnu/java/security/jce/sig/SignatureAdapter.java +++ b/gnu/java/security/jce/sig/SignatureAdapter.java @@ -1,4 +1,4 @@ -/* SignatureAdapter.java -- +/* SignatureAdapter.java -- Copyright 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -85,7 +85,7 @@ class SignatureAdapter /** * Trivial protected constructor. - * + * * @param sigName the canonical name of the signature scheme. * @param codec the signature codec engine to use with this scheme. */ @@ -96,7 +96,7 @@ class SignatureAdapter /** * Private constructor for cloning purposes. - * + * * @param adaptee a clone of the underlying signature scheme instance. * @param codec the signature codec engine to use with this scheme. */ diff --git a/gnu/java/security/key/IKeyPairCodec.java b/gnu/java/security/key/IKeyPairCodec.java index f09743d2b..5c88c86ca 100644 --- a/gnu/java/security/key/IKeyPairCodec.java +++ b/gnu/java/security/key/IKeyPairCodec.java @@ -1,4 +1,4 @@ -/* IKeyPairCodec.java -- +/* IKeyPairCodec.java -- Copyright 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -69,14 +69,14 @@ public interface IKeyPairCodec /** * Returns the unique identifier (within this library) of the format used to * externalise public and private keys. - * + * * @return the identifier of the format, the object supports. */ int getFormatID(); /** * Encodes an instance of a public key for storage or transmission purposes. - * + * * @param key the non-null key to encode. * @return a byte sequence representing the encoding of the designated key * according to the format supported by this codec. @@ -87,7 +87,7 @@ public interface IKeyPairCodec /** * Encodes an instance of a private key for storage or transmission purposes. - * + * * @param key the non-null key to encode. * @return a byte sequence representing the encoding of the designated key * according to the format supported by this codec. @@ -99,7 +99,7 @@ public interface IKeyPairCodec /** * Decodes an instance of an external public key into its native Java * representation. - * + * * @param input the source of the externalised key to decode. * @return a concrete instance of a public key, reconstructed from the * designated input. @@ -112,7 +112,7 @@ public interface IKeyPairCodec /** * Decodes an instance of an external private key into its native Java * representation. - * + * * @param input the source of the externalised key to decode. * @return a concrete instance of a private key, reconstructed from the * designated input. diff --git a/gnu/java/security/key/IKeyPairGenerator.java b/gnu/java/security/key/IKeyPairGenerator.java index 8d7842e93..72aac2463 100644 --- a/gnu/java/security/key/IKeyPairGenerator.java +++ b/gnu/java/security/key/IKeyPairGenerator.java @@ -1,4 +1,4 @@ -/* IKeyPairGenerator.java -- +/* IKeyPairGenerator.java -- Copyright 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -48,14 +48,14 @@ public interface IKeyPairGenerator { /** * Returns the canonical name of this keypair generator. - * + * * @return the canonical name of this instance. */ String name(); /** * [Re]-initialises this instance for use with a given set of attributes. - * + * * @param attributes a map of name/value pairs to use for setting up the * instance. * @exception IllegalArgumentException if at least one of the mandatory @@ -66,7 +66,7 @@ public interface IKeyPairGenerator /** * Generates a new keypair based on the attributes used to configure the * instance. - * + * * @return a new keypair. */ KeyPair generate(); diff --git a/gnu/java/security/key/KeyPairCodecFactory.java b/gnu/java/security/key/KeyPairCodecFactory.java index e68a7d65c..d42866423 100644 --- a/gnu/java/security/key/KeyPairCodecFactory.java +++ b/gnu/java/security/key/KeyPairCodecFactory.java @@ -1,4 +1,4 @@ -/* KeyPairCodecFactory.java -- +/* KeyPairCodecFactory.java -- Copyright 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -79,7 +79,7 @@ public class KeyPairCodecFactory * <b>IMPORTANT</b>: For backward compatibility, when the encoding format * name is missing, the Raw encoding format is assumed. When this is the case * the trailing forward slash is discarded from the name. - * + * * @param name the case-insensitive key codec name. * @return an instance of the keypair codec, or <code>null</code> if none * found. @@ -113,7 +113,7 @@ public class KeyPairCodecFactory * Returns an instance of a keypair codec given the canonical name of the * key-pair algorithm, and the name of the encoding format to use when * externalizing the keys. - * + * * @param name the case-insensitive key-pair algorithm name. * @param format the name of the encoding format to use when externalizing the * keys generated by the key-pair algorithm. @@ -133,7 +133,7 @@ public class KeyPairCodecFactory * Returns an instance of a keypair codec given the canonical name of the * key-pair algorithm, and the identifier of the format to use when * externalizing the keys. - * + * * @param name the case-insensitive key-pair algorithm name. * @param formatID the identifier of the format to use when externalizing the * keys generated by the key-pair algorithm. @@ -161,7 +161,7 @@ public class KeyPairCodecFactory /** * Returns an instance of a keypair codec given a key. - * + * * @param key the key to encode. * @return an instance of the keypair codec, or <code>null</code> if none * found. diff --git a/gnu/java/security/key/KeyPairGeneratorFactory.java b/gnu/java/security/key/KeyPairGeneratorFactory.java index 4872fc3d1..151cace39 100644 --- a/gnu/java/security/key/KeyPairGeneratorFactory.java +++ b/gnu/java/security/key/KeyPairGeneratorFactory.java @@ -1,4 +1,4 @@ -/* KeyPairGeneratorFactory.java -- +/* KeyPairGeneratorFactory.java -- Copyright 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -60,7 +60,7 @@ public class KeyPairGeneratorFactory /** * Returns an instance of a keypair generator given its name. - * + * * @param name the case-insensitive key generator name. * @return an instance of the keypair generator, or <code>null</code> if * none found. @@ -89,7 +89,7 @@ public class KeyPairGeneratorFactory * Returns a {@link Set} of keypair generator names supported by this * <i>Factory</i>. Those keypair generators may be used in conjunction with * the digital signature schemes with appendix supported by this library. - * + * * @return a {@link Set} of keypair generator names (Strings). */ public static final Set getNames() diff --git a/gnu/java/security/key/dss/DSSKey.java b/gnu/java/security/key/dss/DSSKey.java index d4cf36513..49f229f7b 100644 --- a/gnu/java/security/key/dss/DSSKey.java +++ b/gnu/java/security/key/dss/DSSKey.java @@ -1,4 +1,4 @@ -/* DSSKey.java -- +/* DSSKey.java -- Copyright 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -66,7 +66,7 @@ import java.security.spec.DSAParameterSpec; * <b>IMPORTANT</b>: Under certain circumstances (e.g. in an X.509 certificate * with inherited AlgorithmIdentifier's parameters of a SubjectPublicKeyInfo * element) these three MPIs may be <code>null</code>. - * + * * @see DSSPrivateKey#getEncoded * @see DSSPublicKey#getEncoded */ @@ -108,7 +108,7 @@ public abstract class DSSKey /** * Trivial protected constructor. - * + * * @param defaultFormat the identifier of the encoding format to use by * default when externalizing the key. * @param p the DSS parameter <code>p</code>. @@ -156,7 +156,7 @@ public abstract class DSSKey * <i>inherited</i>. This may be the case when the key is re-constructed from * an X.509 certificate with absent or NULL AlgorithmIdentifier's parameters * field. - * + * * @param obj the other non-null DSS key to compare to. * @return <code>true</code> if the designated object is of the same type * and value as this one. diff --git a/gnu/java/security/key/dss/DSSKeyPairGenerator.java b/gnu/java/security/key/dss/DSSKeyPairGenerator.java index 1bad0b62e..6bda4e88e 100644 --- a/gnu/java/security/key/dss/DSSKeyPairGenerator.java +++ b/gnu/java/security/key/dss/DSSKeyPairGenerator.java @@ -1,4 +1,4 @@ -/* DSSKeyPairGenerator.java -- +/* DSSKeyPairGenerator.java -- Copyright 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -217,7 +217,7 @@ public class DSSKeyPairGenerator /** * Configures this instance. - * + * * @param attributes the map of name/value pairs to use. * @exception IllegalArgumentException if the designated MODULUS_LENGTH value * is not greater than 512, less than 1024 and not of the form @@ -361,7 +361,7 @@ public class DSSKeyPairGenerator /** * Fills the designated byte array with random data. - * + * * @param buffer the byte array to fill with random data. */ private void nextRandomBytes(byte[] buffer) diff --git a/gnu/java/security/key/dss/DSSKeyPairPKCS8Codec.java b/gnu/java/security/key/dss/DSSKeyPairPKCS8Codec.java index 06b8e849a..a59ca3cee 100644 --- a/gnu/java/security/key/dss/DSSKeyPairPKCS8Codec.java +++ b/gnu/java/security/key/dss/DSSKeyPairPKCS8Codec.java @@ -88,7 +88,7 @@ public class DSSKeyPairPKCS8Codec /** * Returns the PKCS#8 ASN.1 <i>PrivateKeyInfo</i> representation of a DSA * private key. The ASN.1 specification is as follows: - * + * * <pre> * PrivateKeyInfo ::= SEQUENCE { * version INTEGER, -- MUST be 0 @@ -107,7 +107,7 @@ public class DSSKeyPairPKCS8Codec * g INTEGER * } * </pre> - * + * * @return the DER encoded form of the ASN.1 representation of the * <i>PrivateKeyInfo</i> field in an X.509 certificate. * @throw InvalidParameterException if an error occurs during the marshalling diff --git a/gnu/java/security/key/dss/DSSKeyPairRawCodec.java b/gnu/java/security/key/dss/DSSKeyPairRawCodec.java index b1135b75f..5b93c6b1e 100644 --- a/gnu/java/security/key/dss/DSSKeyPairRawCodec.java +++ b/gnu/java/security/key/dss/DSSKeyPairRawCodec.java @@ -1,4 +1,4 @@ -/* DSSKeyPairRawCodec.java -- +/* DSSKeyPairRawCodec.java -- Copyright 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -92,7 +92,7 @@ public class DSSKeyPairRawCodec * the <code>toByteArray()</code> method on the DSA parameter <code>y</code>, * </li> * </ol> - * + * * @param key the key to encode. * @return the <i>Raw</i> format encoding of the designated key. * @throws IllegalArgumentException if the designated key is not a DSS @@ -235,7 +235,7 @@ public class DSSKeyPairRawCodec * the <code>toByteArray()</code> method on the DSA parameter <code>x</code>, * </li> * </ol> - * + * * @param key the key to encode. * @return the <i>Raw</i> format encoding of the designated key. * @throws IllegalArgumentException if the designated key is not a DSS diff --git a/gnu/java/security/key/dss/DSSKeyPairX509Codec.java b/gnu/java/security/key/dss/DSSKeyPairX509Codec.java index a5e8e9d47..8c26910f1 100644 --- a/gnu/java/security/key/dss/DSSKeyPairX509Codec.java +++ b/gnu/java/security/key/dss/DSSKeyPairX509Codec.java @@ -103,11 +103,11 @@ public class DSSKeyPairX509Codec * <p> * The <i>subjectPublicKey</i> field, which is a BIT STRING, contains the * DER-encoded form of the DSA public key as an INTEGER. - * + * * <pre> * DSAPublicKey ::= INTEGER -- public key, Y * </pre> - * + * * @param key the {@link PublicKey} instance to encode. MUST be an instance of * {@link DSSPublicKey}. * @return the ASN.1 representation of the <i>SubjectPublicKeyInfo</i> in an diff --git a/gnu/java/security/key/dss/DSSPrivateKey.java b/gnu/java/security/key/dss/DSSPrivateKey.java index 633fcf7ce..de3668c01 100644 --- a/gnu/java/security/key/dss/DSSPrivateKey.java +++ b/gnu/java/security/key/dss/DSSPrivateKey.java @@ -1,4 +1,4 @@ -/* DSSPrivateKey.java -- +/* DSSPrivateKey.java -- Copyright 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -52,7 +52,7 @@ import java.security.interfaces.DSAPrivateKey; /** * An object that embodies a DSS (Digital Signature Standard) private key. - * + * * @see #getEncoded */ public class DSSPrivateKey @@ -72,7 +72,7 @@ public class DSSPrivateKey * Convenience constructor. Calls the constructor with 5 arguments passing * {@link Registry#RAW_ENCODING_ID} as the identifier of the preferred * encoding format. - * + * * @param p the public modulus. * @param q the public prime divisor of <code>p-1</code>. * @param g a generator of the unique cyclic group <code>Z<sup>*</sup> @@ -87,7 +87,7 @@ public class DSSPrivateKey /** * Constructs a new instance of a <code>DSSPrivateKey</code> given the * designated arguments. - * + * * @param preferredFormat the indetifier of the preferred encoding format to * use when externalizing this key. * @param p the public modulus. @@ -110,7 +110,7 @@ public class DSSPrivateKey * method of a DSS keypair codec object (an instance implementing * {@link gnu.java.security.key.IKeyPairCodec} for DSS keys, and re-constructs * an instance of this object. - * + * * @param k the contents of a previously encoded instance of this object. * @exception ArrayIndexOutOfBoundsException if there is not enough bytes, in * <code>k</code>, to represent a valid encoding of an @@ -141,7 +141,7 @@ public class DSSPrivateKey /** * Returns the encoded form of this private key according to the designated * format. - * + * * @param format the desired format identifier of the resulting encoding. * @return the byte sequence encoding this key according to the designated * format. @@ -170,7 +170,7 @@ public class DSSPrivateKey * Returns <code>true</code> if the designated object is an instance of * {@link DSAPrivateKey} and has the same DSS (Digital Signature Standard) * parameter values as this one. - * + * * @param obj the other non-null DSS key to compare to. * @return <code>true</code> if the designated object is of the same type * and value as this one. diff --git a/gnu/java/security/key/dss/DSSPublicKey.java b/gnu/java/security/key/dss/DSSPublicKey.java index e5c534671..d7c1afe15 100644 --- a/gnu/java/security/key/dss/DSSPublicKey.java +++ b/gnu/java/security/key/dss/DSSPublicKey.java @@ -1,4 +1,4 @@ -/* DSSPublicKey.java -- +/* DSSPublicKey.java -- Copyright 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -51,7 +51,7 @@ import java.security.interfaces.DSAPublicKey; /** * An object that embodies a DSS (Digital Signature Standard) public key. - * + * * @see #getEncoded */ public class DSSPublicKey @@ -71,7 +71,7 @@ public class DSSPublicKey * Conveience constructor. Calls the constructor with 5 arguments passing * {@link Registry#RAW_ENCODING_ID} as the identifier of the preferred * encoding format. - * + * * @param p the public modulus. * @param q the public prime divisor of <code>p-1</code>. * @param g a generator of the unique cyclic group <code>Z<sup>*</sup> @@ -86,7 +86,7 @@ public class DSSPublicKey /** * Constructs a new instance of <code>DSSPublicKey</code> given the * designated arguments. - * + * * @param preferredFormat the identifier of the preferred encoding format to * use when externalizing this key. * @param p the public modulus. @@ -109,7 +109,7 @@ public class DSSPublicKey * method of a DSS keypair codec object (an instance implementing * {@link gnu.java.security.key.IKeyPairCodec} for DSS keys, and re-constructs * an instance of this object. - * + * * @param k the contents of a previously encoded instance of this object. * @exception ArrayIndexOutOfBoundsException if there is not enough bytes, in * <code>k</code>, to represent a valid encoding of an @@ -140,7 +140,7 @@ public class DSSPublicKey /** * Returns the encoded form of this public key according to the designated * format. - * + * * @param format the desired format identifier of the resulting encoding. * @return the byte sequence encoding this key according to the designated * format. @@ -169,7 +169,7 @@ public class DSSPublicKey * Returns <code>true</code> if the designated object is an instance of * {@link DSAPublicKey} and has the same DSS (Digital Signature Standard) * parameter values as this one. - * + * * @param obj the other non-null DSS key to compare to. * @return <code>true</code> if the designated object is of the same type * and value as this one. diff --git a/gnu/java/security/key/dss/FIPS186.java b/gnu/java/security/key/dss/FIPS186.java index 65dc5800c..5d371e10c 100644 --- a/gnu/java/security/key/dss/FIPS186.java +++ b/gnu/java/security/key/dss/FIPS186.java @@ -1,4 +1,4 @@ -/* FIPS186.java -- +/* FIPS186.java -- Copyright 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -241,7 +241,7 @@ public class FIPS186 /** * Fills the designated byte array with random data. - * + * * @param buffer the byte array to fill with random data. */ private void nextRandomBytes(byte[] buffer) diff --git a/gnu/java/security/key/rsa/GnuRSAKey.java b/gnu/java/security/key/rsa/GnuRSAKey.java index 0419ac96e..38530ee4c 100644 --- a/gnu/java/security/key/rsa/GnuRSAKey.java +++ b/gnu/java/security/key/rsa/GnuRSAKey.java @@ -1,4 +1,4 @@ -/* GnuRSAKey.java -- +/* GnuRSAKey.java -- Copyright 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -72,7 +72,7 @@ public abstract class GnuRSAKey /** * Trivial protected constructor. - * + * * @param defaultFormat the identifier of the encoding format to use by * default when externalizing the key. * @param n the public modulus <code>n</code>. @@ -111,7 +111,7 @@ public abstract class GnuRSAKey /** * Returns the modulus <code>n</code>. - * + * * @return the modulus <code>n</code>. */ public BigInteger getN() @@ -121,7 +121,7 @@ public abstract class GnuRSAKey /** * Returns the public exponent <code>e</code>. - * + * * @return the public exponent <code>e</code>. */ public BigInteger getPublicExponent() @@ -131,7 +131,7 @@ public abstract class GnuRSAKey /** * Same as {@link #getPublicExponent()}. - * + * * @return the public exponent <code>e</code>. */ public BigInteger getE() @@ -142,7 +142,7 @@ public abstract class GnuRSAKey /** * Returns <code>true</code> if the designated object is an instance of * {@link RSAKey} and has the same RSA parameter values as this one. - * + * * @param obj the other non-null RSA key to compare to. * @return <code>true</code> if the designated object is of the same type * and value as this one. diff --git a/gnu/java/security/key/rsa/GnuRSAPrivateKey.java b/gnu/java/security/key/rsa/GnuRSAPrivateKey.java index e554f2f3f..39f91cbe4 100644 --- a/gnu/java/security/key/rsa/GnuRSAPrivateKey.java +++ b/gnu/java/security/key/rsa/GnuRSAPrivateKey.java @@ -1,4 +1,4 @@ -/* GnuRSAPrivateKey.java -- +/* GnuRSAPrivateKey.java -- Copyright 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -92,7 +92,7 @@ public class GnuRSAPrivateKey * Convenience constructor. Calls the constructor with 5 arguments passing * {@link Registry#RAW_ENCODING_ID} as the identifier of the preferred * encoding format. - * + * * @param p the modulus first prime divisor. * @param q the modulus second prime divisor. * @param e the public exponent. @@ -106,7 +106,7 @@ public class GnuRSAPrivateKey /** * Constructs a new instance of a <code>GnuRSAPrivateKey</code> given the * designated arguments. - * + * * @param preferredFormat the indetifier of the preferred encoding format to * use when externalizing this key. * @param p the modulus first prime divisor. @@ -128,7 +128,7 @@ public class GnuRSAPrivateKey /** * Constructs a new instance of a <code>GnuRSAPrivateKey</code> given the * designated arguments. - * + * * @param preferredFormat the indetifier of the preferred encoding format to * use when externalizing this key. * @param n the public modulus, which is also the product of <code>p</code> @@ -173,7 +173,7 @@ public class GnuRSAPrivateKey * method of an RSA keypair codec object (an instance implementing * {@link IKeyPairCodec} for RSA keys, and re-constructs an instance of this * object. - * + * * @param k the contents of a previously encoded instance of this object. * @throws ArrayIndexOutOfBoundsException if there is not enough bytes, in * <code>k</code>, to represent a valid encoding of an instance @@ -229,7 +229,7 @@ public class GnuRSAPrivateKey /** * Returns the encoded form of this private key according to the designated * format. - * + * * @param format the desired format identifier of the resulting encoding. * @return the byte sequence encoding this key according to the designated * format. @@ -258,7 +258,7 @@ public class GnuRSAPrivateKey /** * Returns <code>true</code> if the designated object is an instance of this * class and has the same RSA parameter values as this one. - * + * * @param obj the other non-null RSA key to compare to. * @return <code>true</code> if the designated object is of the same type * and value as this one. diff --git a/gnu/java/security/key/rsa/GnuRSAPublicKey.java b/gnu/java/security/key/rsa/GnuRSAPublicKey.java index 3217130c2..0bad92881 100644 --- a/gnu/java/security/key/rsa/GnuRSAPublicKey.java +++ b/gnu/java/security/key/rsa/GnuRSAPublicKey.java @@ -1,4 +1,4 @@ -/* GnuRSAPublicKey.java -- +/* GnuRSAPublicKey.java -- Copyright 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -72,7 +72,7 @@ public class GnuRSAPublicKey * Conveience constructor. Calls the constructor with 3 arguments passing * {@link Registry#RAW_ENCODING_ID} as the identifier of the preferred * encoding format. - * + * * @param n the modulus. * @param e the public exponent. */ @@ -84,7 +84,7 @@ public class GnuRSAPublicKey /** * Constructs a new instance of <code>GnuRSAPublicKey</code> given the * designated arguments. - * + * * @param preferredFormat the identifier of the preferred encoding format to * use when externalizing this key. * @param n the modulus. @@ -102,7 +102,7 @@ public class GnuRSAPublicKey * method of an RSA keypair codec object (an instance implementing * {@link IKeyPairCodec} for RSA keys, and re-constructs an instance of this * object. - * + * * @param k the contents of a previously encoded instance of this object. * @throws ArrayIndexOutOfBoundsException if there is not enough bytes, in * <code>k</code>, to represent a valid encoding of an instance @@ -128,7 +128,7 @@ public class GnuRSAPublicKey /** * Returns the encoded form of this public key according to the designated * format. - * + * * @param format the desired format identifier of the resulting encoding. * @return the byte sequence encoding this key according to the designated * format. @@ -156,7 +156,7 @@ public class GnuRSAPublicKey /** * Returns <code>true</code> if the designated object is an instance of this * class and has the same RSA parameter values as this one. - * + * * @param obj the other non-null RSA key to compare to. * @return <code>true</code> if the designated object is of the same type * and value as this one. diff --git a/gnu/java/security/key/rsa/RSAKeyPairGenerator.java b/gnu/java/security/key/rsa/RSAKeyPairGenerator.java index c31cc4cc1..bec60d350 100644 --- a/gnu/java/security/key/rsa/RSAKeyPairGenerator.java +++ b/gnu/java/security/key/rsa/RSAKeyPairGenerator.java @@ -1,4 +1,4 @@ -/* RSAKeyPairGenerator.java -- +/* RSAKeyPairGenerator.java -- Copyright 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -135,7 +135,7 @@ public class RSAKeyPairGenerator /** * Configures this instance. - * + * * @param attributes the map of name/value pairs to use. * @exception IllegalArgumentException if the designated MODULUS_LENGTH value * is less than 1024. @@ -175,7 +175,7 @@ public class RSAKeyPairGenerator * The algorithm used here is described in <i>nessie-pss-B.pdf</i> document * which is part of the RSA-PSS submission to NESSIE. * </p> - * + * * @return an RSA keypair. */ public KeyPair generate() @@ -225,7 +225,7 @@ public class RSAKeyPairGenerator /** * Fills the designated byte array with random data. - * + * * @param buffer the byte array to fill with random data. */ private void nextRandomBytes(byte[] buffer) diff --git a/gnu/java/security/key/rsa/RSAKeyPairPKCS8Codec.java b/gnu/java/security/key/rsa/RSAKeyPairPKCS8Codec.java index 7a51d0a0d..2785f02c8 100644 --- a/gnu/java/security/key/rsa/RSAKeyPairPKCS8Codec.java +++ b/gnu/java/security/key/rsa/RSAKeyPairPKCS8Codec.java @@ -116,7 +116,7 @@ public class RSAKeyPairPKCS8Codec * coefficient INTEGER, -- (inverse of q) mod p * } * </pre> - * + * * @return the DER encoded form of the ASN.1 representation of the * <i>PrivateKeyInfo</i> field for an RSA {@link PrivateKey}.. * @throw InvalidParameterException if an error occurs during the marshalling @@ -251,7 +251,7 @@ public class RSAKeyPairPKCS8Codec der = new DERReader(pkBytes); DERValue derRSAPrivateKey = der.read(); DerUtil.checkIsConstructed(derRSAPrivateKey, "Wrong RSAPrivateKey field"); - + val = der.read(); DerUtil.checkIsBigInteger(val, "Wrong RSAPrivateKey Version field"); version = (BigInteger) val.getValue(); diff --git a/gnu/java/security/key/rsa/RSAKeyPairRawCodec.java b/gnu/java/security/key/rsa/RSAKeyPairRawCodec.java index 952202366..f088e794e 100644 --- a/gnu/java/security/key/rsa/RSAKeyPairRawCodec.java +++ b/gnu/java/security/key/rsa/RSAKeyPairRawCodec.java @@ -1,4 +1,4 @@ -/* RSAKeyPairRawCodec.java -- +/* RSAKeyPairRawCodec.java -- Copyright 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -190,7 +190,7 @@ public class RSAKeyPairRawCodec * the <code>toByteArray()</code> method on the RSA parameter <code>d</code>, * </li> * </ol> - * + * * @param key the key to encode. * @return the <i>Raw</i> format encoding of the designated key. */ diff --git a/gnu/java/security/key/rsa/RSAKeyPairX509Codec.java b/gnu/java/security/key/rsa/RSAKeyPairX509Codec.java index b11e1c013..9ad6ae029 100644 --- a/gnu/java/security/key/rsa/RSAKeyPairX509Codec.java +++ b/gnu/java/security/key/rsa/RSAKeyPairX509Codec.java @@ -97,14 +97,14 @@ public class RSAKeyPairX509Codec * <p> * The <i>subjectPublicKey</i> field, which is a BIT STRING, contains the * DER-encoded form of the RSA public key defined as: - * + * * <pre> * RSAPublicKey ::= SEQUENCE { * modulus INTEGER, -- n * publicExponent INTEGER -- e * } * </pre> - * + * * @param key the {@link PublicKey} instance to encode. MUST be an instance of * {@link GnuRSAPublicKey}. * @return the ASN.1 representation of the <i>SubjectPublicKeyInfo</i> in an diff --git a/gnu/java/security/pkcs/PKCS7Data.java b/gnu/java/security/pkcs/PKCS7Data.java index 3d3052b96..c6474f081 100644 --- a/gnu/java/security/pkcs/PKCS7Data.java +++ b/gnu/java/security/pkcs/PKCS7Data.java @@ -52,7 +52,7 @@ public class PKCS7Data /** * Constructs a new instance of <code>PKCS7Data</code> with the possibly * null (implicetly referenced) content data. - * + * * @param data the raw bytes of the data to use in a PKCS#7 framework. */ public PKCS7Data(byte[] data) diff --git a/gnu/java/security/pkcs/PKCS7SignedData.java b/gnu/java/security/pkcs/PKCS7SignedData.java index d59dba3cd..adb00a3be 100644 --- a/gnu/java/security/pkcs/PKCS7SignedData.java +++ b/gnu/java/security/pkcs/PKCS7SignedData.java @@ -333,7 +333,7 @@ public class PKCS7SignedData /** * Constructs a new instance of <code>PKCS7SignedData</code> given a * designated set of fields. - * + * * @param digestAlgorithms the collection of DigestAlgorithm elements. Each * DigestAlgorithm is a {@link List} of two elements, the first is an * OID while the second is dependent on the value of the OID element. @@ -401,7 +401,7 @@ public class PKCS7SignedData /** * Writes to the designated output stream the DER encoding of the current * contents of this instance. - * + * * @param out the destination output stream. * @throws IOException if an I/O related exception occurs during the process. * @throws CRLException if an exception occurs while encoding the certificate diff --git a/gnu/java/security/pkcs/SignerInfo.java b/gnu/java/security/pkcs/SignerInfo.java index 3066401ac..645ed67bb 100644 --- a/gnu/java/security/pkcs/SignerInfo.java +++ b/gnu/java/security/pkcs/SignerInfo.java @@ -90,9 +90,9 @@ public class SignerInfo * issuer Name, * serialNumber CertificateSerialNumber * } - * + * * DigestAlgorithmIdentifier ::= AlgorithmIdentifier - * + * * DigestEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier * * EncryptedDigest ::= OCTET STRING @@ -269,7 +269,7 @@ public class SignerInfo /** * Constructs a new instance of <code>SignerInfo</code> given a designated * set of fields. - * + * * @param issuer the X.500 Principal name of the signer referenced by this * instance. * @param serialNumber the serial number of the certificate being used. Both @@ -369,7 +369,7 @@ public class SignerInfo /** * Writes to the designated output stream the DER encoding of the current * contents of this instance. - * + * * @param out the destination output stream. * @throws IOException if an I/O related exception occurs during the process. */ diff --git a/gnu/java/security/prng/BasePRNG.java b/gnu/java/security/prng/BasePRNG.java index 3b7c8cf07..eb5ada71c 100644 --- a/gnu/java/security/prng/BasePRNG.java +++ b/gnu/java/security/prng/BasePRNG.java @@ -1,4 +1,4 @@ -/* BasePRNG.java -- +/* BasePRNG.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -60,7 +60,7 @@ public abstract class BasePRNG /** * Trivial constructor for use by concrete subclasses. - * + * * @param name the canonical name of this instance. */ protected BasePRNG(String name) diff --git a/gnu/java/security/prng/EntropySource.java b/gnu/java/security/prng/EntropySource.java index 95f68f048..a7173d3b1 100644 --- a/gnu/java/security/prng/EntropySource.java +++ b/gnu/java/security/prng/EntropySource.java @@ -1,4 +1,4 @@ -/* EntropySource.java -- +/* EntropySource.java -- Copyright (C) 2004, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -58,4 +58,4 @@ public interface EntropySource * @return The next random bytes. */ byte[] nextBytes(); -}
\ No newline at end of file +} diff --git a/gnu/java/security/prng/IRandom.java b/gnu/java/security/prng/IRandom.java index 66ad6d224..eb1495dd8 100644 --- a/gnu/java/security/prng/IRandom.java +++ b/gnu/java/security/prng/IRandom.java @@ -1,4 +1,4 @@ -/* IRandom.java -- +/* IRandom.java -- Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -79,7 +79,7 @@ public interface IRandom { /** * Returns the canonical name of this instance. - * + * * @return the canonical name of this instance. */ String name(); @@ -87,7 +87,7 @@ public interface IRandom /** * Initialises the pseudo-random number generator scheme with the appropriate * attributes. - * + * * @param attributes a set of name-value pairs that describe the desired * future instance behaviour. * @exception IllegalArgumentException if at least one of the defined name/ @@ -97,7 +97,7 @@ public interface IRandom /** * Returns the next 8 bits of random data generated from this instance. - * + * * @return the next 8 bits of random data generated from this instance. * @exception IllegalStateException if the instance is not yet initialised. * @exception LimitReachedException if this instance has reached its @@ -110,7 +110,7 @@ public interface IRandom * Fills the designated byte array, starting from byte at index * <code>offset</code>, for a maximum of <code>length</code> bytes with * the output of this generator instance. - * + * * @param out the placeholder to contain the generated random bytes. * @param offset the starting index in <i>out</i> to consider. This method * does nothing if this parameter is not within <code>0</code> and @@ -132,7 +132,7 @@ public interface IRandom * Implementations are not required to implement this method in any meaningful * way; this may be a no-operation, and implementations may throw an * {@link UnsupportedOperationException}. - * + * * @param b The byte to add. */ void addRandomByte(byte b); @@ -144,7 +144,7 @@ public interface IRandom * Implementations are not required to implement this method in any meaningful * way; this may be a no-operation, and implementations may throw an * {@link UnsupportedOperationException}. - * + * * @param in The buffer of new random bytes to add. */ void addRandomBytes(byte[] in); @@ -156,7 +156,7 @@ public interface IRandom * Implementations are not required to implement this method in any meaningful * way; this may be a no-operation, and implementations may throw an * {@link UnsupportedOperationException}. - * + * * @param in The buffer of new random bytes to add. * @param offset The offset from whence to begin reading random bytes. * @param length The number of random bytes to add. @@ -167,7 +167,7 @@ public interface IRandom /** * Returns a clone copy of this instance. - * + * * @return a clone copy of this instance. */ Object clone() throws CloneNotSupportedException; diff --git a/gnu/java/security/prng/LimitReachedException.java b/gnu/java/security/prng/LimitReachedException.java index 8d5b30baf..028c74553 100644 --- a/gnu/java/security/prng/LimitReachedException.java +++ b/gnu/java/security/prng/LimitReachedException.java @@ -1,4 +1,4 @@ -/* LimitReachedException.java -- +/* LimitReachedException.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/prng/MDGenerator.java b/gnu/java/security/prng/MDGenerator.java index 574a2f9d6..b110486f4 100644 --- a/gnu/java/security/prng/MDGenerator.java +++ b/gnu/java/security/prng/MDGenerator.java @@ -1,4 +1,4 @@ -/* MDGenerator.java -- +/* MDGenerator.java -- Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/prng/PRNGFactory.java b/gnu/java/security/prng/PRNGFactory.java index ae15d053b..b57d7c7bb 100644 --- a/gnu/java/security/prng/PRNGFactory.java +++ b/gnu/java/security/prng/PRNGFactory.java @@ -1,4 +1,4 @@ -/* PRNGFactory.java -- +/* PRNGFactory.java -- Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -57,7 +57,7 @@ public class PRNGFactory /** * Returns an instance of a padding algorithm given its name. - * + * * @param prng the case-insensitive name of the PRNG. * @return an instance of the pseudo-random number generator. * @exception InternalError if the implementation does not pass its self- @@ -79,7 +79,7 @@ public class PRNGFactory /** * Returns a {@link Set} of names of padding algorithms supported by this * <i>Factory</i>. - * + * * @return a {@link Set} of pseudo-random number generator algorithm names * (Strings). */ diff --git a/gnu/java/security/prng/RandomEventListener.java b/gnu/java/security/prng/RandomEventListener.java index beb9087f4..720f2afe4 100644 --- a/gnu/java/security/prng/RandomEventListener.java +++ b/gnu/java/security/prng/RandomEventListener.java @@ -1,4 +1,4 @@ -/* RandomEventListener.java -- +/* RandomEventListener.java -- Copyright (C) 2004, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/provider/DefaultPolicy.java b/gnu/java/security/provider/DefaultPolicy.java index d42be6c90..566c949da 100644 --- a/gnu/java/security/provider/DefaultPolicy.java +++ b/gnu/java/security/provider/DefaultPolicy.java @@ -7,7 +7,7 @@ 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 @@ -44,7 +44,7 @@ import java.security.PermissionCollection; import java.security.Permissions; import java.security.Policy; -/** +/** * This is just a stub policy implementation which grants all permissions * to any code source. FIXME: This should be replaced with a real * implementation that reads the policy configuration from a file, like @@ -60,7 +60,7 @@ public class DefaultPolicy extends Policy perms.add(allPermission); return perms; } - + public void refresh() { // Nothing. diff --git a/gnu/java/security/provider/PKIXCertPathValidatorImpl.java b/gnu/java/security/provider/PKIXCertPathValidatorImpl.java index cdfad3f61..d4ce4aeb4 100644 --- a/gnu/java/security/provider/PKIXCertPathValidatorImpl.java +++ b/gnu/java/security/provider/PKIXCertPathValidatorImpl.java @@ -91,7 +91,7 @@ import java.util.logging.Logger; * See <a href="http://www.ietf.org/rfc/rfc3280.txt">RFC 3280: Internet X.509 * Public Key Infrastructure Certificate and Certificate Revocation List (CRL) * Profile</a>. - * + * * @author Casey Marshall (rsdio@metastatic.org) */ public class PKIXCertPathValidatorImpl @@ -403,7 +403,7 @@ public class PKIXCertPathValidatorImpl * <li>The CRL is signed by a certificate in the given cert stores, and that * cert is signed by one of the certificates in the path.</li> * </ol> - * + * * @param crl The CRL being checked. * @param path The path this CRL is being checked against. * @param now The value to use as 'now'. diff --git a/gnu/java/security/sig/BaseSignature.java b/gnu/java/security/sig/BaseSignature.java index 9c76cacba..ef4d87f26 100644 --- a/gnu/java/security/sig/BaseSignature.java +++ b/gnu/java/security/sig/BaseSignature.java @@ -1,4 +1,4 @@ -/* BaseSignature.java -- +/* BaseSignature.java -- Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -77,7 +77,7 @@ public abstract class BaseSignature /** * Trivial constructor. - * + * * @param schemeName the name of this signature scheme. * @param md the underlying instance of the message digest algorithm. * @throws IllegalArgumentException if the designated hash instance is @@ -174,7 +174,7 @@ public abstract class BaseSignature /** * Fills the designated byte array with random data. - * + * * @param buffer the byte array to fill with random data. */ protected void nextRandomBytes(byte[] buffer) diff --git a/gnu/java/security/sig/ISignature.java b/gnu/java/security/sig/ISignature.java index ff25f29d9..be98f9a9b 100644 --- a/gnu/java/security/sig/ISignature.java +++ b/gnu/java/security/sig/ISignature.java @@ -1,4 +1,4 @@ -/* ISignature.java -- +/* ISignature.java -- Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -75,14 +75,14 @@ public interface ISignature /** * Returns the canonical name of this signature scheme. - * + * * @return the canonical name of this instance. */ String name(); /** * Initialises this instance for signature verification. - * + * * @param attributes the attributes to use for setting up this instance. * @throws IllegalArgumentException if the designated public key is not * appropriate for this signature scheme. @@ -93,7 +93,7 @@ public interface ISignature /** * Initialises this instance for signature generation. - * + * * @param attributes the attributes to use for setting up this instance. * @throws IllegalArgumentException if the designated private key is not * appropriate for this signature scheme. @@ -104,7 +104,7 @@ public interface ISignature /** * Digests one byte of a message for signing or verification purposes. - * + * * @param b the message byte to digest. * @throws IllegalStateException if this instance was not setup for signature * generation/verification. @@ -114,7 +114,7 @@ public interface ISignature /** * Digests a sequence of bytes from a message for signing or verification * purposes. - * + * * @param buffer the byte sequence to consider. * @param offset the byte poisition in <code>buffer</code> of the first byte * to consider. @@ -129,7 +129,7 @@ public interface ISignature /** * Terminates a signature generation phase by digesting and processing the * context of the underlying message digest algorithm instance. - * + * * @return a {@link Object} representing the native output of the signature * scheme implementation. * @throws IllegalStateException if this instance was not setup for signature @@ -140,7 +140,7 @@ public interface ISignature /** * Terminates a signature verification phase by digesting and processing the * context of the underlying message digest algorithm instance. - * + * * @param signature a native signature object previously generated by an * invocation of the <code>sign()</code> method. * @return <code>true</code> iff the outpout of the verification phase @@ -153,7 +153,7 @@ public interface ISignature /** * Returns a clone copy of this instance. - * + * * @return a clone copy of this instance. */ Object clone(); diff --git a/gnu/java/security/sig/ISignatureCodec.java b/gnu/java/security/sig/ISignatureCodec.java index aaae6ccb0..f8b147361 100644 --- a/gnu/java/security/sig/ISignatureCodec.java +++ b/gnu/java/security/sig/ISignatureCodec.java @@ -1,4 +1,4 @@ -/* ISignatureCodec.java -- +/* ISignatureCodec.java -- Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/sig/SignatureCodecFactory.java b/gnu/java/security/sig/SignatureCodecFactory.java index c5b2ccd4b..0026ad164 100644 --- a/gnu/java/security/sig/SignatureCodecFactory.java +++ b/gnu/java/security/sig/SignatureCodecFactory.java @@ -74,7 +74,7 @@ public class SignatureCodecFactory * When the encoding format name is missing, the Raw encoding format is * assumed. When this is the case the trailing forward slash is discarded from * the name. - * + * * @param name the case-insensitive, possibly composed, signature codec name. * @return an instance of the signaturecodec, or <code>null</code> if none * found. @@ -107,7 +107,7 @@ public class SignatureCodecFactory /** * Returns an instance of a signature codec given the canonical name of the * signature algorithm, and that of the encoding format. - * + * * @param name the case-insensitive signature algorithm name. * @param format the name of the format to use when encodigng/decoding * signatures generated by the named algorithm. @@ -127,7 +127,7 @@ public class SignatureCodecFactory * Returns an instance of a signature codec given the canonical name of the * signature algorithm, and the identifier of the format to use when * encoding/decoding signatures generated by that algorithm. - * + * * @param name the case-insensitive signature algorithm name. * @param formatID the identifier of the format to use when encoding / * decoding signatures generated by the designated algorithm. diff --git a/gnu/java/security/sig/SignatureFactory.java b/gnu/java/security/sig/SignatureFactory.java index 28b68925b..6cdaf6544 100644 --- a/gnu/java/security/sig/SignatureFactory.java +++ b/gnu/java/security/sig/SignatureFactory.java @@ -1,4 +1,4 @@ -/* SignatureFactory.java -- +/* SignatureFactory.java -- Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -61,7 +61,7 @@ public class SignatureFactory /** * Returns an instance of a signature-with-appendix scheme given its name. - * + * * @param ssa the case-insensitive signature-with-appendix scheme name. * @return an instance of the scheme, or <code>null</code> if none found. */ @@ -84,7 +84,7 @@ public class SignatureFactory /** * Returns a {@link Set} of signature-with-appendix scheme names supported by * this <i>Factory</i>. - * + * * @return a {@link Set} of signature-with-appendix scheme names (Strings). */ public static synchronized final Set getNames() diff --git a/gnu/java/security/sig/dss/DSSSignature.java b/gnu/java/security/sig/dss/DSSSignature.java index 1ef1bea1a..024521ba4 100644 --- a/gnu/java/security/sig/dss/DSSSignature.java +++ b/gnu/java/security/sig/dss/DSSSignature.java @@ -1,4 +1,4 @@ -/* DSSSignature.java -- +/* DSSSignature.java -- Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -211,7 +211,7 @@ public class DSSSignature /** * Returns the output of a signature generation phase. - * + * * @return an object encapsulating the DSS signature pair <code>r</code> and * <code>s</code>. */ @@ -223,7 +223,7 @@ public class DSSSignature /** * Returns the output of a previously generated signature object as a pair of * {@link java.math.BigInteger}. - * + * * @return the DSS signature pair <code>r</code> and <code>s</code>. */ private BigInteger[] decodeSignature(Object signature) diff --git a/gnu/java/security/sig/dss/DSSSignatureRawCodec.java b/gnu/java/security/sig/dss/DSSSignatureRawCodec.java index 903d7aad6..169f84bd1 100644 --- a/gnu/java/security/sig/dss/DSSSignatureRawCodec.java +++ b/gnu/java/security/sig/dss/DSSSignatureRawCodec.java @@ -1,4 +1,4 @@ -/* DSSSignatureRawCodec.java -- +/* DSSSignatureRawCodec.java -- Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -78,7 +78,7 @@ public class DSSSignatureRawCodec * the <code>toByteArray()</code> method on the DSS parameter <code>s</code>. * </li> * </ol> - * + * * @param signature the signature to encode, consisting of the two DSS * parameters <code>r</code> and <code>s</code> as a * {@link BigInteger} array. diff --git a/gnu/java/security/sig/dss/DSSSignatureX509Codec.java b/gnu/java/security/sig/dss/DSSSignatureX509Codec.java index 0fdb754a9..d0a0188fb 100644 --- a/gnu/java/security/sig/dss/DSSSignatureX509Codec.java +++ b/gnu/java/security/sig/dss/DSSSignatureX509Codec.java @@ -60,7 +60,7 @@ import java.util.ArrayList; * <p> * Digital signatures when transmitted in an X.509 certificates are encoded * in DER (Distinguished Encoding Rules) as a BIT STRING; i.e. - * + * * <pre> * Certificate ::= SEQUENCE { * tbsCertificate TBSCertificate, @@ -77,7 +77,7 @@ import java.util.ArrayList; * generates two MPIs, commonly called <code>r</code> and <code>s</code>, as the * result of digitally signing a message, these two numbers will be transferred * as the following ASN.1 structure: - * + * * <pre> * Dss-Sig-Value ::= SEQUENCE { * r INTEGER, @@ -112,7 +112,7 @@ public class DSSSignatureX509Codec * Encodes a DSS Signature output as the <i>signature</i> raw bytes which can * be used to construct an ASN.1 DER-encoded BIT STRING as defined in the * documentation of this class. - * + * * @param signature the output of the DSS signature algorithm; i.e. the value * returned by the invocation of * {@link gnu.java.security.sig.ISignature#sign()} method. In the @@ -154,7 +154,7 @@ public class DSSSignatureX509Codec /** * Decodes a <i>signature</i> as defined in the documentation of this class. - * + * * @param input the byte array to unmarshall into a valid DSS signature * instance; i.e. an array of two MPIs. MUST NOT be null. * @return an array of two MPIs, <code>r</code> and <code>s</code> in this diff --git a/gnu/java/security/sig/rsa/EME_PKCS1_V1_5.java b/gnu/java/security/sig/rsa/EME_PKCS1_V1_5.java index 39de01f02..329ca8ed6 100644 --- a/gnu/java/security/sig/rsa/EME_PKCS1_V1_5.java +++ b/gnu/java/security/sig/rsa/EME_PKCS1_V1_5.java @@ -1,4 +1,4 @@ -/* EME_PKCS1_V1_5.java -- +/* EME_PKCS1_V1_5.java -- Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -104,7 +104,7 @@ public class EME_PKCS1_V1_5 * </pre> * <p> * This method uses a default PRNG to obtain the padding bytes. - * + * * @param M the message to encode. * @return the encoded message <code>EM</code>. */ @@ -133,7 +133,7 @@ public class EME_PKCS1_V1_5 * Similar to {@link #encode(byte[])} method, except that the source of * randomness to use for obtaining the padding bytes (an instance of * {@link IRandom}) is given as a parameter. - * + * * @param M the message to encode. * @param irnd the {@link IRandom} instance to use as a source of randomness. * @return the encoded message <code>EM</code>. @@ -173,7 +173,7 @@ public class EME_PKCS1_V1_5 /** * Similar to the {@link #encode(byte[], IRandom)} method, except that the * source of randmoness is an instance of {@link Random}. - * + * * @param M the message to encode. * @param rnd the {@link Random} instance to use as a source of randomness. * @return the encoded message <code>EM</code>. @@ -213,7 +213,7 @@ public class EME_PKCS1_V1_5 * hexadecimal value <code>0x00</code> to separate <code>PS</code> from * <code>M</code>, or if the length of <code>PS</code> is less than * <code>8</code> octets, output "decryption error" and stop. - * + * * @param EM the designated encoded message. * @return the decoded message <code>M</code> framed in the designated * <code>EM</code> value. diff --git a/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java b/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java index a0c4de17f..3cddab4aa 100644 --- a/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java +++ b/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java @@ -1,4 +1,4 @@ -/* EMSA_PKCS1_V1_5.java -- +/* EMSA_PKCS1_V1_5.java -- Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. diff --git a/gnu/java/security/sig/rsa/EMSA_PSS.java b/gnu/java/security/sig/rsa/EMSA_PSS.java index 97b3afcf8..917d96323 100644 --- a/gnu/java/security/sig/rsa/EMSA_PSS.java +++ b/gnu/java/security/sig/rsa/EMSA_PSS.java @@ -1,4 +1,4 @@ -/* EMSA_PSS.java -- +/* EMSA_PSS.java -- Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -83,7 +83,7 @@ public class EMSA_PSS /** * Trivial private constructor to enforce use through Factory method. - * + * * @param hash the message digest instance to use with this scheme instance. */ private EMSA_PSS(IMessageDigest hash) @@ -97,7 +97,7 @@ public class EMSA_PSS /** * Returns an instance of this object given a designated name of a hash * function. - * + * * @param mdName the canonical name of a hash function. * @return an instance of this object configured for use with the designated * options. @@ -118,7 +118,7 @@ public class EMSA_PSS * <code>M</code> using a hash function and maps the result to an encoded * message <code>EM</code> of a specified length using a mask generation * function. - * + * * @param mHash the byte sequence resulting from applying the message digest * algorithm Hash to the message <i>M</i>. * @param emBits the maximal bit length of the integer OS2IP(EM), at least @@ -192,7 +192,7 @@ public class EMSA_PSS * The decoding operation EMSA-PSS-Decode recovers the message hash from an * encoded message <code>EM</code> and compares it to the hash of * <code>M</code>. - * + * * @param mHash the byte sequence resulting from applying the message digest * algorithm Hash to the message <i>M</i>. * @param EM the <i>encoded message</i>, an octet string of length @@ -324,7 +324,7 @@ public class EMSA_PSS * the output. The provable security of RSA-PSS relies on the random nature of * the output of the mask generation function, which in turn relies on the * random nature of the underlying hash function. - * + * * @param Z a seed. * @param l the desired output length in octets. * @return the mask. diff --git a/gnu/java/security/sig/rsa/RSA.java b/gnu/java/security/sig/rsa/RSA.java index cdd9eaa5b..343b2cf65 100644 --- a/gnu/java/security/sig/rsa/RSA.java +++ b/gnu/java/security/sig/rsa/RSA.java @@ -1,4 +1,4 @@ -/* RSA.java -- +/* RSA.java -- Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -87,7 +87,7 @@ public class RSA * RSA private key is a valid one, this method computes a <i>signature * representative</i> for a designated <i>message representative</i> signed * by the holder of the designated RSA private key. - * + * * @param K the RSA private key. * @param m the <i>message representative</i>: an integer between * <code>0</code> and <code>n - 1</code>, where <code>n</code> @@ -117,7 +117,7 @@ public class RSA * representative</i> for the designated <i>signature representative</i> * generated by an RSA private key, for a message intended for the holder of * the designated RSA public key. - * + * * @param K the RSA public key. * @param s the <i>signature representative</i>, an integer between * <code>0</code> and <code>n - 1</code>, where <code>n</code> @@ -143,7 +143,7 @@ public class RSA /** * An implementation of the <code>RSAEP</code> algorithm. - * + * * @param K the recipient's RSA public key. * @param m the message representative as an MPI. * @return the resulting MPI --an MPI between <code>0</code> and @@ -170,7 +170,7 @@ public class RSA /** * An implementation of the <code>RSADP</code> algorithm. - * + * * @param K the recipient's RSA private key. * @param c the ciphertext representative as an MPI. * @return the message representative, an MPI between <code>0</code> and @@ -197,7 +197,7 @@ public class RSA /** * Converts a <i>multi-precision integer</i> (MPI) <code>s</code> into an * octet sequence of length <code>k</code>. - * + * * @param s the multi-precision integer to convert. * @param k the length of the output. * @return the result of the transform. @@ -302,7 +302,7 @@ public class RSA /** * Returns a random MPI with a random bit-length of the form <code>8b</code>, * where <code>b</code> is in the range <code>[32..64]</code>. - * + * * @return a random MPI whose length in bytes is between 32 and 64 inclusive. */ private static final BigInteger newR(final BigInteger N) diff --git a/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java b/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java index 76460c0ca..1420331de 100644 --- a/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java +++ b/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java @@ -1,4 +1,4 @@ -/* RSAPKCS1V1_5Signature.java -- +/* RSAPKCS1V1_5Signature.java -- Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -85,7 +85,7 @@ public class RSAPKCS1V1_5Signature /** * Constructs an instance of this object using the designated message digest * algorithm as its underlying hash function. - * + * * @param mdName the canonical name of the underlying hash function. */ public RSAPKCS1V1_5Signature(final String mdName) diff --git a/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureRawCodec.java b/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureRawCodec.java index 68c1edaa6..548dc3deb 100644 --- a/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureRawCodec.java +++ b/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureRawCodec.java @@ -71,7 +71,7 @@ public class RSAPKCS1V1_5SignatureRawCodec * signature bytes in internet order,</li> * <li>the RSA-PKCS#1 (v1.5) signature bytes in internet order.</li> * </ol> - * + * * @param signature the signature to encode, consisting of the output of the * <code>sign()</code> method of a {@link RSAPKCS1V1_5Signature} * instance --a byte array. @@ -116,7 +116,7 @@ public class RSAPKCS1V1_5SignatureRawCodec /** * Returns the decoded object from a designated input assumed to have been * generated by the {@link #encodeSignature(Object)} method. - * + * * @param input the input bytes of a previously Raw-encoded RSA PKCS1 (v1.5) * signature. * @return the signature object. diff --git a/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureX509Codec.java b/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureX509Codec.java index 3cb375602..ee8586f7d 100644 --- a/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureX509Codec.java +++ b/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureX509Codec.java @@ -51,7 +51,7 @@ import java.security.InvalidParameterException; * <p> * Digital signatures when transmitted in an X.509 certificates are encoded * in DER (Distinguished Encoding Rules) as a BIT STRING; i.e. - * + * * <pre> * Certificate ::= SEQUENCE { * tbsCertificate TBSCertificate, @@ -95,7 +95,7 @@ public class RSAPKCS1V1_5SignatureX509Codec /** * Encodes an RSA Signature output as a <i>signature</i> BIT STRING as * defined in the documentation of this class. - * + * * @param signature the output of the RSA PKCS1 (v1.5) signature algorithm; * i.e. the value returned by the invocation of * {@link gnu.java.security.sig.ISignature#sign()} method. In the @@ -111,7 +111,7 @@ public class RSAPKCS1V1_5SignatureX509Codec /** * Decodes a <i>signature</i> as defined in the documentation of this class. - * + * * @param input the byte array to unmarshall into a valid RSA PKCS1 (v1.5) * signature instance; i.e. a byte array. MUST NOT be null. * @return an array of raw bytes decoded from the designated input. In the diff --git a/gnu/java/security/sig/rsa/RSAPSSSignature.java b/gnu/java/security/sig/rsa/RSAPSSSignature.java index 27c7fe620..d8f8327f1 100644 --- a/gnu/java/security/sig/rsa/RSAPSSSignature.java +++ b/gnu/java/security/sig/rsa/RSAPSSSignature.java @@ -1,4 +1,4 @@ -/* RSAPSSSignature.java -- +/* RSAPSSSignature.java -- Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -95,7 +95,7 @@ public class RSAPSSSignature /** * Constructs an instance of this object using the designated message digest * algorithm as its underlying hash function, and having 0-octet <i>salt</i>. - * + * * @param mdName the canonical name of the underlying hash function. */ public RSAPSSSignature(String mdName) @@ -106,7 +106,7 @@ public class RSAPSSSignature /** * Constructs an instance of this object using the designated message digest * algorithm as its underlying hash function. - * + * * @param mdName the canonical name of the underlying hash function. * @param sLen the desired length in octets of the salt to use for encoding / * decoding signatures. diff --git a/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java b/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java index b5e059c20..b147ea3ea 100644 --- a/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java +++ b/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java @@ -1,4 +1,4 @@ -/* RSAPSSSignatureRawCodec.java -- +/* RSAPSSSignatureRawCodec.java -- Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -72,7 +72,7 @@ public class RSAPSSSignatureRawCodec * bytes in internet order,</li> * <li>the RSA-PSS signature bytes in internet order.</li> * </ol> - * + * * @param signature the signature to encode, consisting of the output of the * <code>sign()</code> method of a {@link RSAPSSSignature} instance * --a byte array. diff --git a/gnu/java/security/sig/rsa/RSASignatureFactory.java b/gnu/java/security/sig/rsa/RSASignatureFactory.java index b8e12caf7..ba5121b46 100644 --- a/gnu/java/security/sig/rsa/RSASignatureFactory.java +++ b/gnu/java/security/sig/rsa/RSASignatureFactory.java @@ -71,7 +71,7 @@ public class RSASignatureFactory * hyphen chanaracter <code>-</code> followed by the canonical message digest * algorithm name. When no message digest algorithm name is given, SHA-160 is * used. - * + * * @param name the composite RSA signature name. * @return a new instance of an RSA Signature algorithm implementation. * Returns <code>null</code> if the given name does not correspond to any @@ -102,7 +102,7 @@ public class RSASignatureFactory /** * Returns a {@link Set} of names of <i>RSA</i> signatures supported by this * <i>Factory</i>. - * + * * @return a {@link Set} of RSA Signature algorithm names (Strings). */ public static synchronized final Set getNames() diff --git a/gnu/java/security/util/ByteArray.java b/gnu/java/security/util/ByteArray.java index 514492043..a9b9e5d00 100644 --- a/gnu/java/security/util/ByteArray.java +++ b/gnu/java/security/util/ByteArray.java @@ -65,23 +65,23 @@ public final class ByteArray int len = value.length; while (i < len) { - out.print (formatInt (i, 16, 8)); - out.print (" "); - int l = Math.min (16, len - i); - String s = toHexString (value, i, l, ' '); - out.print (s); - for (int j = 56 - (56 - s.length ()); j < 56; j++) - out.print (" "); - for (int j = 0; j < l; j++) - { - byte b = value[i+j]; - if ((b & 0xFF) < 0x20 || (b & 0xFF) > 0x7E) - out.print ("."); - else - out.print ((char) (b & 0xFF)); - } - out.println (); - i += 16; + out.print (formatInt (i, 16, 8)); + out.print (" "); + int l = Math.min (16, len - i); + String s = toHexString (value, i, l, ' '); + out.print (s); + for (int j = 56 - (56 - s.length ()); j < 56; j++) + out.print (" "); + for (int j = 0; j < l; j++) + { + byte b = value[i+j]; + if ((b & 0xFF) < 0x20 || (b & 0xFF) > 0x7E) + out.print ("."); + else + out.print ((char) (b & 0xFF)); + } + out.println (); + i += 16; } return str.toString (); } @@ -91,8 +91,8 @@ public final class ByteArray CPStringBuilder str = new CPStringBuilder(); for (int i = 0; i < len; i++) { - str.append (Character.forDigit (buf[i+off] >>> 4 & 0x0F, 16)); - str.append (Character.forDigit (buf[i+off] & 0x0F, 16)); + str.append (Character.forDigit (buf[i+off] >>> 4 & 0x0F, 16)); + str.append (Character.forDigit (buf[i+off] & 0x0F, 16)); if (i < len - 1) str.append(sep); } diff --git a/gnu/java/security/util/ByteBufferOutputStream.java b/gnu/java/security/util/ByteBufferOutputStream.java index be4d0a98d..642ccdf68 100644 --- a/gnu/java/security/util/ByteBufferOutputStream.java +++ b/gnu/java/security/util/ByteBufferOutputStream.java @@ -47,18 +47,18 @@ import java.nio.ByteBuffer; /** * An output stream that writes bytes to a ByteBuffer, which will be resized * if more space is needed. - * + * * @author Casey Marshall (csm@gnu.org) */ public class ByteBufferOutputStream extends OutputStream { private ByteBuffer buffer; - + public ByteBufferOutputStream() { this(256); } - + public ByteBufferOutputStream(int initialCapacity) { buffer = ByteBuffer.allocate(initialCapacity); @@ -71,16 +71,16 @@ public class ByteBufferOutputStream extends OutputStream { if (!buffer.hasRemaining()) growBuffer(); - buffer.put((byte) b); + buffer.put((byte) b); } - + public @Override synchronized void write(byte[] b, int offset, int length) { if (buffer.remaining() < length) growBuffer(); buffer.put(b, offset, length); } - + public @Override void write(byte[] b) { write(b, 0, b.length); @@ -90,19 +90,19 @@ public class ByteBufferOutputStream extends OutputStream * Get the current state of the buffer. The returned buffer will have * its position set to zero, its capacity set to the current limit, * and its limit set to its capacity. - * + * * @return The buffer. */ public ByteBuffer buffer() { return ((ByteBuffer) buffer.duplicate().flip()).slice(); } - + public String toString() { return super.toString() + " [ buffer: " + buffer + " ]"; } - + private void growBuffer() { int newCapacity = buffer.capacity(); diff --git a/gnu/java/security/util/ExpirableObject.java b/gnu/java/security/util/ExpirableObject.java index e0c4e6b59..e24af249a 100644 --- a/gnu/java/security/util/ExpirableObject.java +++ b/gnu/java/security/util/ExpirableObject.java @@ -57,7 +57,7 @@ import javax.security.auth.Destroyable; * <p> * Note that if a {@link DestroyFailedException} occurs when the timeout * expires, it will not be reported. - * + * * @see Destroyable */ public abstract class ExpirableObject @@ -89,7 +89,7 @@ public abstract class ExpirableObject /** * Create a new expirable object that will expire after the specified timeout. - * + * * @param delay The delay before expiration. * @throws IllegalArgumentException If <i>delay</i> is negative, or if * <code>delay + System.currentTimeMillis()</code> is negative. @@ -104,7 +104,7 @@ public abstract class ExpirableObject * Destroys this object. This method calls {@link #doDestroy}, then, if no * exception is thrown, cancels the task that would destroy this object when * the timeout is reached. - * + * * @throws DestroyFailedException If this operation fails. */ public final void destroy() throws DestroyFailedException @@ -116,7 +116,7 @@ public abstract class ExpirableObject /** * Subclasses must implement this method instead of the {@link * Destroyable#destroy()} method. - * + * * @throws DestroyFailedException If this operation fails. */ protected abstract void doDestroy() throws DestroyFailedException; diff --git a/gnu/java/security/util/FormatUtil.java b/gnu/java/security/util/FormatUtil.java index eed669cc3..35da322b8 100644 --- a/gnu/java/security/util/FormatUtil.java +++ b/gnu/java/security/util/FormatUtil.java @@ -53,7 +53,7 @@ public class FormatUtil /** * Returns the fully qualified name of the designated encoding ID. - * + * * @param formatID the unique identifier of the encoding format. * @return the fully qualified name of the designated format. Returns * <code>null</code> if no such encoding format is known. @@ -83,7 +83,7 @@ public class FormatUtil /** * Returns the short name of the designated encoding ID. This is used by the * JCE Adapters. - * + * * @param formatID the unique identifier of the encoding format. * @return the short name of the designated format. Returns <code>null</code> * if no such encoding format is known. @@ -112,7 +112,7 @@ public class FormatUtil /** * Returns the identifier of the encoding format given its short name. - * + * * @param name the case-insensitive canonical short name of an encoding * format. * @return the identifier of the designated encoding format, or <code>0</code> @@ -134,7 +134,7 @@ public class FormatUtil result = Registry.X509_ENCODING_ID; else if (name.equalsIgnoreCase(Registry.PKCS8_ENCODING_SHORT_NAME)) result = Registry.PKCS8_ENCODING_ID; - + return result; } } diff --git a/gnu/java/security/util/IntegerUtil.java b/gnu/java/security/util/IntegerUtil.java index f07130808..106dc4d66 100644 --- a/gnu/java/security/util/IntegerUtil.java +++ b/gnu/java/security/util/IntegerUtil.java @@ -71,7 +71,7 @@ public abstract class IntegerUtil * This method MUST be used in the gnu.java.security and gnu.javax.crypto * packages to ensure they would work with a version 1.4 only of the Java * class library API. - * + * * @param aString a string representation of an integer. * @return the {@link Integer} object representing the designated string. */ @@ -98,7 +98,7 @@ public abstract class IntegerUtil * This method MUST be used in the gnu.java.security and gnu.javax.crypto * packages to ensure they would work with a version 1.4 only of the Java * class library API. - * + * * @param anInt a decimal integer. * @return the {@link Integer} object representing the designated primitive. */ diff --git a/gnu/java/security/util/PRNG.java b/gnu/java/security/util/PRNG.java index 7bb27cbf4..1bed04dcd 100644 --- a/gnu/java/security/util/PRNG.java +++ b/gnu/java/security/util/PRNG.java @@ -47,7 +47,7 @@ import gnu.java.security.prng.MDGenerator; /** * A useful hash-based (SHA) pseudo-random number generator used throughout this * library. - * + * * @see MDGenerator */ public class PRNG @@ -57,7 +57,7 @@ public class PRNG /** * Private constructor to enforce using the Factory method. - * + * * @param delegate the undelying {@link IRandom} object used. */ private PRNG(IRandom delegate) @@ -93,7 +93,7 @@ public class PRNG /** * Completely fills the designated <code>buffer</code> with random data * generated by the underlying delegate. - * + * * @param buffer the place holder of random bytes generated by the underlying * delegate. On output, the contents of <code>buffer</code> are * replaced with pseudo-random data, iff the <code>buffer</code> @@ -108,7 +108,7 @@ public class PRNG * Fills the designated <code>buffer</code>, starting from byte at position * <code>offset</code> with, at most, <code>length</code> bytes of random * data generated by the underlying delegate. - * + * * @see IRandom#nextBytes */ public void nextBytes(byte[] buffer, int offset, int length) diff --git a/gnu/java/security/util/Prime.java b/gnu/java/security/util/Prime.java index e493ce675..82c584ff4 100644 --- a/gnu/java/security/util/Prime.java +++ b/gnu/java/security/util/Prime.java @@ -7,7 +7,7 @@ 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 @@ -55,49 +55,49 @@ public final class Prime BigInteger p = new BigInteger( (pmax + pmin)/2, new Random() ); if( p.compareTo( BigInteger.valueOf( 1 ).shiftLeft( pmin ) ) <= 0 ) { - p = p.add( BigInteger.valueOf( 1 ).shiftLeft( pmin ).subtract( p ) ); + p = p.add( BigInteger.valueOf( 1 ).shiftLeft( pmin ).subtract( p ) ); } - + //Step 2 - test for even if( p.mod( BigInteger.valueOf(2) ).compareTo( BigInteger.valueOf( 0 )) == 0) p = p.add( BigInteger.valueOf( 1 ) ); for(;;) { - //Step 3 - if( p.compareTo( BigInteger.valueOf( 1 ).shiftLeft( pmax)) > 0) - { - //Step 3.1 - p = p.subtract( BigInteger.valueOf( 1 ).shiftLeft( pmax) ); - p = p.add( BigInteger.valueOf( 1 ).shiftLeft( pmin) ); - p = p.subtract( BigInteger.valueOf( 1 ) ); - - //Step 3.2 - // put step 2 code here so looping code is cleaner - //Step 2 - test for even - if( p.mod( BigInteger.valueOf(2) ).compareTo( BigInteger.valueOf( 0 )) == 0) - p = p.add( BigInteger.valueOf( 1 ) ); - continue; - } - - //Step 4 - compute GCD - d = p.subtract( BigInteger.valueOf(1) ); - d = d.gcd( f ); - - //Step 5 - test d - if( d.compareTo( BigInteger.valueOf( 1 ) ) == 0) - { - //Step 5.1 - test primality - if( p.isProbablePrime( 1 ) == true ) - { - //Step 5.2; - return p; - } - } - //Step 6 - p = p.add( BigInteger.valueOf( 2 ) ); - - //Step 7 + //Step 3 + if( p.compareTo( BigInteger.valueOf( 1 ).shiftLeft( pmax)) > 0) + { + //Step 3.1 + p = p.subtract( BigInteger.valueOf( 1 ).shiftLeft( pmax) ); + p = p.add( BigInteger.valueOf( 1 ).shiftLeft( pmin) ); + p = p.subtract( BigInteger.valueOf( 1 ) ); + + //Step 3.2 + // put step 2 code here so looping code is cleaner + //Step 2 - test for even + if( p.mod( BigInteger.valueOf(2) ).compareTo( BigInteger.valueOf( 0 )) == 0) + p = p.add( BigInteger.valueOf( 1 ) ); + continue; + } + + //Step 4 - compute GCD + d = p.subtract( BigInteger.valueOf(1) ); + d = d.gcd( f ); + + //Step 5 - test d + if( d.compareTo( BigInteger.valueOf( 1 ) ) == 0) + { + //Step 5.1 - test primality + if( p.isProbablePrime( 1 ) == true ) + { + //Step 5.2; + return p; + } + } + //Step 6 + p = p.add( BigInteger.valueOf( 2 ) ); + + //Step 7 } } @@ -122,43 +122,43 @@ public final class Prime //Step 4 - test for even if( p.mod( BigInteger.valueOf(2) ).compareTo( BigInteger.valueOf( 0 )) == 0) - p = p.add( r ); + p = p.add( r ); for(;;) - { - //Step 5 - if( p.compareTo( BigInteger.valueOf( 1 ).shiftLeft( pmax)) > 0) - { - //Step 5.1 - p = p.subtract( BigInteger.valueOf( 1 ).shiftLeft( pmax) ); - p = p.add( BigInteger.valueOf( 1 ).shiftLeft( pmin) ); - p = p.subtract( BigInteger.valueOf( 1 ) ); - - //Step 5.2 - goto to Step 2 - break steptwo; - } - - //Step 6 - d = p.subtract( BigInteger.valueOf(1) ); - d = d.gcd( f ); - - //Step 7 - test d - if( d.compareTo( BigInteger.valueOf( 1 ) ) == 0) - { - //Step 7.1 - test primality - if( p.isProbablePrime( 1 ) == true ) - { - //Step 7.2; - return p; - } - } - //Step 8 - p = p.add( r.multiply( BigInteger.valueOf(2) ) ); - - //Step 9 - } + { + //Step 5 + if( p.compareTo( BigInteger.valueOf( 1 ).shiftLeft( pmax)) > 0) + { + //Step 5.1 + p = p.subtract( BigInteger.valueOf( 1 ).shiftLeft( pmax) ); + p = p.add( BigInteger.valueOf( 1 ).shiftLeft( pmin) ); + p = p.subtract( BigInteger.valueOf( 1 ) ); + + //Step 5.2 - goto to Step 2 + break steptwo; + } + + //Step 6 + d = p.subtract( BigInteger.valueOf(1) ); + d = d.gcd( f ); + + //Step 7 - test d + if( d.compareTo( BigInteger.valueOf( 1 ) ) == 0) + { + //Step 7.1 - test primality + if( p.isProbablePrime( 1 ) == true ) + { + //Step 7.2; + return p; + } + } + //Step 8 + p = p.add( r.multiply( BigInteger.valueOf(2) ) ); + + //Step 9 + } } //Should never reach here but makes the compiler happy - return BigInteger.valueOf(0); + return BigInteger.valueOf(0); } } diff --git a/gnu/java/security/util/Sequence.java b/gnu/java/security/util/Sequence.java index 5e3a64eaf..63086d2bd 100644 --- a/gnu/java/security/util/Sequence.java +++ b/gnu/java/security/util/Sequence.java @@ -55,7 +55,7 @@ public final class Sequence * through all positive integers then negative integers until the end value is * reached. Naturally, this will result in an enormous object, so don't do * this. - * + * * @param end The ending value. */ public Sequence(int end) @@ -68,7 +68,7 @@ public final class Sequence * increment of 1. If <i>end</i> is less than <i>start</i>, then the * sequence will wrap around until the end value is reached. Naturally, this * will result in an enormous object, so don't do this. - * + * * @param start The starting value. * @param end The ending value. */ @@ -88,7 +88,7 @@ public final class Sequence * If <i>span</i> is 0, then the sequence will contain {<i>start</i>, * <i>end</i>} if <i>start</i> != <i>end</i>, or just the singleton * <i>start</i> if <i>start</i> == <i>end</i>. - * + * * @param start The starting value. * @param end The ending value. * @param span The increment value. diff --git a/gnu/java/security/util/SimpleList.java b/gnu/java/security/util/SimpleList.java index 74f3bafce..15d54c988 100644 --- a/gnu/java/security/util/SimpleList.java +++ b/gnu/java/security/util/SimpleList.java @@ -54,7 +54,7 @@ public final class SimpleList /** * Create a singleton list. - * + * * @param element The first element. */ public SimpleList(final Object element) @@ -65,7 +65,7 @@ public final class SimpleList /** * Create an ordered pair (2-tuple). - * + * * @param e1 The first element. * @param e2 The second element. */ @@ -78,7 +78,7 @@ public final class SimpleList /** * Create a 3-tuple. - * + * * @param e1 The first element. * @param e2 The second element. * @param e3 The third element. @@ -93,7 +93,7 @@ public final class SimpleList /** * Create a 4-tuple. - * + * * @param e1 The first element. * @param e2 The second element. * @param e3 The third element. @@ -121,7 +121,7 @@ public final class SimpleList * Create an n-tuple of arbitrary size. Even if the supplied collection has no * natural order, the created n-tuple will have the order that the elements * are returned by the collection's iterator. - * + * * @param c The collection. */ public SimpleList(Collection c) diff --git a/gnu/java/security/util/Util.java b/gnu/java/security/util/Util.java index 50d4466d5..ef3d480a0 100644 --- a/gnu/java/security/util/Util.java +++ b/gnu/java/security/util/Util.java @@ -70,7 +70,7 @@ public class Util * <pre> * toString(ba, 0, ba.length); * </pre> - * + * * @param ba the byte array to convert. * @return a string of hexadecimal characters (two for each byte) representing * the designated input byte array. @@ -84,7 +84,7 @@ public class Util * Returns a string of hexadecimal digits from a byte array, starting at * <code>offset</code> and consisting of <code>length</code> bytes. Each * byte is converted to 2 hex symbols; zero(es) included. - * + * * @param ba the byte array to convert. * @param offset the index from which to start considering the bytes to * convert. @@ -114,7 +114,7 @@ public class Util * <pre> * toReversedString(ba, 0, ba.length); * </pre> - * + * * @param ba the byte array to convert. * @return a string of hexadecimal characters (two for each byte) representing * the designated input byte array. @@ -131,7 +131,7 @@ public class Util * <p> * The byte array is treated as a large little-endian integer, and is returned * as a large big-endian integer. - * + * * @param ba the byte array to convert. * @param offset the index from which to start considering the bytes to * convert. @@ -156,7 +156,7 @@ public class Util * <p> * Returns a byte array from a string of hexadecimal digits. * </p> - * + * * @param s a string of hexadecimal ASCII characters * @return the decoded byte array from the input hexadecimal string. */ @@ -179,7 +179,7 @@ public class Util * Returns a byte array from a string of hexadecimal digits, interpreting them * as a large big-endian integer and returning it as a large little-endian * integer. - * + * * @param s a string of hexadecimal ASCII characters * @return the decoded byte array from the input hexadecimal string. */ @@ -201,7 +201,7 @@ public class Util /** * Returns a number from <code>0</code> to <code>15</code> corresponding * to the designated hexadecimal digit. - * + * * @param c a hexadecimal ASCII symbol. */ public static int fromDigit(char c) @@ -219,7 +219,7 @@ public class Util /** * Returns a string of 8 hexadecimal digits (most significant digit first) * corresponding to the unsigned integer <code>n</code>. - * + * * @param n the unsigned integer to convert. * @return a hexadecimal string 8-character long. */ @@ -260,7 +260,7 @@ public class Util /** * Returns a string of 16 hexadecimal digits (most significant digit first) * corresponding to the unsigned long <code>n</code>. - * + * * @param n the unsigned long to convert. * @return a hexadecimal string 16-character long. */ @@ -280,7 +280,7 @@ public class Util * escape character is inserted before every pair of bytes. Useful to * externalise byte arrays that will be constructed later from such strings; * eg. s-box values. - * + * * @throws ArrayIndexOutOfBoundsException if the length is odd. */ public static String toUnicodeString(byte[] ba) @@ -293,7 +293,7 @@ public class Util * escape character is inserted before every pair of bytes. Useful to * externalise byte arrays that will be constructed later from such strings; * eg. s-box values. - * + * * @throws ArrayIndexOutOfBoundsException if the length is odd. */ public static final String toUnicodeString(byte[] ba, int offset, int length) @@ -324,7 +324,7 @@ public class Util * escape character is inserted before every pair of bytes. Useful to * externalise integer arrays that will be constructed later from such * strings; eg. s-box values. - * + * * @throws ArrayIndexOutOfBoundsException if the length is not a multiple of * 4. */ @@ -376,7 +376,7 @@ public class Util * If <code>offset</code> and <code>length</code> are omitted, the whole * array is used. If <code>m</code> is omitted, nothing is prepended to each * line. - * + * * @param data the byte array to be dumped. * @param offset the offset within <i>data</i> to start from. * @param length the number of bytes to dump. @@ -433,7 +433,7 @@ public class Util /** * Returns a string of 2 hexadecimal digits (most significant digit first) * corresponding to the lowest 8 bits of <code>n</code>. - * + * * @param n the byte value to convert. * @return a string of 2 hex characters representing the input. */ @@ -449,7 +449,7 @@ public class Util * '.' (dot) shall be used instead of "+' (plus). * <p> * Used by SASL password file manipulation primitives. - * + * * @param buffer an arbitrary sequence of bytes to represent in Base-64. * @return unpadded (without the '=' character(s)) Base-64 representation of * the input. @@ -525,7 +525,7 @@ public class Util * <p> * Converts a string representing the encoding of some bytes in Base-64 to * their original form. - * + * * @param str the Base-64 encoded representation of some byte(s). * @return the bytes represented by the <code>str</code>. * @throws NumberFormatException if <code>str</code> is <code>null</code>, @@ -597,7 +597,7 @@ public class Util * Treats the input as the MSB representation of a number, and discards * leading zero elements. For efficiency, the input is simply returned if no * leading zeroes are found. - * + * * @param n the {@link BigInteger} to trim. * @return the byte array representation of the designated {@link BigInteger} * with no leading 0-bytes. @@ -618,7 +618,7 @@ public class Util /** * Returns a hexadecimal dump of the trimmed bytes of a {@link BigInteger}. - * + * * @param x the {@link BigInteger} to display. * @return the string representation of the designated {@link BigInteger}. */ diff --git a/gnu/java/security/x509/X509CRLSelectorImpl.java b/gnu/java/security/x509/X509CRLSelectorImpl.java index 0ada55016..582d18583 100644 --- a/gnu/java/security/x509/X509CRLSelectorImpl.java +++ b/gnu/java/security/x509/X509CRLSelectorImpl.java @@ -135,4 +135,3 @@ public class X509CRLSelectorImpl implements CRLSelector return false; } } - diff --git a/gnu/java/security/x509/X509CertSelectorImpl.java b/gnu/java/security/x509/X509CertSelectorImpl.java index 36187ad8e..5201a76b9 100644 --- a/gnu/java/security/x509/X509CertSelectorImpl.java +++ b/gnu/java/security/x509/X509CertSelectorImpl.java @@ -194,4 +194,3 @@ public class X509CertSelectorImpl implements CertSelector return matchIssuer && matchSubject; } } - diff --git a/gnu/java/security/x509/ext/CertificatePolicies.java b/gnu/java/security/x509/ext/CertificatePolicies.java index c451762f8..874b8eeeb 100644 --- a/gnu/java/security/x509/ext/CertificatePolicies.java +++ b/gnu/java/security/x509/ext/CertificatePolicies.java @@ -142,7 +142,7 @@ public class CertificatePolicies extends Extension.Value { return policies; } - + /** * Returns the list of policy OIDs, formatted as dotted-decimal strings. * diff --git a/gnu/java/security/x509/ext/GeneralName.java b/gnu/java/security/x509/ext/GeneralName.java index fbc05339f..f399de1b7 100644 --- a/gnu/java/security/x509/ext/GeneralName.java +++ b/gnu/java/security/x509/ext/GeneralName.java @@ -48,7 +48,7 @@ import java.util.Arrays; /** * The GeneralName structure from X.509. - * + * * <pre> GeneralName ::= CHOICE { otherName [0] OtherName, @@ -87,12 +87,12 @@ public class GeneralName registeredId (8); private int tag; - + private Kind(int tag) { this.tag = tag; } - + public static Kind forTag(final int tag) { switch (tag) @@ -107,10 +107,10 @@ public class GeneralName case 7: return iPAddress; case 8: return registeredId; } - + throw new IllegalArgumentException("invalid tag: " + tag); } - + public int tag() { return tag; @@ -120,17 +120,17 @@ public class GeneralName private final Kind kind; private final byte[] name; private final byte[] encoded; - + public GeneralName(byte[] encoded) throws IOException { DERReader reader = new DERReader(encoded); DERValue value = reader.read(); - + if (value.getTagClass() != DER.CONTEXT) throw new IOException("malformed GeneralName"); - + this.encoded = value.getEncoded(); - + kind = Kind.forTag(value.getTag()); switch (kind) { @@ -176,29 +176,29 @@ public class GeneralName name = value.getEncoded(); name[0] = DER.OBJECT_IDENTIFIER; break; - + default: name = null; // Not reached. } } - + public GeneralName(Kind kind, byte[] name) { this.kind = kind; this.name = (byte[]) name.clone(); this.encoded = null; } - + public Kind kind() { return kind; } - + public byte[] name() { return (byte[]) name.clone(); } - + public byte[] encoded() { try @@ -210,7 +210,7 @@ public class GeneralName return null; } } - + public boolean equals(Object o) { try @@ -223,7 +223,7 @@ public class GeneralName return false; } } - + public String toString() { return (super.toString() + " [ kind=" + kind + "; name=" + diff --git a/gnu/java/security/x509/ext/GeneralSubtree.java b/gnu/java/security/x509/ext/GeneralSubtree.java index 5f6ffd987..5d688deaa 100644 --- a/gnu/java/security/x509/ext/GeneralSubtree.java +++ b/gnu/java/security/x509/ext/GeneralSubtree.java @@ -1,4 +1,4 @@ -/* GeneralSubtree.java -- +/* GeneralSubtree.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -63,20 +63,20 @@ public class GeneralSubtree private final GeneralName base; private final int minimum; private final int maximum; - + public GeneralSubtree(byte[] encoded) throws IOException { DERReader reader = new DERReader(encoded); DERValue generalSubtree = reader.read(); - + if (!generalSubtree.isConstructed()) throw new IOException("malformed GeneralSubtree"); - + DERValue generalName = reader.read(); base = new GeneralName(generalName.getEncoded()); if (generalName.isConstructed()) reader.skip(generalName.getLength()); - + int len = generalName.getEncodedLength(); if (len < generalSubtree.getLength()) { @@ -116,7 +116,7 @@ public class GeneralSubtree maximum = -1; } } - + /** * Returns the base name. * @@ -126,7 +126,7 @@ public class GeneralSubtree { return base; } - + /** * Returns the minimum base distance, possibly zero. * @@ -136,7 +136,7 @@ public class GeneralSubtree { return minimum; } - + /** * Returns the maximum base distance, or -1 if this value was not specified. * @@ -146,7 +146,7 @@ public class GeneralSubtree { return maximum; } - + public String toString() { return (GeneralSubtree.class.getName() + " [ base=" + base diff --git a/gnu/java/security/x509/ext/NameConstraints.java b/gnu/java/security/x509/ext/NameConstraints.java index 607c42966..8f374d560 100644 --- a/gnu/java/security/x509/ext/NameConstraints.java +++ b/gnu/java/security/x509/ext/NameConstraints.java @@ -51,7 +51,7 @@ import java.util.List; /** * The NameConstraints extension. From RFC 3280, section 4.2.1.11, this * extension is defined as: - * + * * <pre> id-ce-nameConstraints OBJECT IDENTIFIER ::= { id-ce 30 } @@ -68,29 +68,29 @@ import java.util.List; BaseDistance ::= INTEGER (0..MAX) </pre> - * + * * See also the classes {@link GeneralNames} and {@link GeneralSubtree}. - * + * * @author csm */ public class NameConstraints extends Value { public static final OID ID = new OID("2.5.29.30"); - + private List<GeneralSubtree> permittedSubtrees; private List<GeneralSubtree> excludedSubtrees; - + public NameConstraints(byte[] encoded) throws IOException { super(encoded); - + DERReader der = new DERReader(encoded); DERValue value = der.read(); if (!value.isConstructed()) { throw new IOException("malformed NameConstraints"); } - + permittedSubtrees = new LinkedList<GeneralSubtree>(); excludedSubtrees = new LinkedList<GeneralSubtree>(); int len = 0; @@ -108,7 +108,7 @@ public class NameConstraints extends Value len2 += subtree.getEncodedLength(); } len += subtrees.getEncodedLength(); - + if (len < value.getLength()) { subtrees = der.read(); @@ -134,24 +134,24 @@ public class NameConstraints extends Value excludedSubtrees.add(new GeneralSubtree(subtree.getEncoded())); der.skip(subtree.getLength()); len2 += subtree.getEncodedLength(); - } + } } else throw new IOException("unexpected tag " + subtrees.getTag() + " (expecting 0 or 1)"); } } - + public List<GeneralSubtree> permittedSubtrees() { return Collections.unmodifiableList(permittedSubtrees); } - + public List<GeneralSubtree> excludedSubtrees() { return Collections.unmodifiableList(excludedSubtrees); } - + public String toString() { return NameConstraints.class.getName() + " [ permittedSubtrees=" diff --git a/gnu/java/text/AttributedFormatBuffer.java b/gnu/java/text/AttributedFormatBuffer.java index c2aae9609..2a89ae097 100644 --- a/gnu/java/text/AttributedFormatBuffer.java +++ b/gnu/java/text/AttributedFormatBuffer.java @@ -7,7 +7,7 @@ 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 @@ -56,13 +56,13 @@ public class AttributedFormatBuffer implements FormatBuffer private final ArrayList ranges; private final ArrayList attributes; private int[] a_ranges; - private HashMap[] a_attributes; + private HashMap[] a_attributes; private int startingRange; AttributedCharacterIterator.Attribute defaultAttr; /** * This constructor accepts a StringBuffer. If the buffer contains - * already some characters they will not be attributed. + * already some characters they will not be attributed. */ public AttributedFormatBuffer(CPStringBuilder buffer) { @@ -72,8 +72,8 @@ public class AttributedFormatBuffer implements FormatBuffer this.defaultAttr = null; if (buffer.length() != 0) { - this.startingRange = buffer.length(); - addAttribute(buffer.length(), null); + this.startingRange = buffer.length(); + addAttribute(buffer.length(), null); } else this.startingRange = -1; @@ -96,16 +96,16 @@ public class AttributedFormatBuffer implements FormatBuffer * * @param new_range A new range to insert in the list. * @param attr A new attribute to insert in the list. - */ + */ private final void addAttribute(int new_range, AttributedCharacterIterator.Attribute attr) { HashMap map; if (attr != null) { - map = new HashMap(); - map.put(attr, attr); - attributes.add(map); + map = new HashMap(); + map.put(attr, attr); + attributes.add(map); } else attributes.add(null); @@ -119,7 +119,7 @@ public class AttributedFormatBuffer implements FormatBuffer startingRange = 0; buffer.append(s); } - + public void append(String s, AttributedCharacterIterator.Attribute attr) { setDefaultAttribute(attr); @@ -135,11 +135,11 @@ public class AttributedFormatBuffer implements FormatBuffer setDefaultAttribute(null); if (ranges != null) { - for (int i = 0; i < ranges.length; i++) - { - this.ranges.add(new Integer(ranges[i] + curPos)); - this.attributes.add(attrs[i]); - } + for (int i = 0; i < ranges.length; i++) + { + this.ranges.add(new Integer(ranges[i] + curPos)); + this.attributes.add(attrs[i]); + } } startingRange = buffer.length(); buffer.append(s); @@ -168,7 +168,7 @@ public class AttributedFormatBuffer implements FormatBuffer if (startingRange != currentPos && startingRange >= 0) { - addAttribute(currentPos, defaultAttr); + addAttribute(currentPos, defaultAttr); } defaultAttr = attr; startingRange = currentPos; @@ -212,7 +212,7 @@ public class AttributedFormatBuffer implements FormatBuffer a_ranges = new int[ranges.size()]; for (int i = 0; i < a_ranges.length; i++) a_ranges[i] = ((Integer)(ranges.get (i))).intValue(); - + a_attributes = new HashMap[attributes.size()]; System.arraycopy(attributes.toArray(), 0, a_attributes, 0, a_attributes.length); } @@ -239,7 +239,7 @@ public class AttributedFormatBuffer implements FormatBuffer } /** - * This method returns the array containing the map on the + * This method returns the array containing the map on the * attributes. * * @return An array of {@link java.util.Map} containing the attributes. diff --git a/gnu/java/text/BaseBreakIterator.java b/gnu/java/text/BaseBreakIterator.java index 4afd8ae66..b69f698a1 100644 --- a/gnu/java/text/BaseBreakIterator.java +++ b/gnu/java/text/BaseBreakIterator.java @@ -7,7 +7,7 @@ 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 @@ -70,7 +70,7 @@ public abstract class BaseBreakIterator extends BreakIterator /** * Return the first boundary after <code>pos</code>. - * This has the side effect of setting the index of the + * This has the side effect of setting the index of the * CharacterIterator. */ public int following (int pos) @@ -98,19 +98,19 @@ public abstract class BaseBreakIterator extends BreakIterator int r = iter.getIndex (); if (n > 0) { - while (n > 0 && r != DONE) - { - r = next (); - --n; - } + while (n > 0 && r != DONE) + { + r = next (); + --n; + } } else if (n < 0) { - while (n < 0 && r != DONE) - { - r = previous (); - ++n; - } + while (n < 0 && r != DONE) + { + r = previous (); + ++n; + } } return r; } diff --git a/gnu/java/text/CharacterBreakIterator.java b/gnu/java/text/CharacterBreakIterator.java index 5274543a9..565eb9b9d 100644 --- a/gnu/java/text/CharacterBreakIterator.java +++ b/gnu/java/text/CharacterBreakIterator.java @@ -7,7 +7,7 @@ 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 @@ -111,44 +111,44 @@ public class CharacterBreakIterator extends BaseBreakIterator char c; for (char prev = CharacterIterator.DONE; iter.getIndex() < end; prev = c) { - c = iter.next(); - if (c == CharacterIterator.DONE) - break; - int type = Character.getType(c); - - // Break after paragraph separators. - if (type == Character.PARAGRAPH_SEPARATOR) - break; - - // Now we need some lookahead. - char ahead = iter.next(); - iter.previous(); - if (ahead == CharacterIterator.DONE) - break; - int aheadType = Character.getType(ahead); - - if (aheadType != Character.NON_SPACING_MARK - && ! isLowSurrogate (ahead) - && ! isLVT (ahead)) - break; - if (! isLVT (c) && isLVT (ahead)) - break; - if (isL (c) && ! isLVT (ahead) - && aheadType != Character.NON_SPACING_MARK) - break; - if (isV (c) && ! isV (ahead) && !isT (ahead) - && aheadType != Character.NON_SPACING_MARK) - break; - if (isT (c) && ! isT (ahead) - && aheadType != Character.NON_SPACING_MARK) - break; - - if (! isHighSurrogate (c) && isLowSurrogate (ahead)) - break; - if (isHighSurrogate (c) && ! isLowSurrogate (ahead)) - break; - if (! isHighSurrogate (prev) && isLowSurrogate (c)) - break; + c = iter.next(); + if (c == CharacterIterator.DONE) + break; + int type = Character.getType(c); + + // Break after paragraph separators. + if (type == Character.PARAGRAPH_SEPARATOR) + break; + + // Now we need some lookahead. + char ahead = iter.next(); + iter.previous(); + if (ahead == CharacterIterator.DONE) + break; + int aheadType = Character.getType(ahead); + + if (aheadType != Character.NON_SPACING_MARK + && ! isLowSurrogate (ahead) + && ! isLVT (ahead)) + break; + if (! isLVT (c) && isLVT (ahead)) + break; + if (isL (c) && ! isLVT (ahead) + && aheadType != Character.NON_SPACING_MARK) + break; + if (isV (c) && ! isV (ahead) && !isT (ahead) + && aheadType != Character.NON_SPACING_MARK) + break; + if (isT (c) && ! isT (ahead) + && aheadType != Character.NON_SPACING_MARK) + break; + + if (! isHighSurrogate (c) && isLowSurrogate (ahead)) + break; + if (isHighSurrogate (c) && ! isLowSurrogate (ahead)) + break; + if (! isHighSurrogate (prev) && isLowSurrogate (c)) + break; } return iter.getIndex(); @@ -161,51 +161,51 @@ public class CharacterBreakIterator extends BaseBreakIterator while (iter.getIndex() >= iter.getBeginIndex()) { - char c = iter.previous(); - if (c == CharacterIterator.DONE) - break; - int type = Character.getType(c); - - if (type != Character.NON_SPACING_MARK - && ! isLowSurrogate (c) - && ! isLVT (c)) - break; - - // Now we need some lookahead. - char ahead = iter.previous(); - if (ahead == CharacterIterator.DONE) - { - iter.next(); - break; - } - char ahead2 = iter.previous(); - iter.next(); - iter.next(); - if (ahead2 == CharacterIterator.DONE) - break; - int aheadType = Character.getType(ahead); - - if (aheadType == Character.PARAGRAPH_SEPARATOR) - break; - - if (isLVT (c) && ! isLVT (ahead)) - break; - if (! isLVT (c) && type != Character.NON_SPACING_MARK - && isL (ahead)) - break; - if (! isV (c) && ! isT (c) && type != Character.NON_SPACING_MARK - && isV (ahead)) - break; - if (! isT (c) && type != Character.NON_SPACING_MARK - && isT (ahead)) - break; - - if (isLowSurrogate (c) && ! isHighSurrogate (ahead)) - break; - if (! isLowSurrogate (c) && isHighSurrogate (ahead)) - break; - if (isLowSurrogate (ahead) && ! isHighSurrogate (ahead2)) - break; + char c = iter.previous(); + if (c == CharacterIterator.DONE) + break; + int type = Character.getType(c); + + if (type != Character.NON_SPACING_MARK + && ! isLowSurrogate (c) + && ! isLVT (c)) + break; + + // Now we need some lookahead. + char ahead = iter.previous(); + if (ahead == CharacterIterator.DONE) + { + iter.next(); + break; + } + char ahead2 = iter.previous(); + iter.next(); + iter.next(); + if (ahead2 == CharacterIterator.DONE) + break; + int aheadType = Character.getType(ahead); + + if (aheadType == Character.PARAGRAPH_SEPARATOR) + break; + + if (isLVT (c) && ! isLVT (ahead)) + break; + if (! isLVT (c) && type != Character.NON_SPACING_MARK + && isL (ahead)) + break; + if (! isV (c) && ! isT (c) && type != Character.NON_SPACING_MARK + && isV (ahead)) + break; + if (! isT (c) && type != Character.NON_SPACING_MARK + && isT (ahead)) + break; + + if (isLowSurrogate (c) && ! isHighSurrogate (ahead)) + break; + if (! isLowSurrogate (c) && isHighSurrogate (ahead)) + break; + if (isLowSurrogate (ahead) && ! isHighSurrogate (ahead2)) + break; } return iter.getIndex(); diff --git a/gnu/java/text/FormatBuffer.java b/gnu/java/text/FormatBuffer.java index e6b682087..590b16cce 100644 --- a/gnu/java/text/FormatBuffer.java +++ b/gnu/java/text/FormatBuffer.java @@ -7,7 +7,7 @@ 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 @@ -42,14 +42,14 @@ 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 + * 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@kaffe.org> * @date April 10, 2004 */ -public interface FormatBuffer +public interface FormatBuffer { /** * This method appends a simple string to the buffer. This part of @@ -72,8 +72,8 @@ public interface FormatBuffer /** * 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}. - * + * 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. @@ -121,7 +121,7 @@ public interface FormatBuffer * @param length Number of characters to cut at the end of the buffer. */ public void cutTail(int length); - + /** * This method resets completely the buffer. */ diff --git a/gnu/java/text/FormatCharacterIterator.java b/gnu/java/text/FormatCharacterIterator.java index 60773aa1e..889394ca4 100644 --- a/gnu/java/text/FormatCharacterIterator.java +++ b/gnu/java/text/FormatCharacterIterator.java @@ -1,4 +1,4 @@ -/* FormatCharacter.java -- Implementation of AttributedCharacterIterator for +/* FormatCharacter.java -- Implementation of AttributedCharacterIterator for formatters. Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. @@ -8,7 +8,7 @@ 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 @@ -78,7 +78,7 @@ public class FormatCharacterIterator implements AttributedCharacterIterator } /** - * This constructor take a string <code>s</code>, a set of ranges + * This constructor take a string <code>s</code>, a set of ranges * and the corresponding attributes. This is used to build an iterator. * The array <code>ranges</code> should be formatted as follow: * each element of <code>ranges</code> specifies the index in the string @@ -98,10 +98,10 @@ public class FormatCharacterIterator implements AttributedCharacterIterator this.ranges = ranges; this.attributes = attributes; } - - /* + + /* * The following methods are inherited from AttributedCharacterIterator, - * and thus are already documented. + * and thus are already documented. */ public Set getAllAttributeKeys() @@ -111,7 +111,7 @@ public class FormatCharacterIterator implements AttributedCharacterIterator else return new HashSet(); } - + public Map getAttributes() { if (attributes != null && attributes[attributeIndex] != null) @@ -119,7 +119,7 @@ public class FormatCharacterIterator implements AttributedCharacterIterator else return new HashMap(); } - + public Object getAttribute (AttributedCharacterIterator.Attribute attrib) { if (attributes != null && attributes[attributeIndex] != null) @@ -127,7 +127,7 @@ public class FormatCharacterIterator implements AttributedCharacterIterator else return null; } - + public int getRunLimit(Set reqAttrs) { if (attributes == null) @@ -138,19 +138,19 @@ public class FormatCharacterIterator implements AttributedCharacterIterator do { - currentAttrIndex++; - if (currentAttrIndex == attributes.length) - return formattedString.length(); - if (attributes[currentAttrIndex] == null) - break; - newKeys = attributes[currentAttrIndex].keySet(); + currentAttrIndex++; + if (currentAttrIndex == attributes.length) + return formattedString.length(); + if (attributes[currentAttrIndex] == null) + break; + newKeys = attributes[currentAttrIndex].keySet(); } while (newKeys.containsAll (reqAttrs)); return ranges[currentAttrIndex-1]; } - - public int getRunLimit (AttributedCharacterIterator.Attribute attribute) + + public int getRunLimit (AttributedCharacterIterator.Attribute attribute) { Set s = new HashSet(); @@ -164,38 +164,38 @@ public class FormatCharacterIterator implements AttributedCharacterIterator return formattedString.length(); if (attributes[attributeIndex] == null) { - for (int i=attributeIndex+1;i<attributes.length;i++) - if (attributes[i] != null) - return ranges[i-1]; - return formattedString.length(); + for (int i=attributeIndex+1;i<attributes.length;i++) + if (attributes[i] != null) + return ranges[i-1]; + return formattedString.length(); } return getRunLimit (attributes[attributeIndex].keySet()); } - + public int getRunStart (Set reqAttrs) { if (attributes == null) return formattedString.length(); - + int currentAttrIndex = attributeIndex; Set newKeys = null; do { - if (currentAttrIndex == 0) - return 0; + if (currentAttrIndex == 0) + return 0; - currentAttrIndex--; - if (attributes[currentAttrIndex] == null) - break; - newKeys = attributes[currentAttrIndex].keySet(); + currentAttrIndex--; + if (attributes[currentAttrIndex] == null) + break; + newKeys = attributes[currentAttrIndex].keySet(); } while (newKeys.containsAll (reqAttrs)); - + return (currentAttrIndex > 0) ? ranges[currentAttrIndex-1] : 0; - } - + } + public int getRunStart() { if (attributes == null) @@ -203,19 +203,19 @@ public class FormatCharacterIterator implements AttributedCharacterIterator if (attributes[attributeIndex] == null) { - for (int i=attributeIndex;i>0;i--) - if (attributes[i] != null) - return ranges[attributeIndex-1]; - return 0; + for (int i=attributeIndex;i>0;i--) + if (attributes[i] != null) + return ranges[attributeIndex-1]; + return 0; } return getRunStart (attributes[attributeIndex].keySet()); } - - public int getRunStart (AttributedCharacterIterator.Attribute attribute) + + public int getRunStart (AttributedCharacterIterator.Attribute attribute) { Set s = new HashSet(); - + s.add (attribute); return getRunStart (s); } @@ -224,7 +224,7 @@ public class FormatCharacterIterator implements AttributedCharacterIterator { return new FormatCharacterIterator (formattedString, ranges, attributes); } - + /* * The following methods are inherited from CharacterIterator and thus * are already documented. @@ -234,29 +234,29 @@ public class FormatCharacterIterator implements AttributedCharacterIterator { return formattedString.charAt (charIndex); } - + public char first() { charIndex = 0; attributeIndex = 0; return formattedString.charAt (0); } - + public int getBeginIndex() { return 0; } - + public int getEndIndex() { return formattedString.length(); } - + public int getIndex() { return charIndex; } - + public char last() { charIndex = formattedString.length()-1; @@ -264,53 +264,53 @@ public class FormatCharacterIterator implements AttributedCharacterIterator attributeIndex = attributes.length-1; return formattedString.charAt (charIndex); } - + public char next() { charIndex++; if (charIndex >= formattedString.length()) { - charIndex = getEndIndex(); - return DONE; + charIndex = getEndIndex(); + return DONE; } if (attributes != null) { - if (charIndex >= ranges[attributeIndex]) - attributeIndex++; + if (charIndex >= ranges[attributeIndex]) + attributeIndex++; } return formattedString.charAt (charIndex); } - + public char previous() { charIndex--; if (charIndex < 0) { - charIndex = 0; - return DONE; + charIndex = 0; + return DONE; } - + if (attributes != null) { - if (charIndex < ranges[attributeIndex]) - attributeIndex--; + if (charIndex < ranges[attributeIndex]) + attributeIndex--; } return formattedString.charAt (charIndex); } - + public char setIndex (int position) { if (position < 0 || position > formattedString.length()) throw new IllegalArgumentException ("position is out of range"); - + charIndex = position; if (attributes != null) { - for (attributeIndex=0;attributeIndex<attributes.length; - attributeIndex++) - if (ranges[attributeIndex] > charIndex) - break; - attributeIndex--; + for (attributeIndex=0;attributeIndex<attributes.length; + attributeIndex++) + if (ranges[attributeIndex] > charIndex) + break; + attributeIndex--; } if (charIndex == formattedString.length()) return DONE; @@ -334,64 +334,64 @@ public class FormatCharacterIterator implements AttributedCharacterIterator int i = 0, j = 0; debug("merging " + attributes.length + " attrs"); - + while (i < this.ranges.length && j < ranges.length) { - if (this.attributes[i] != null) - { - new_attributes.add (this.attributes[i]); - if (attributes[j] != null) - this.attributes[i].putAll (attributes[j]); - } - else - { - new_attributes.add (attributes[j]); - } - if (this.ranges[i] == ranges[j]) - { - new_ranges.add (new Integer (ranges[j])); - i++; - j++; - } - else if (this.ranges[i] < ranges[j]) - { - new_ranges.add (new Integer (this.ranges[i])); - i++; - } - else - { - new_ranges.add (new Integer (ranges[j])); - j++; - } + if (this.attributes[i] != null) + { + new_attributes.add (this.attributes[i]); + if (attributes[j] != null) + this.attributes[i].putAll (attributes[j]); + } + else + { + new_attributes.add (attributes[j]); + } + if (this.ranges[i] == ranges[j]) + { + new_ranges.add (new Integer (ranges[j])); + i++; + j++; + } + else if (this.ranges[i] < ranges[j]) + { + new_ranges.add (new Integer (this.ranges[i])); + i++; + } + else + { + new_ranges.add (new Integer (ranges[j])); + j++; + } } - + if (i != this.ranges.length) { - for (;i<this.ranges.length;i++) - { - new_attributes.add (this.attributes[i]); - new_ranges.add (new Integer (this.ranges[i])); - } + for (;i<this.ranges.length;i++) + { + new_attributes.add (this.attributes[i]); + new_ranges.add (new Integer (this.ranges[i])); + } } if (j != ranges.length) { - for (;j<ranges.length;j++) - { - new_attributes.add (attributes[j]); - new_ranges.add (new Integer (ranges[j])); - } + for (;j<ranges.length;j++) + { + new_attributes.add (attributes[j]); + new_ranges.add (new Integer (ranges[j])); + } } this.attributes = new HashMap[new_attributes.size()]; this.ranges = new int[new_ranges.size()]; System.arraycopy (new_attributes.toArray(), 0, this.attributes, - 0, this.attributes.length); + 0, this.attributes.length); for (i=0;i<new_ranges.size();i++) { - this.ranges[i] = ((Integer)new_ranges.elementAt (i)).intValue(); + this.ranges[i] = ((Integer)new_ranges.elementAt (i)).intValue(); } - + dumpTable(); } @@ -410,22 +410,22 @@ public class FormatCharacterIterator implements AttributedCharacterIterator do { - formattedString = formattedString + String.valueOf (c); - // TODO: Reduce the size of the output array. - more_attributes.add (iterator.getAttributes()); - more_ranges.add (new Integer (formattedString.length())); - // END TOOD - c = iterator.next(); - } + formattedString = formattedString + String.valueOf (c); + // TODO: Reduce the size of the output array. + more_attributes.add (iterator.getAttributes()); + more_ranges.add (new Integer (formattedString.length())); + // END TOOD + c = iterator.next(); + } while (c != DONE); HashMap[] new_attributes = new HashMap[attributes.length - + more_attributes.size()]; + + more_attributes.size()]; int[] new_ranges = new int[ranges.length + more_ranges.size()]; - + System.arraycopy (attributes, 0, new_attributes, 0, attributes.length); System.arraycopy (more_attributes.toArray(), 0, new_attributes, - attributes.length, more_attributes.size()); + attributes.length, more_attributes.size()); System.arraycopy (ranges, 0, new_ranges, 0, ranges.length); Object[] new_ranges_array = more_ranges.toArray(); @@ -458,7 +458,7 @@ public class FormatCharacterIterator implements AttributedCharacterIterator ranges = new_ranges; attributes = new_attributes; - } + } /** * This method appends a string without attributes. It is completely @@ -470,7 +470,7 @@ public class FormatCharacterIterator implements AttributedCharacterIterator public void append (String text) { append (text, null); - } + } /** * This method adds a set of attributes to a range of character. The @@ -481,7 +481,7 @@ public class FormatCharacterIterator implements AttributedCharacterIterator * @param range_start Lower bound of the range of characters which will receive the * attribute. * @param range_end Upper bound of the range of characters which will receive the - * attribute. + * attribute. * * @throws IllegalArgumentException if ranges are out of bounds. */ @@ -502,30 +502,30 @@ public class FormatCharacterIterator implements AttributedCharacterIterator private void dumpTable() { int start_range = 0; - + if (!DEBUG) return; System.out.println("Dumping internal table:"); for (int i = 0; i < ranges.length; i++) { - System.out.print("\t" + start_range + " => " + ranges[i] + ":"); - if (attributes[i] == null) - System.out.println("null"); - else - { - Set keyset = attributes[i].keySet(); - if (keyset != null) - { - Iterator keys = keyset.iterator(); - - while (keys.hasNext()) - System.out.print(" " + keys.next()); - } - else - System.out.println("keySet null"); - System.out.println(); - } + System.out.print("\t" + start_range + " => " + ranges[i] + ":"); + if (attributes[i] == null) + System.out.println("null"); + else + { + Set keyset = attributes[i].keySet(); + if (keyset != null) + { + Iterator keys = keyset.iterator(); + + while (keys.hasNext()) + System.out.print(" " + keys.next()); + } + else + System.out.println("keySet null"); + System.out.println(); + } } System.out.println(); System.out.flush(); diff --git a/gnu/java/text/LineBreakIterator.java b/gnu/java/text/LineBreakIterator.java index ad07479fb..7e44121b0 100644 --- a/gnu/java/text/LineBreakIterator.java +++ b/gnu/java/text/LineBreakIterator.java @@ -7,7 +7,7 @@ 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 @@ -65,23 +65,23 @@ public class LineBreakIterator extends BaseBreakIterator // Some methods to tell us different properties of characters. private final boolean isNb (char c) { - return (c == 0x00a0 // NO-BREAK SPACE - || c == 0x2011 // NON-BREAKING HYPHEN - || c == 0xfeff); // ZERO WITH NO-BREAK SPACE + return (c == 0x00a0 // NO-BREAK SPACE + || c == 0x2011 // NON-BREAKING HYPHEN + || c == 0xfeff); // ZERO WITH NO-BREAK SPACE } private final boolean isClose (int type) { return (type == Character.END_PUNCTUATION - // Unicode book says "comma, period, ...", which I take to - // mean "Po" class. - || type == Character.OTHER_PUNCTUATION); + // Unicode book says "comma, period, ...", which I take to + // mean "Po" class. + || type == Character.OTHER_PUNCTUATION); } private final boolean isIdeo (char c) { - return (c >= 0x3040 && c <= 0x309f // Hiragana - || c >= 0x30a0 && c <= 0x30ff // Katakana - || c >= 0x4e00 && c <= 0x9fff // Han - || c >= 0x3100 && c <= 0x312f); // Bopomofo + return (c >= 0x3040 && c <= 0x309f // Hiragana + || c >= 0x30a0 && c <= 0x30ff // Katakana + || c >= 0x4e00 && c <= 0x9fff // Han + || c >= 0x3100 && c <= 0x312f); // Bopomofo } public int next () @@ -92,54 +92,54 @@ public class LineBreakIterator extends BaseBreakIterator while (iter.getIndex() < end) { - char c = iter.current(); - int type = Character.getType(c); - - char n = iter.next(); - - if (n == CharacterIterator.DONE - || type == Character.PARAGRAPH_SEPARATOR - || type == Character.LINE_SEPARATOR) - break; - - // Handle two cases where we must scan for non-spacing marks. - int start = iter.getIndex(); - if (type == Character.SPACE_SEPARATOR - || type == Character.START_PUNCTUATION - || isIdeo (c)) - { - while (n != CharacterIterator.DONE - && Character.getType(n) == Character.NON_SPACING_MARK) - n = iter.next(); - if (n == CharacterIterator.DONE) - break; - - if (type == Character.SPACE_SEPARATOR) - { - int nt = Character.getType(n); - if (nt != Character.NON_SPACING_MARK - && nt != Character.SPACE_SEPARATOR - && ! isNb (n)) - break; - } - else if (type == Character.START_PUNCTUATION) - { - if (isIdeo (n)) - { - // Open punctuation followed by non spacing marks - // and then ideograph does not have a break in - // it. So skip all this. - start = iter.getIndex(); - } - } - else - { - // Ideograph preceded this character. - if (isClose (Character.getType(n))) - break; - } - } - iter.setIndex(start); + char c = iter.current(); + int type = Character.getType(c); + + char n = iter.next(); + + if (n == CharacterIterator.DONE + || type == Character.PARAGRAPH_SEPARATOR + || type == Character.LINE_SEPARATOR) + break; + + // Handle two cases where we must scan for non-spacing marks. + int start = iter.getIndex(); + if (type == Character.SPACE_SEPARATOR + || type == Character.START_PUNCTUATION + || isIdeo (c)) + { + while (n != CharacterIterator.DONE + && Character.getType(n) == Character.NON_SPACING_MARK) + n = iter.next(); + if (n == CharacterIterator.DONE) + break; + + if (type == Character.SPACE_SEPARATOR) + { + int nt = Character.getType(n); + if (nt != Character.NON_SPACING_MARK + && nt != Character.SPACE_SEPARATOR + && ! isNb (n)) + break; + } + else if (type == Character.START_PUNCTUATION) + { + if (isIdeo (n)) + { + // Open punctuation followed by non spacing marks + // and then ideograph does not have a break in + // it. So skip all this. + start = iter.getIndex(); + } + } + else + { + // Ideograph preceded this character. + if (isClose (Character.getType(n))) + break; + } + } + iter.setIndex(start); } return iter.getIndex(); @@ -153,40 +153,40 @@ public class LineBreakIterator extends BaseBreakIterator while (iter.getIndex() >= start) { - char c = iter.previous(); - if (c == CharacterIterator.DONE) - break; - int type = Character.getType(c); - - char n = iter.previous(); - if (n == CharacterIterator.DONE) - break; - iter.next(); - - int nt = Character.getType(n); - // Break after paragraph separators. - if (nt == Character.PARAGRAPH_SEPARATOR - || nt == Character.LINE_SEPARATOR) - break; - - // Skip non-spacing marks. - int init = iter.getIndex(); - while (n != CharacterIterator.DONE && nt == Character.NON_SPACING_MARK) - { - n = iter.previous(); - nt = Character.getType(n); - } - - if (nt == Character.SPACE_SEPARATOR - && type != Character.SPACE_SEPARATOR - && type != Character.NON_SPACING_MARK - && ! isNb (c)) - break; - if (! isClose (type) && isIdeo (n)) - break; - if (isIdeo (c) && nt != Character.START_PUNCTUATION) - break; - iter.setIndex(init); + char c = iter.previous(); + if (c == CharacterIterator.DONE) + break; + int type = Character.getType(c); + + char n = iter.previous(); + if (n == CharacterIterator.DONE) + break; + iter.next(); + + int nt = Character.getType(n); + // Break after paragraph separators. + if (nt == Character.PARAGRAPH_SEPARATOR + || nt == Character.LINE_SEPARATOR) + break; + + // Skip non-spacing marks. + int init = iter.getIndex(); + while (n != CharacterIterator.DONE && nt == Character.NON_SPACING_MARK) + { + n = iter.previous(); + nt = Character.getType(n); + } + + if (nt == Character.SPACE_SEPARATOR + && type != Character.SPACE_SEPARATOR + && type != Character.NON_SPACING_MARK + && ! isNb (c)) + break; + if (! isClose (type) && isIdeo (n)) + break; + if (isIdeo (c) && nt != Character.START_PUNCTUATION) + break; + iter.setIndex(init); } return iter.getIndex(); diff --git a/gnu/java/text/SentenceBreakIterator.java b/gnu/java/text/SentenceBreakIterator.java index f91d269bb..4da9df2ea 100644 --- a/gnu/java/text/SentenceBreakIterator.java +++ b/gnu/java/text/SentenceBreakIterator.java @@ -7,7 +7,7 @@ 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 @@ -70,66 +70,66 @@ public class SentenceBreakIterator extends BaseBreakIterator while (iter.getIndex() < end) { - char c = iter.current(); - if (c == CharacterIterator.DONE) - break; - int type = Character.getType(c); - - char n = iter.next(); - if (n == CharacterIterator.DONE) - break; - - // Always break after paragraph separator. - if (type == Character.PARAGRAPH_SEPARATOR) - break; - - if (c == '!' || c == '?') - { - // Skip close punctuation. - while (n != CharacterIterator.DONE - && Character.getType(n) == Character.END_PUNCTUATION) - n = iter.next(); - // Skip (java) space, line and paragraph separators. - while (n != CharacterIterator.DONE && Character.isWhitespace(n)) - n = iter.next(); - - // There's always a break somewhere after `!' or `?'. - break; - } - - if (c == '.') - { - int save = iter.getIndex(); - // Skip close punctuation. - while (n != CharacterIterator.DONE - && Character.getType(n) == Character.END_PUNCTUATION) - n = iter.next(); - // Skip (java) space, line and paragraph separators. - // We keep count because we need at least one for this period to - // represent a terminator. - int spcount = 0; - while (n != CharacterIterator.DONE && Character.isWhitespace(n)) - { - n = iter.next(); - ++spcount; - } - if (spcount > 0) - { - int save2 = iter.getIndex(); - // Skip over open puncutation. - while (n != CharacterIterator.DONE - && Character.getType(n) == Character.START_PUNCTUATION) - n = iter.next(); - // Next character must not be lower case. - if (n == CharacterIterator.DONE - || ! Character.isLowerCase(n)) - { - iter.setIndex(save2); - break; - } - } - iter.setIndex(save); - } + char c = iter.current(); + if (c == CharacterIterator.DONE) + break; + int type = Character.getType(c); + + char n = iter.next(); + if (n == CharacterIterator.DONE) + break; + + // Always break after paragraph separator. + if (type == Character.PARAGRAPH_SEPARATOR) + break; + + if (c == '!' || c == '?') + { + // Skip close punctuation. + while (n != CharacterIterator.DONE + && Character.getType(n) == Character.END_PUNCTUATION) + n = iter.next(); + // Skip (java) space, line and paragraph separators. + while (n != CharacterIterator.DONE && Character.isWhitespace(n)) + n = iter.next(); + + // There's always a break somewhere after `!' or `?'. + break; + } + + if (c == '.') + { + int save = iter.getIndex(); + // Skip close punctuation. + while (n != CharacterIterator.DONE + && Character.getType(n) == Character.END_PUNCTUATION) + n = iter.next(); + // Skip (java) space, line and paragraph separators. + // We keep count because we need at least one for this period to + // represent a terminator. + int spcount = 0; + while (n != CharacterIterator.DONE && Character.isWhitespace(n)) + { + n = iter.next(); + ++spcount; + } + if (spcount > 0) + { + int save2 = iter.getIndex(); + // Skip over open puncutation. + while (n != CharacterIterator.DONE + && Character.getType(n) == Character.START_PUNCTUATION) + n = iter.next(); + // Next character must not be lower case. + if (n == CharacterIterator.DONE + || ! Character.isLowerCase(n)) + { + iter.setIndex(save2); + break; + } + } + iter.setIndex(save); + } } return iter.getIndex(); @@ -143,86 +143,86 @@ public class SentenceBreakIterator extends BaseBreakIterator while (iter.getIndex() >= start) { - char c = iter.previous(); - if (c == CharacterIterator.DONE) - break; - - char n = iter.previous(); - if (n == CharacterIterator.DONE) - break; - iter.next(); - int nt = Character.getType(n); - - if (! Character.isLowerCase(c) - && (nt == Character.START_PUNCTUATION - || Character.isWhitespace(n))) - { - int save = iter.getIndex(); - int save_nt = nt; - char save_n = n; - // Skip open punctuation. - while (n != CharacterIterator.DONE - && Character.getType(n) == Character.START_PUNCTUATION) - n = iter.previous(); - if (n == CharacterIterator.DONE) - break; - if (Character.isWhitespace(n)) - { - // Must have at least one (java) space after the `.'. - int save2 = iter.getIndex(); - while (n != CharacterIterator.DONE - && Character.isWhitespace(n)) - n = iter.previous(); - // Skip close punctuation. - while (n != CharacterIterator.DONE - && Character.getType(n) == Character.END_PUNCTUATION) - n = iter.previous(); - if (n == CharacterIterator.DONE || n == '.') - { - // Communicate location of actual end. - period = iter.getIndex(); - iter.setIndex(save2); - break; - } - } - iter.setIndex(save); - nt = save_nt; - n = save_n; - } - - if (nt == Character.PARAGRAPH_SEPARATOR) - { - // Communicate location of actual end. - period = iter.getIndex(); - break; - } - else if (Character.isWhitespace(n) - || nt == Character.END_PUNCTUATION) - { - int save = iter.getIndex(); - // Skip (java) space, line and paragraph separators. - while (n != CharacterIterator.DONE - && Character.isWhitespace(n)) - n = iter.previous(); - // Skip close punctuation. - while (n != CharacterIterator.DONE - && Character.getType(n) == Character.END_PUNCTUATION) - n = iter.previous(); - int here = iter.getIndex(); - iter.setIndex(save); - if (n == CharacterIterator.DONE || n == '!' || n == '?') - { - // Communicate location of actual end. - period = here; - break; - } - } - else if (n == '!' || n == '?') - { - // Communicate location of actual end. - period = iter.getIndex(); - break; - } + char c = iter.previous(); + if (c == CharacterIterator.DONE) + break; + + char n = iter.previous(); + if (n == CharacterIterator.DONE) + break; + iter.next(); + int nt = Character.getType(n); + + if (! Character.isLowerCase(c) + && (nt == Character.START_PUNCTUATION + || Character.isWhitespace(n))) + { + int save = iter.getIndex(); + int save_nt = nt; + char save_n = n; + // Skip open punctuation. + while (n != CharacterIterator.DONE + && Character.getType(n) == Character.START_PUNCTUATION) + n = iter.previous(); + if (n == CharacterIterator.DONE) + break; + if (Character.isWhitespace(n)) + { + // Must have at least one (java) space after the `.'. + int save2 = iter.getIndex(); + while (n != CharacterIterator.DONE + && Character.isWhitespace(n)) + n = iter.previous(); + // Skip close punctuation. + while (n != CharacterIterator.DONE + && Character.getType(n) == Character.END_PUNCTUATION) + n = iter.previous(); + if (n == CharacterIterator.DONE || n == '.') + { + // Communicate location of actual end. + period = iter.getIndex(); + iter.setIndex(save2); + break; + } + } + iter.setIndex(save); + nt = save_nt; + n = save_n; + } + + if (nt == Character.PARAGRAPH_SEPARATOR) + { + // Communicate location of actual end. + period = iter.getIndex(); + break; + } + else if (Character.isWhitespace(n) + || nt == Character.END_PUNCTUATION) + { + int save = iter.getIndex(); + // Skip (java) space, line and paragraph separators. + while (n != CharacterIterator.DONE + && Character.isWhitespace(n)) + n = iter.previous(); + // Skip close punctuation. + while (n != CharacterIterator.DONE + && Character.getType(n) == Character.END_PUNCTUATION) + n = iter.previous(); + int here = iter.getIndex(); + iter.setIndex(save); + if (n == CharacterIterator.DONE || n == '!' || n == '?') + { + // Communicate location of actual end. + period = here; + break; + } + } + else if (n == '!' || n == '?') + { + // Communicate location of actual end. + period = iter.getIndex(); + break; + } } return iter.getIndex(); diff --git a/gnu/java/text/StringFormatBuffer.java b/gnu/java/text/StringFormatBuffer.java index fc8d08ee6..2367fccb3 100644 --- a/gnu/java/text/StringFormatBuffer.java +++ b/gnu/java/text/StringFormatBuffer.java @@ -7,7 +7,7 @@ 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 @@ -41,7 +41,7 @@ import java.util.HashMap; /** * This class is an implementation of a FormatBuffer without attributes. - * + * * @author Guilhem Lavaux <guilhem@kaffe.org> * @date April 10, 2004 */ @@ -64,7 +64,7 @@ public class StringFormatBuffer implements FormatBuffer { buffer.append(s); } - + public void append(String s, AttributedCharacterIterator.Attribute attr) { buffer.append(s); @@ -111,7 +111,7 @@ public class StringFormatBuffer implements FormatBuffer } /** - * This method returns the internal {@link java.lang.StringBuffer} which + * This method returns the internal {@link java.lang.StringBuffer} which * contains the string of character. */ public StringBuffer getBuffer() diff --git a/gnu/java/text/WordBreakIterator.java b/gnu/java/text/WordBreakIterator.java index f140369f8..fded4bf26 100644 --- a/gnu/java/text/WordBreakIterator.java +++ b/gnu/java/text/WordBreakIterator.java @@ -7,7 +7,7 @@ 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 @@ -84,78 +84,78 @@ public class WordBreakIterator extends BaseBreakIterator while (iter.getIndex() < end) { - char c = iter.current(); - if (c == CharacterIterator.DONE) - break; - int type = Character.getType(c); - - char n = iter.next(); - if (n == CharacterIterator.DONE) - break; - - // Break after paragraph separators. - if (type == Character.PARAGRAPH_SEPARATOR - || type == Character.LINE_SEPARATOR) - break; - - // Break between letters and non-letters. - // FIXME: we treat apostrophe as part of a word. This - // is an English-ism. - boolean is_letter = Character.isLetter(c); - if (c != '\'' && ! is_letter && type != Character.NON_SPACING_MARK - && Character.isLetter(n)) - break; - - // Always break after certain symbols, such as punctuation. - // This heuristic is derived from hints in the JCL book and is - // not part of Unicode. It seems to be right, however. - // FIXME: we treat apostrophe as part of a word. This - // is an English-ism. - if (c != '\'' - && (type == Character.DASH_PUNCTUATION - || type == Character.START_PUNCTUATION - || type == Character.END_PUNCTUATION - || type == Character.CONNECTOR_PUNCTUATION - || type == Character.OTHER_PUNCTUATION - || type == Character.MATH_SYMBOL - || type == Character.CURRENCY_SYMBOL - || type == Character.MODIFIER_SYMBOL - || type == Character.OTHER_SYMBOL - || type == Character.FORMAT - || type == Character.CONTROL)) - break; - - boolean is_hira = isHira (c); - boolean is_kata = isKata (c); - boolean is_han = isHan (c); - - // Special case Japanese. - if (! is_hira && ! is_kata && ! is_han - && type != Character.NON_SPACING_MARK - && (isHira (n) || isKata (n) || isHan (n))) - break; - - if (is_hira || is_kata || is_han || is_letter) - { - // Now we need to do some lookahead. We might need to do - // quite a bit of lookahead, so we save our position and - // restore it later. - int save = iter.getIndex(); - // Skip string of non spacing marks. - while (n != CharacterIterator.DONE - && Character.getType(n) == Character.NON_SPACING_MARK) - n = iter.next(); - if (n == CharacterIterator.DONE) - break; - if ((is_hira && ! isHira (n)) - || (is_kata && ! isHira (n) && ! isKata (n)) - || (is_han && ! isHira (n) && ! isHan (n)) - // FIXME: we treat apostrophe as part of a word. This - // is an English-ism. - || (is_letter && ! Character.isLetter(n) && n != '\'')) - break; - iter.setIndex(save); - } + char c = iter.current(); + if (c == CharacterIterator.DONE) + break; + int type = Character.getType(c); + + char n = iter.next(); + if (n == CharacterIterator.DONE) + break; + + // Break after paragraph separators. + if (type == Character.PARAGRAPH_SEPARATOR + || type == Character.LINE_SEPARATOR) + break; + + // Break between letters and non-letters. + // FIXME: we treat apostrophe as part of a word. This + // is an English-ism. + boolean is_letter = Character.isLetter(c); + if (c != '\'' && ! is_letter && type != Character.NON_SPACING_MARK + && Character.isLetter(n)) + break; + + // Always break after certain symbols, such as punctuation. + // This heuristic is derived from hints in the JCL book and is + // not part of Unicode. It seems to be right, however. + // FIXME: we treat apostrophe as part of a word. This + // is an English-ism. + if (c != '\'' + && (type == Character.DASH_PUNCTUATION + || type == Character.START_PUNCTUATION + || type == Character.END_PUNCTUATION + || type == Character.CONNECTOR_PUNCTUATION + || type == Character.OTHER_PUNCTUATION + || type == Character.MATH_SYMBOL + || type == Character.CURRENCY_SYMBOL + || type == Character.MODIFIER_SYMBOL + || type == Character.OTHER_SYMBOL + || type == Character.FORMAT + || type == Character.CONTROL)) + break; + + boolean is_hira = isHira (c); + boolean is_kata = isKata (c); + boolean is_han = isHan (c); + + // Special case Japanese. + if (! is_hira && ! is_kata && ! is_han + && type != Character.NON_SPACING_MARK + && (isHira (n) || isKata (n) || isHan (n))) + break; + + if (is_hira || is_kata || is_han || is_letter) + { + // Now we need to do some lookahead. We might need to do + // quite a bit of lookahead, so we save our position and + // restore it later. + int save = iter.getIndex(); + // Skip string of non spacing marks. + while (n != CharacterIterator.DONE + && Character.getType(n) == Character.NON_SPACING_MARK) + n = iter.next(); + if (n == CharacterIterator.DONE) + break; + if ((is_hira && ! isHira (n)) + || (is_kata && ! isHira (n) && ! isKata (n)) + || (is_han && ! isHira (n) && ! isHan (n)) + // FIXME: we treat apostrophe as part of a word. This + // is an English-ism. + || (is_letter && ! Character.isLetter(n) && n != '\'')) + break; + iter.setIndex(save); + } } return iter.getIndex(); @@ -169,80 +169,80 @@ public class WordBreakIterator extends BaseBreakIterator while (iter.getIndex() >= start) { - char c = iter.previous(); - if (c == CharacterIterator.DONE) - break; - - boolean is_hira = isHira (c); - boolean is_kata = isKata (c); - boolean is_han = isHan (c); - boolean is_letter = Character.isLetter(c); - - char n = iter.previous(); - if (n == CharacterIterator.DONE) - break; - iter.next(); - int type = Character.getType(n); - // Break after paragraph separators. - if (type == Character.PARAGRAPH_SEPARATOR - || type == Character.LINE_SEPARATOR) - break; - - // Break between letters and non-letters. - // FIXME: we treat apostrophe as part of a word. This - // is an English-ism. - if (n != '\'' && ! Character.isLetter(n) - && type != Character.NON_SPACING_MARK - && is_letter) - break; - - // Always break after certain symbols, such as punctuation. - // This heuristic is derived from hints in the JCL book and is - // not part of Unicode. It seems to be right, however. - // FIXME: we treat apostrophe as part of a word. This - // is an English-ism. - if (n != '\'' - && (type == Character.DASH_PUNCTUATION - || type == Character.START_PUNCTUATION - || type == Character.END_PUNCTUATION - || type == Character.CONNECTOR_PUNCTUATION - || type == Character.OTHER_PUNCTUATION - || type == Character.MATH_SYMBOL - || type == Character.CURRENCY_SYMBOL - || type == Character.MODIFIER_SYMBOL - || type == Character.OTHER_SYMBOL - || type == Character.FORMAT - || type == Character.CONTROL)) - break; - - // Special case Japanese. - if ((is_hira || is_kata || is_han) - && ! isHira (n) && ! isKata (n) && ! isHan (n) - && type != Character.NON_SPACING_MARK) - break; - - // We might have to skip over non spacing marks to see what's - // on the other side. - if (! is_hira || (! is_letter && c != '\'')) - { - int save = iter.getIndex(); - while (n != CharacterIterator.DONE - && Character.getType(n) == Character.NON_SPACING_MARK) - n = iter.previous(); - iter.setIndex(save); - // This is a strange case: a bunch of non-spacing marks at - // the beginning. We treat the current location as a word - // break. - if (n == CharacterIterator.DONE) - break; - if ((isHira (n) && ! is_hira) - || (isKata (n) && ! is_hira && ! is_kata) - || (isHan (n) && ! is_hira && ! is_han) - // FIXME: we treat apostrophe as part of a word. This - // is an English-ism. - || (! is_letter && c != '\'' && Character.isLetter(n))) - break; - } + char c = iter.previous(); + if (c == CharacterIterator.DONE) + break; + + boolean is_hira = isHira (c); + boolean is_kata = isKata (c); + boolean is_han = isHan (c); + boolean is_letter = Character.isLetter(c); + + char n = iter.previous(); + if (n == CharacterIterator.DONE) + break; + iter.next(); + int type = Character.getType(n); + // Break after paragraph separators. + if (type == Character.PARAGRAPH_SEPARATOR + || type == Character.LINE_SEPARATOR) + break; + + // Break between letters and non-letters. + // FIXME: we treat apostrophe as part of a word. This + // is an English-ism. + if (n != '\'' && ! Character.isLetter(n) + && type != Character.NON_SPACING_MARK + && is_letter) + break; + + // Always break after certain symbols, such as punctuation. + // This heuristic is derived from hints in the JCL book and is + // not part of Unicode. It seems to be right, however. + // FIXME: we treat apostrophe as part of a word. This + // is an English-ism. + if (n != '\'' + && (type == Character.DASH_PUNCTUATION + || type == Character.START_PUNCTUATION + || type == Character.END_PUNCTUATION + || type == Character.CONNECTOR_PUNCTUATION + || type == Character.OTHER_PUNCTUATION + || type == Character.MATH_SYMBOL + || type == Character.CURRENCY_SYMBOL + || type == Character.MODIFIER_SYMBOL + || type == Character.OTHER_SYMBOL + || type == Character.FORMAT + || type == Character.CONTROL)) + break; + + // Special case Japanese. + if ((is_hira || is_kata || is_han) + && ! isHira (n) && ! isKata (n) && ! isHan (n) + && type != Character.NON_SPACING_MARK) + break; + + // We might have to skip over non spacing marks to see what's + // on the other side. + if (! is_hira || (! is_letter && c != '\'')) + { + int save = iter.getIndex(); + while (n != CharacterIterator.DONE + && Character.getType(n) == Character.NON_SPACING_MARK) + n = iter.previous(); + iter.setIndex(save); + // This is a strange case: a bunch of non-spacing marks at + // the beginning. We treat the current location as a word + // break. + if (n == CharacterIterator.DONE) + break; + if ((isHira (n) && ! is_hira) + || (isKata (n) && ! is_hira && ! is_kata) + || (isHan (n) && ! is_hira && ! is_han) + // FIXME: we treat apostrophe as part of a word. This + // is an English-ism. + || (! is_letter && c != '\'' && Character.isLetter(n))) + break; + } } return iter.getIndex(); diff --git a/gnu/java/util/Base64.java b/gnu/java/util/Base64.java index 4401a151a..80b1fcc02 100644 --- a/gnu/java/util/Base64.java +++ b/gnu/java/util/Base64.java @@ -114,7 +114,7 @@ public final class Base64 { return encode(buf, 0); } - + /** * Base64 encode a byte array, returning the returning string. * @@ -129,7 +129,7 @@ public final class Base64 /** * Base64 encode a byte array, returning the returning string. - * + * * @param buf The byte array to encode. * @param offset The offset in the byte array to start. * @param length The number of bytes to encode. diff --git a/gnu/java/util/DoubleEnumeration.java b/gnu/java/util/DoubleEnumeration.java index 94efb923d..852644bc6 100644 --- a/gnu/java/util/DoubleEnumeration.java +++ b/gnu/java/util/DoubleEnumeration.java @@ -46,7 +46,7 @@ import java.util.NoSuchElementException; * It returns the elements of the first Enumeration until it has * no more elements and then returns the elements of the second * Enumeration.<br> - * + * * In the default case: * <pre> * doubleEnum = new DoubleEnumeration(enum1, enum2); @@ -67,7 +67,7 @@ public class DoubleEnumeration<T> implements Enumeration<T> { /** * This is true as long as one of the enumerations has more - * elements. + * elements. * Only valid when hasChecked is true. * Set in <code>hasMoreElements()</code> */ diff --git a/gnu/java/util/EmptyEnumeration.java b/gnu/java/util/EmptyEnumeration.java index ca2c56d73..30c50d81d 100644 --- a/gnu/java/util/EmptyEnumeration.java +++ b/gnu/java/util/EmptyEnumeration.java @@ -54,7 +54,7 @@ import java.util.NoSuchElementException; public final class EmptyEnumeration<T> implements Enumeration<T>, Serializable { /** The only instance of this class */ - private static final EmptyEnumeration<Object> instance = + private static final EmptyEnumeration<Object> instance = new EmptyEnumeration<Object>(); /** diff --git a/gnu/java/util/WeakIdentityHashMap.java b/gnu/java/util/WeakIdentityHashMap.java index 210a3d8c5..4d9014969 100644 --- a/gnu/java/util/WeakIdentityHashMap.java +++ b/gnu/java/util/WeakIdentityHashMap.java @@ -686,12 +686,12 @@ public class WeakIdentityHashMap extends AbstractMap implements Map { if (next == null) throw new InternalError("WeakIdentityHashMap in inconsistent state"); - prev = next; + prev = next; next = prev.next; } if (prev == null) buckets[slot] = bucket.next; - else + else prev.next = bucket.next; size--; diff --git a/gnu/java/util/ZoneInfo.java b/gnu/java/util/ZoneInfo.java index 2146a321f..117ef3cf2 100644 --- a/gnu/java/util/ZoneInfo.java +++ b/gnu/java/util/ZoneInfo.java @@ -134,7 +134,7 @@ public class ZoneInfo extends TimeZone * rules after the last transition. */ public ZoneInfo(int rawOffset, String id, long[] transitions, - SimpleTimeZone lastRule) + SimpleTimeZone lastRule) { if (transitions == null || transitions.length < 1) throw new IllegalArgumentException("transitions must not be null"); @@ -166,7 +166,7 @@ public class ZoneInfo extends TimeZone * @throws IllegalArgumentException if arguments are incorrect. */ public int getOffset(int era, int year, int month, int day, int dayOfWeek, - int millis) + int millis) { if (gmtZone == null) gmtZone = new SimpleTimeZone(0, "GMT"); @@ -201,15 +201,15 @@ public class ZoneInfo extends TimeZone int mid = 1; while (lo < hi) { - mid = (lo + hi) / 2; - // secs < (transitions[mid-1] >> SECS_SHIFT) - if (val <= transitions[mid-1]) - hi = mid; - // secs >= (transitions[mid] >> SECS_SHIFT) - else if (val > transitions[mid]) - lo = mid + 1; - else - break; + mid = (lo + hi) / 2; + // secs < (transitions[mid-1] >> SECS_SHIFT) + if (val <= transitions[mid-1]) + hi = mid; + // secs >= (transitions[mid] >> SECS_SHIFT) + else if (val > transitions[mid]) + lo = mid + 1; + else + break; } return transitions[mid]; } @@ -257,30 +257,30 @@ public class ZoneInfo extends TimeZone { if (lastRule.useDaylightTime()) { - dstSavings = lastRule.getDSTSavings(); - useDaylight = true; + dstSavings = lastRule.getDSTSavings(); + useDaylight = true; } else { - dstSavings = 0; - useDaylight = false; - // lastRule might say no DST is in effect simply because - // the DST rules are too complex for SimpleTimeZone, say - // for Asia/Jerusalem. - // Look at the last DST offset if it is newer than current time. - long currentSecs = System.currentTimeMillis() / 1000; - int i; - for (i = transitions.length - 1; - i >= 0 && currentSecs < (transitions[i] >> SECS_SHIFT); - i--) - if ((transitions[i] & IS_DST) != 0) - { - dstSavings = (int) (((transitions[i] << OFFSET_SHIFT) - >> OFFSET_SHIFT) * 1000) - - rawOffset; - useDaylight = true; - break; - } + dstSavings = 0; + useDaylight = false; + // lastRule might say no DST is in effect simply because + // the DST rules are too complex for SimpleTimeZone, say + // for Asia/Jerusalem. + // Look at the last DST offset if it is newer than current time. + long currentSecs = System.currentTimeMillis() / 1000; + int i; + for (i = transitions.length - 1; + i >= 0 && currentSecs < (transitions[i] >> SECS_SHIFT); + i--) + if ((transitions[i] & IS_DST) != 0) + { + dstSavings = (int) (((transitions[i] << OFFSET_SHIFT) + >> OFFSET_SHIFT) * 1000) + - rawOffset; + useDaylight = true; + break; + } } } @@ -372,10 +372,10 @@ public class ZoneInfo extends TimeZone public String toString() { return getClass().getName() + "[" + "id=" + getID() + ",offset=" - + rawOffset + ",transitions=" + transitions.length - + ",useDaylight=" + useDaylight - + (useDaylight ? (",dstSavings=" + dstSavings) : "") - + ",lastRule=" + lastRule.toString() + "]"; + + rawOffset + ",transitions=" + transitions.length + + ",useDaylight=" + useDaylight + + (useDaylight ? (",dstSavings=" + dstSavings) : "") + + ",lastRule=" + lastRule.toString() + "]"; } /** @@ -389,470 +389,470 @@ public class ZoneInfo extends TimeZone DataInputStream dis = null; try { - FileInputStream fis = new FileInputStream(file); - BufferedInputStream bis = new BufferedInputStream(fis); - dis = new DataInputStream(bis); - - // Make sure we are reading a tzfile. - byte[] tzif = new byte[5]; - dis.readFully(tzif); - int tzif2 = 4; - if (tzif[0] == 'T' && tzif[1] == 'Z' - && tzif[2] == 'i' && tzif[3] == 'f') - { - if (tzif[4] >= '2') - tzif2 = 8; - // Reserved bytes - skipFully(dis, 16 - 1); - } - else - // Darwin has tzdata files that don't start with the TZif marker - skipFully(dis, 16 - 5); - - int ttisgmtcnt = dis.readInt(); - int ttisstdcnt = dis.readInt(); - int leapcnt = dis.readInt(); - int timecnt = dis.readInt(); - int typecnt = dis.readInt(); - int charcnt = dis.readInt(); - if (tzif2 == 8) - { - skipFully(dis, timecnt * (4 + 1) + typecnt * (4 + 1 + 1) + charcnt - + leapcnt * (4 + 4) + ttisgmtcnt + ttisstdcnt); - - dis.readFully(tzif); - if (tzif[0] != 'T' || tzif[1] != 'Z' || tzif[2] != 'i' - || tzif[3] != 'f' || tzif[4] < '2') - return null; - - // Reserved bytes - skipFully(dis, 16 - 1); - ttisgmtcnt = dis.readInt(); - ttisstdcnt = dis.readInt(); - leapcnt = dis.readInt(); - timecnt = dis.readInt(); - typecnt = dis.readInt(); - charcnt = dis.readInt(); - } - - // Sanity checks - if (typecnt <= 0 || timecnt < 0 || charcnt < 0 - || leapcnt < 0 || ttisgmtcnt < 0 || ttisstdcnt < 0 - || ttisgmtcnt > typecnt || ttisstdcnt > typecnt) - return null; - - // Transition times - long[] times = new long[timecnt]; - for (int i = 0; i < timecnt; i++) - if (tzif2 == 8) - times[i] = dis.readLong(); - else - times[i] = (long) dis.readInt(); - - // Transition types - int[] types = new int[timecnt]; - for (int i = 0; i < timecnt; i++) - { - types[i] = dis.readByte(); - if (types[i] < 0) - types[i] += 256; - if (types[i] >= typecnt) - return null; - } - - // Types - int[] offsets = new int[typecnt]; - int[] typeflags = new int[typecnt]; - for (int i = 0; i < typecnt; i++) - { - offsets[i] = dis.readInt(); - if (offsets[i] >= IS_DST / 2 || offsets[i] <= -IS_DST / 2) - return null; - int dst = dis.readByte(); - int abbrind = dis.readByte(); - if (abbrind < 0) - abbrind += 256; - if (abbrind >= charcnt) - return null; - typeflags[i] = (dst != 0 ? (1 << 8) : 0) + abbrind; - } - - // Abbrev names - byte[] names = new byte[charcnt]; - dis.readFully(names); - - // Leap transitions, for now ignore - skipFully(dis, leapcnt * (tzif2 + 4) + ttisstdcnt + ttisgmtcnt); - - // tzIf2 format has optional POSIX TZ env string - String tzstr = null; - if (tzif2 == 8 && dis.readByte() == '\n') - { - tzstr = dis.readLine(); - if (tzstr.length() <= 0) - tzstr = null; - } - - // Get std/dst_offset and dst/non-dst time zone names. - int std_ind = -1; - int dst_ind = -1; - if (timecnt == 0) - std_ind = 0; - else - for (int i = timecnt - 1; i >= 0; i--) - { - if (std_ind == -1 && (typeflags[types[i]] & (1 << 8)) == 0) - std_ind = types[i]; - else if (dst_ind == -1 && (typeflags[types[i]] & (1 << 8)) != 0) - dst_ind = types[i]; - if (dst_ind != -1 && std_ind != -1) - break; - } - - if (std_ind == -1) - return null; - - int j = typeflags[std_ind] & 255; - while (j < charcnt && names[j] != 0) - j++; - String std_zonename = new String(names, typeflags[std_ind] & 255, - j - (typeflags[std_ind] & 255), - "ASCII"); - - String dst_zonename = ""; - if (dst_ind != -1) - { - j = typeflags[dst_ind] & 255; - while (j < charcnt && names[j] != 0) - j++; - dst_zonename = new String(names, typeflags[dst_ind] & 255, - j - (typeflags[dst_ind] & 255), "ASCII"); - } - - // Only use gmt offset when necessary. - // Also special case GMT+/- timezones. - String std_offset_string = ""; - String dst_offset_string = ""; - if (tzstr == null - && (dst_ind != -1 - || (offsets[std_ind] != 0 - && !std_zonename.startsWith("GMT+") - && !std_zonename.startsWith("GMT-")))) - { - std_offset_string = Integer.toString(-offsets[std_ind] / 3600); - int seconds = -offsets[std_ind] % 3600; - if (seconds != 0) - { - if (seconds < 0) - seconds *= -1; - if (seconds < 600) - std_offset_string += ":0" + Integer.toString(seconds / 60); - else - std_offset_string += ":" + Integer.toString(seconds / 60); - seconds = seconds % 60; - if (seconds >= 10) - std_offset_string += ":" + Integer.toString(seconds); - else if (seconds > 0) - std_offset_string += ":0" + Integer.toString(seconds); - } - - if (dst_ind != -1 && offsets[dst_ind] != offsets[std_ind] + 3600) - { - dst_offset_string = Integer.toString(-offsets[dst_ind] / 3600); - seconds = -offsets[dst_ind] % 3600; - if (seconds != 0) - { - if (seconds < 0) - seconds *= -1; - if (seconds < 600) - dst_offset_string - += ":0" + Integer.toString(seconds / 60); - else - dst_offset_string - += ":" + Integer.toString(seconds / 60); - seconds = seconds % 60; - if (seconds >= 10) - dst_offset_string += ":" + Integer.toString(seconds); - else if (seconds > 0) - dst_offset_string += ":0" + Integer.toString(seconds); - } - } - } - - /* - * If no tzIf2 POSIX TZ string is available and the timezone - * uses DST, try to guess the last rule by trying to make - * sense from transitions at 5 years in the future and onwards. - * tzdata actually uses only 3 forms of rules: - * fixed date within a month, e.g. change on April, 5th - * 1st weekday on or after Nth: change on Sun>=15 in April - * last weekday in a month: change on lastSun in April - */ - String[] change_spec = { null, null }; - if (tzstr == null && dst_ind != -1 && timecnt > 10) - { - long nowPlus5y = System.currentTimeMillis() / 1000 - + 5 * 365 * 86400; - int first; - - for (first = timecnt - 1; first >= 0; first--) - if (times[first] < nowPlus5y - || (types[first] != std_ind && types[first] != dst_ind) - || types[first] != types[timecnt - 2 + ((first ^ timecnt) & 1)]) - break; - first++; - - if (timecnt - first >= 10 && types[timecnt - 1] != types[timecnt - 2]) - { - GregorianCalendar cal - = new GregorianCalendar(new SimpleTimeZone(0, "GMT")); - - int[] values = new int[2 * 11]; - int i; - for (i = timecnt - 1; i >= first; i--) - { - int base = (i % 2) * 11; - int offset = offsets[types[i > first ? i - 1 : i + 1]]; - cal.setTimeInMillis((times[i] + offset) * 1000); - if (i >= timecnt - 2) - { - values[base + 0] = cal.get(Calendar.YEAR); - values[base + 1] = cal.get(Calendar.MONTH); - values[base + 2] = cal.get(Calendar.DAY_OF_MONTH); - values[base + 3] - = cal.getActualMaximum(Calendar.DAY_OF_MONTH); - values[base + 4] = cal.get(Calendar.DAY_OF_WEEK); - values[base + 5] = cal.get(Calendar.HOUR_OF_DAY); - values[base + 6] = cal.get(Calendar.MINUTE); - values[base + 7] = cal.get(Calendar.SECOND); - values[base + 8] = values[base + 2]; // Range start - values[base + 9] = values[base + 2]; // Range end - values[base + 10] = 0; // Determined type - } - else - { - int year = cal.get(Calendar.YEAR); - int month = cal.get(Calendar.MONTH); - int day_of_month = cal.get(Calendar.DAY_OF_MONTH); - int month_days - = cal.getActualMaximum(Calendar.DAY_OF_MONTH); - int day_of_week = cal.get(Calendar.DAY_OF_WEEK); - int hour = cal.get(Calendar.HOUR_OF_DAY); - int minute = cal.get(Calendar.MINUTE); - int second = cal.get(Calendar.SECOND); - if (year != values[base + 0] - 1 - || month != values[base + 1] - || hour != values[base + 5] - || minute != values[base + 6] - || second != values[base + 7]) - break; - if (day_of_week == values[base + 4]) - { - // Either a Sun>=8 or lastSun rule. - if (day_of_month < values[base + 8]) - values[base + 8] = day_of_month; - if (day_of_month > values[base + 9]) - values[base + 9] = day_of_month; - if (values[base + 10] < 0) - break; - if (values[base + 10] == 0) - { - values[base + 10] = 1; - // If day of month > 28, this is - // certainly lastSun rule. - if (values[base + 2] > 28) - values[base + 2] = 3; - // If day of month isn't in the last - // week, it can't be lastSun rule. - else if (values[base + 2] - <= values[base + 3] - 7) - values[base + 3] = 2; - } - if (values[base + 10] == 1) - { - // If day of month is > 28, this is - // certainly lastSun rule. - if (day_of_month > 28) - values[base + 10] = 3; - // If day of month isn't in the last - // week, it can't be lastSun rule. - else if (day_of_month <= month_days - 7) - values[base + 10] = 2; - } - else if ((values[base + 10] == 2 - && day_of_month > 28) - || (values[base + 10] == 3 - && day_of_month <= month_days - 7)) - break; - } - else - { - // Must be fixed day in month rule. - if (day_of_month != values[base + 2] - || values[base + 10] > 0) - break; - values[base + 4] = day_of_week; - values[base + 10] = -1; - } - values[base + 0] -= 1; - } - } - - if (i < first) - { - for (i = 0; i < 2; i++) - { - int base = 11 * i; - if (values[base + 10] == 0) - continue; - if (values[base + 10] == -1) - { - int[] dayCount - = { 0, 31, 59, 90, 120, 151, - 181, 212, 243, 273, 304, 334 }; - int d = dayCount[values[base + 1] - - Calendar.JANUARY]; - d += values[base + 2]; - change_spec[i] = ",J" + Integer.toString(d); - } - else if (values[base + 10] == 2) - { - // If we haven't seen all days of the week, - // we can't be sure what the rule really is. - if (values[base + 8] + 6 != values[base + 9]) - continue; - - int d; - d = values[base + 1] - Calendar.JANUARY + 1; - // E.g. Sun >= 5 is not representable in POSIX - // TZ env string, use ",Am.n.d" extension - // where m is month 1 .. 12, n is the date on - // or after which it happens and d is day - // of the week, 0 .. 6. So Sun >= 5 in April - // is ",A4.5.0". - if ((values[base + 8] % 7) == 1) - { - change_spec[i] = ",M" + Integer.toString(d); - d = (values[base + 8] + 6) / 7; - } - else - { - change_spec[i] = ",A" + Integer.toString(d); - d = values[base + 8]; - } - change_spec[i] += "." + Integer.toString(d); - d = values[base + 4] - Calendar.SUNDAY; - change_spec[i] += "." + Integer.toString(d); - } - else - { - // If we don't know whether this is lastSun or - // Sun >= 22 rule. That can be either because - // there was insufficient number of - // transitions, or February, where it is quite - // probable we haven't seen any 29th dates. - // For February, assume lastSun rule, otherwise - // punt. - if (values[base + 10] == 1 - && values[base + 1] != Calendar.FEBRUARY) - continue; - - int d; - d = values[base + 1] - Calendar.JANUARY + 1; - change_spec[i] = ",M" + Integer.toString(d); - d = values[base + 4] - Calendar.SUNDAY; - change_spec[i] += ".5." + Integer.toString(d); - } - - // Don't add time specification if time is - // 02:00:00. - if (values[base + 5] != 2 - || values[base + 6] != 0 - || values[base + 7] != 0) - { - int d = values[base + 5]; - change_spec[i] += "/" + Integer.toString(d); - if (values[base + 6] != 0 || values[base + 7] != 0) - { - d = values[base + 6]; - if (d < 10) - change_spec[i] - += ":0" + Integer.toString(d); - else - change_spec[i] += ":" + Integer.toString(d); - d = values[base + 7]; - if (d >= 10) - change_spec[i] - += ":" + Integer.toString(d); - else if (d > 0) - change_spec[i] - += ":0" + Integer.toString(d); - } - } - } - if (types[(timecnt - 1) & -2] == std_ind) - { - String tmp = change_spec[0]; - change_spec[0] = change_spec[1]; - change_spec[1] = tmp; - } - } - } - } - - if (tzstr == null) - { - tzstr = std_zonename + std_offset_string; - if (change_spec[0] != null && change_spec[1] != null) - tzstr += dst_zonename + dst_offset_string - + change_spec[0] + change_spec[1]; - } - - if (timecnt == 0) - return new SimpleTimeZone(offsets[std_ind] * 1000, - id != null ? id : tzstr); - - SimpleTimeZone endRule = createLastRule(tzstr); - if (endRule == null) - return null; - - /* Finally adjust the times array into the form the constructor - * expects. times[0] is special, the offset and DST flag there - * are for all times before that transition. Use the first non-DST - * type. For all other transitions, the data file has the type - * (<offset, isdst, zonename>) for the time interval starting - */ - for (int i = 0; i < typecnt; i++) - if ((typeflags[i] & (1 << 8)) == 0) - { - times[0] = (times[0] << SECS_SHIFT) | (offsets[i] & OFFSET_MASK); - break; - } - - for (int i = 1; i < timecnt; i++) - times[i] = (times[i] << SECS_SHIFT) - | (offsets[types[i - 1]] & OFFSET_MASK) - | ((typeflags[types[i - 1]] & (1 << 8)) != 0 ? IS_DST : 0); - - return new ZoneInfo(offsets[std_ind] * 1000, id != null ? id : tzstr, - times, endRule); + FileInputStream fis = new FileInputStream(file); + BufferedInputStream bis = new BufferedInputStream(fis); + dis = new DataInputStream(bis); + + // Make sure we are reading a tzfile. + byte[] tzif = new byte[5]; + dis.readFully(tzif); + int tzif2 = 4; + if (tzif[0] == 'T' && tzif[1] == 'Z' + && tzif[2] == 'i' && tzif[3] == 'f') + { + if (tzif[4] >= '2') + tzif2 = 8; + // Reserved bytes + skipFully(dis, 16 - 1); + } + else + // Darwin has tzdata files that don't start with the TZif marker + skipFully(dis, 16 - 5); + + int ttisgmtcnt = dis.readInt(); + int ttisstdcnt = dis.readInt(); + int leapcnt = dis.readInt(); + int timecnt = dis.readInt(); + int typecnt = dis.readInt(); + int charcnt = dis.readInt(); + if (tzif2 == 8) + { + skipFully(dis, timecnt * (4 + 1) + typecnt * (4 + 1 + 1) + charcnt + + leapcnt * (4 + 4) + ttisgmtcnt + ttisstdcnt); + + dis.readFully(tzif); + if (tzif[0] != 'T' || tzif[1] != 'Z' || tzif[2] != 'i' + || tzif[3] != 'f' || tzif[4] < '2') + return null; + + // Reserved bytes + skipFully(dis, 16 - 1); + ttisgmtcnt = dis.readInt(); + ttisstdcnt = dis.readInt(); + leapcnt = dis.readInt(); + timecnt = dis.readInt(); + typecnt = dis.readInt(); + charcnt = dis.readInt(); + } + + // Sanity checks + if (typecnt <= 0 || timecnt < 0 || charcnt < 0 + || leapcnt < 0 || ttisgmtcnt < 0 || ttisstdcnt < 0 + || ttisgmtcnt > typecnt || ttisstdcnt > typecnt) + return null; + + // Transition times + long[] times = new long[timecnt]; + for (int i = 0; i < timecnt; i++) + if (tzif2 == 8) + times[i] = dis.readLong(); + else + times[i] = (long) dis.readInt(); + + // Transition types + int[] types = new int[timecnt]; + for (int i = 0; i < timecnt; i++) + { + types[i] = dis.readByte(); + if (types[i] < 0) + types[i] += 256; + if (types[i] >= typecnt) + return null; + } + + // Types + int[] offsets = new int[typecnt]; + int[] typeflags = new int[typecnt]; + for (int i = 0; i < typecnt; i++) + { + offsets[i] = dis.readInt(); + if (offsets[i] >= IS_DST / 2 || offsets[i] <= -IS_DST / 2) + return null; + int dst = dis.readByte(); + int abbrind = dis.readByte(); + if (abbrind < 0) + abbrind += 256; + if (abbrind >= charcnt) + return null; + typeflags[i] = (dst != 0 ? (1 << 8) : 0) + abbrind; + } + + // Abbrev names + byte[] names = new byte[charcnt]; + dis.readFully(names); + + // Leap transitions, for now ignore + skipFully(dis, leapcnt * (tzif2 + 4) + ttisstdcnt + ttisgmtcnt); + + // tzIf2 format has optional POSIX TZ env string + String tzstr = null; + if (tzif2 == 8 && dis.readByte() == '\n') + { + tzstr = dis.readLine(); + if (tzstr.length() <= 0) + tzstr = null; + } + + // Get std/dst_offset and dst/non-dst time zone names. + int std_ind = -1; + int dst_ind = -1; + if (timecnt == 0) + std_ind = 0; + else + for (int i = timecnt - 1; i >= 0; i--) + { + if (std_ind == -1 && (typeflags[types[i]] & (1 << 8)) == 0) + std_ind = types[i]; + else if (dst_ind == -1 && (typeflags[types[i]] & (1 << 8)) != 0) + dst_ind = types[i]; + if (dst_ind != -1 && std_ind != -1) + break; + } + + if (std_ind == -1) + return null; + + int j = typeflags[std_ind] & 255; + while (j < charcnt && names[j] != 0) + j++; + String std_zonename = new String(names, typeflags[std_ind] & 255, + j - (typeflags[std_ind] & 255), + "ASCII"); + + String dst_zonename = ""; + if (dst_ind != -1) + { + j = typeflags[dst_ind] & 255; + while (j < charcnt && names[j] != 0) + j++; + dst_zonename = new String(names, typeflags[dst_ind] & 255, + j - (typeflags[dst_ind] & 255), "ASCII"); + } + + // Only use gmt offset when necessary. + // Also special case GMT+/- timezones. + String std_offset_string = ""; + String dst_offset_string = ""; + if (tzstr == null + && (dst_ind != -1 + || (offsets[std_ind] != 0 + && !std_zonename.startsWith("GMT+") + && !std_zonename.startsWith("GMT-")))) + { + std_offset_string = Integer.toString(-offsets[std_ind] / 3600); + int seconds = -offsets[std_ind] % 3600; + if (seconds != 0) + { + if (seconds < 0) + seconds *= -1; + if (seconds < 600) + std_offset_string += ":0" + Integer.toString(seconds / 60); + else + std_offset_string += ":" + Integer.toString(seconds / 60); + seconds = seconds % 60; + if (seconds >= 10) + std_offset_string += ":" + Integer.toString(seconds); + else if (seconds > 0) + std_offset_string += ":0" + Integer.toString(seconds); + } + + if (dst_ind != -1 && offsets[dst_ind] != offsets[std_ind] + 3600) + { + dst_offset_string = Integer.toString(-offsets[dst_ind] / 3600); + seconds = -offsets[dst_ind] % 3600; + if (seconds != 0) + { + if (seconds < 0) + seconds *= -1; + if (seconds < 600) + dst_offset_string + += ":0" + Integer.toString(seconds / 60); + else + dst_offset_string + += ":" + Integer.toString(seconds / 60); + seconds = seconds % 60; + if (seconds >= 10) + dst_offset_string += ":" + Integer.toString(seconds); + else if (seconds > 0) + dst_offset_string += ":0" + Integer.toString(seconds); + } + } + } + + /* + * If no tzIf2 POSIX TZ string is available and the timezone + * uses DST, try to guess the last rule by trying to make + * sense from transitions at 5 years in the future and onwards. + * tzdata actually uses only 3 forms of rules: + * fixed date within a month, e.g. change on April, 5th + * 1st weekday on or after Nth: change on Sun>=15 in April + * last weekday in a month: change on lastSun in April + */ + String[] change_spec = { null, null }; + if (tzstr == null && dst_ind != -1 && timecnt > 10) + { + long nowPlus5y = System.currentTimeMillis() / 1000 + + 5 * 365 * 86400; + int first; + + for (first = timecnt - 1; first >= 0; first--) + if (times[first] < nowPlus5y + || (types[first] != std_ind && types[first] != dst_ind) + || types[first] != types[timecnt - 2 + ((first ^ timecnt) & 1)]) + break; + first++; + + if (timecnt - first >= 10 && types[timecnt - 1] != types[timecnt - 2]) + { + GregorianCalendar cal + = new GregorianCalendar(new SimpleTimeZone(0, "GMT")); + + int[] values = new int[2 * 11]; + int i; + for (i = timecnt - 1; i >= first; i--) + { + int base = (i % 2) * 11; + int offset = offsets[types[i > first ? i - 1 : i + 1]]; + cal.setTimeInMillis((times[i] + offset) * 1000); + if (i >= timecnt - 2) + { + values[base + 0] = cal.get(Calendar.YEAR); + values[base + 1] = cal.get(Calendar.MONTH); + values[base + 2] = cal.get(Calendar.DAY_OF_MONTH); + values[base + 3] + = cal.getActualMaximum(Calendar.DAY_OF_MONTH); + values[base + 4] = cal.get(Calendar.DAY_OF_WEEK); + values[base + 5] = cal.get(Calendar.HOUR_OF_DAY); + values[base + 6] = cal.get(Calendar.MINUTE); + values[base + 7] = cal.get(Calendar.SECOND); + values[base + 8] = values[base + 2]; // Range start + values[base + 9] = values[base + 2]; // Range end + values[base + 10] = 0; // Determined type + } + else + { + int year = cal.get(Calendar.YEAR); + int month = cal.get(Calendar.MONTH); + int day_of_month = cal.get(Calendar.DAY_OF_MONTH); + int month_days + = cal.getActualMaximum(Calendar.DAY_OF_MONTH); + int day_of_week = cal.get(Calendar.DAY_OF_WEEK); + int hour = cal.get(Calendar.HOUR_OF_DAY); + int minute = cal.get(Calendar.MINUTE); + int second = cal.get(Calendar.SECOND); + if (year != values[base + 0] - 1 + || month != values[base + 1] + || hour != values[base + 5] + || minute != values[base + 6] + || second != values[base + 7]) + break; + if (day_of_week == values[base + 4]) + { + // Either a Sun>=8 or lastSun rule. + if (day_of_month < values[base + 8]) + values[base + 8] = day_of_month; + if (day_of_month > values[base + 9]) + values[base + 9] = day_of_month; + if (values[base + 10] < 0) + break; + if (values[base + 10] == 0) + { + values[base + 10] = 1; + // If day of month > 28, this is + // certainly lastSun rule. + if (values[base + 2] > 28) + values[base + 2] = 3; + // If day of month isn't in the last + // week, it can't be lastSun rule. + else if (values[base + 2] + <= values[base + 3] - 7) + values[base + 3] = 2; + } + if (values[base + 10] == 1) + { + // If day of month is > 28, this is + // certainly lastSun rule. + if (day_of_month > 28) + values[base + 10] = 3; + // If day of month isn't in the last + // week, it can't be lastSun rule. + else if (day_of_month <= month_days - 7) + values[base + 10] = 2; + } + else if ((values[base + 10] == 2 + && day_of_month > 28) + || (values[base + 10] == 3 + && day_of_month <= month_days - 7)) + break; + } + else + { + // Must be fixed day in month rule. + if (day_of_month != values[base + 2] + || values[base + 10] > 0) + break; + values[base + 4] = day_of_week; + values[base + 10] = -1; + } + values[base + 0] -= 1; + } + } + + if (i < first) + { + for (i = 0; i < 2; i++) + { + int base = 11 * i; + if (values[base + 10] == 0) + continue; + if (values[base + 10] == -1) + { + int[] dayCount + = { 0, 31, 59, 90, 120, 151, + 181, 212, 243, 273, 304, 334 }; + int d = dayCount[values[base + 1] + - Calendar.JANUARY]; + d += values[base + 2]; + change_spec[i] = ",J" + Integer.toString(d); + } + else if (values[base + 10] == 2) + { + // If we haven't seen all days of the week, + // we can't be sure what the rule really is. + if (values[base + 8] + 6 != values[base + 9]) + continue; + + int d; + d = values[base + 1] - Calendar.JANUARY + 1; + // E.g. Sun >= 5 is not representable in POSIX + // TZ env string, use ",Am.n.d" extension + // where m is month 1 .. 12, n is the date on + // or after which it happens and d is day + // of the week, 0 .. 6. So Sun >= 5 in April + // is ",A4.5.0". + if ((values[base + 8] % 7) == 1) + { + change_spec[i] = ",M" + Integer.toString(d); + d = (values[base + 8] + 6) / 7; + } + else + { + change_spec[i] = ",A" + Integer.toString(d); + d = values[base + 8]; + } + change_spec[i] += "." + Integer.toString(d); + d = values[base + 4] - Calendar.SUNDAY; + change_spec[i] += "." + Integer.toString(d); + } + else + { + // If we don't know whether this is lastSun or + // Sun >= 22 rule. That can be either because + // there was insufficient number of + // transitions, or February, where it is quite + // probable we haven't seen any 29th dates. + // For February, assume lastSun rule, otherwise + // punt. + if (values[base + 10] == 1 + && values[base + 1] != Calendar.FEBRUARY) + continue; + + int d; + d = values[base + 1] - Calendar.JANUARY + 1; + change_spec[i] = ",M" + Integer.toString(d); + d = values[base + 4] - Calendar.SUNDAY; + change_spec[i] += ".5." + Integer.toString(d); + } + + // Don't add time specification if time is + // 02:00:00. + if (values[base + 5] != 2 + || values[base + 6] != 0 + || values[base + 7] != 0) + { + int d = values[base + 5]; + change_spec[i] += "/" + Integer.toString(d); + if (values[base + 6] != 0 || values[base + 7] != 0) + { + d = values[base + 6]; + if (d < 10) + change_spec[i] + += ":0" + Integer.toString(d); + else + change_spec[i] += ":" + Integer.toString(d); + d = values[base + 7]; + if (d >= 10) + change_spec[i] + += ":" + Integer.toString(d); + else if (d > 0) + change_spec[i] + += ":0" + Integer.toString(d); + } + } + } + if (types[(timecnt - 1) & -2] == std_ind) + { + String tmp = change_spec[0]; + change_spec[0] = change_spec[1]; + change_spec[1] = tmp; + } + } + } + } + + if (tzstr == null) + { + tzstr = std_zonename + std_offset_string; + if (change_spec[0] != null && change_spec[1] != null) + tzstr += dst_zonename + dst_offset_string + + change_spec[0] + change_spec[1]; + } + + if (timecnt == 0) + return new SimpleTimeZone(offsets[std_ind] * 1000, + id != null ? id : tzstr); + + SimpleTimeZone endRule = createLastRule(tzstr); + if (endRule == null) + return null; + + /* Finally adjust the times array into the form the constructor + * expects. times[0] is special, the offset and DST flag there + * are for all times before that transition. Use the first non-DST + * type. For all other transitions, the data file has the type + * (<offset, isdst, zonename>) for the time interval starting + */ + for (int i = 0; i < typecnt; i++) + if ((typeflags[i] & (1 << 8)) == 0) + { + times[0] = (times[0] << SECS_SHIFT) | (offsets[i] & OFFSET_MASK); + break; + } + + for (int i = 1; i < timecnt; i++) + times[i] = (times[i] << SECS_SHIFT) + | (offsets[types[i - 1]] & OFFSET_MASK) + | ((typeflags[types[i - 1]] & (1 << 8)) != 0 ? IS_DST : 0); + + return new ZoneInfo(offsets[std_ind] * 1000, id != null ? id : tzstr, + times, endRule); } catch (IOException ioe) { - // Parse error, not a proper tzfile. - return null; + // Parse error, not a proper tzfile. + return null; } finally { - try - { - if (dis != null) - dis.close(); - } - catch(IOException ioe) - { - // Error while close, nothing we can do. - } + try + { + if (dis != null) + dis.close(); + } + catch(IOException ioe) + { + // Error while close, nothing we can do. + } } } @@ -865,10 +865,10 @@ public class ZoneInfo extends TimeZone { while (l > 0) { - long k = is.skip(l); - if (k <= 0) - throw new EOFException(); - l -= k; + long k = is.skip(l); + if (k <= 0) + throw new EOFException(); + l -= k; } } @@ -887,146 +887,146 @@ public class ZoneInfo extends TimeZone int dstOffs; try { - int idLength = tzstr.length(); - - int index = 0; - int prevIndex; - char c; - - // get std - do - c = tzstr.charAt(index); - while (c != '+' && c != '-' && c != ',' && c != ':' - && ! Character.isDigit(c) && c != '\0' && ++index < idLength); - - if (index >= idLength) - return new SimpleTimeZone(0, tzstr); - - stdName = tzstr.substring(0, index); - prevIndex = index; - - // get the std offset - do - c = tzstr.charAt(index++); - while ((c == '-' || c == '+' || c == ':' || Character.isDigit(c)) - && index < idLength); - if (index < idLength) - index--; - - { // convert the dst string to a millis number - String offset = tzstr.substring(prevIndex, index); - prevIndex = index; - - if (offset.charAt(0) == '+' || offset.charAt(0) == '-') - stdOffs = parseTime(offset.substring(1)); - else - stdOffs = parseTime(offset); - - if (offset.charAt(0) == '-') - stdOffs = -stdOffs; - - // TZ timezone offsets are positive when WEST of the meridian. - stdOffs = -stdOffs; - } - - // Done yet? (Format: std offset) - if (index >= idLength) - return new SimpleTimeZone(stdOffs, stdName); - - // get dst - do - c = tzstr.charAt(index); - while (c != '+' && c != '-' && c != ',' && c != ':' - && ! Character.isDigit(c) && c != '\0' && ++index < idLength); - - // Done yet? (Format: std offset dst) - if (index >= idLength) - return new SimpleTimeZone(stdOffs, stdName); - - // get the dst offset - prevIndex = index; - do - c = tzstr.charAt(index++); - while ((c == '-' || c == '+' || c == ':' || Character.isDigit(c)) - && index < idLength); - if (index < idLength) - index--; - - if (index == prevIndex && (c == ',' || c == ';')) - { - // Missing dst offset defaults to one hour ahead of standard - // time. - dstOffs = stdOffs + 60 * 60 * 1000; - } - else - { // convert the dst string to a millis number - String offset = tzstr.substring(prevIndex, index); - prevIndex = index; - - if (offset.charAt(0) == '+' || offset.charAt(0) == '-') - dstOffs = parseTime(offset.substring(1)); - else - dstOffs = parseTime(offset); - - if (offset.charAt(0) == '-') - dstOffs = -dstOffs; - - // TZ timezone offsets are positive when WEST of the meridian. - dstOffs = -dstOffs; - } - - // Done yet? (Format: std offset dst offset) - if (index >= idLength) - return new SimpleTimeZone(stdOffs, stdName); - - // get the DST rule - if (tzstr.charAt(index) == ',' - || tzstr.charAt(index) == ';') - { - index++; - int offs = index; - while (tzstr.charAt(index) != ',' - && tzstr.charAt(index) != ';') - index++; - String startTime = tzstr.substring(offs, index); - index++; - String endTime = tzstr.substring(index); - - index = startTime.indexOf('/'); - int startMillis; - int endMillis; - String startDate; - String endDate; - if (index != -1) - { - startDate = startTime.substring(0, index); - startMillis = parseTime(startTime.substring(index + 1)); - } - else - { - startDate = startTime; - // if time isn't given, default to 2:00:00 AM. - startMillis = 2 * 60 * 60 * 1000; - } - index = endTime.indexOf('/'); - if (index != -1) - { - endDate = endTime.substring(0, index); - endMillis = parseTime(endTime.substring(index + 1)); - } - else - { - endDate = endTime; - // if time isn't given, default to 2:00:00 AM. - endMillis = 2 * 60 * 60 * 1000; - } - - int[] start = getDateParams(startDate); - int[] end = getDateParams(endDate); - return new SimpleTimeZone(stdOffs, tzstr, start[0], start[1], - start[2], startMillis, end[0], end[1], - end[2], endMillis, (dstOffs - stdOffs)); - } + int idLength = tzstr.length(); + + int index = 0; + int prevIndex; + char c; + + // get std + do + c = tzstr.charAt(index); + while (c != '+' && c != '-' && c != ',' && c != ':' + && ! Character.isDigit(c) && c != '\0' && ++index < idLength); + + if (index >= idLength) + return new SimpleTimeZone(0, tzstr); + + stdName = tzstr.substring(0, index); + prevIndex = index; + + // get the std offset + do + c = tzstr.charAt(index++); + while ((c == '-' || c == '+' || c == ':' || Character.isDigit(c)) + && index < idLength); + if (index < idLength) + index--; + + { // convert the dst string to a millis number + String offset = tzstr.substring(prevIndex, index); + prevIndex = index; + + if (offset.charAt(0) == '+' || offset.charAt(0) == '-') + stdOffs = parseTime(offset.substring(1)); + else + stdOffs = parseTime(offset); + + if (offset.charAt(0) == '-') + stdOffs = -stdOffs; + + // TZ timezone offsets are positive when WEST of the meridian. + stdOffs = -stdOffs; + } + + // Done yet? (Format: std offset) + if (index >= idLength) + return new SimpleTimeZone(stdOffs, stdName); + + // get dst + do + c = tzstr.charAt(index); + while (c != '+' && c != '-' && c != ',' && c != ':' + && ! Character.isDigit(c) && c != '\0' && ++index < idLength); + + // Done yet? (Format: std offset dst) + if (index >= idLength) + return new SimpleTimeZone(stdOffs, stdName); + + // get the dst offset + prevIndex = index; + do + c = tzstr.charAt(index++); + while ((c == '-' || c == '+' || c == ':' || Character.isDigit(c)) + && index < idLength); + if (index < idLength) + index--; + + if (index == prevIndex && (c == ',' || c == ';')) + { + // Missing dst offset defaults to one hour ahead of standard + // time. + dstOffs = stdOffs + 60 * 60 * 1000; + } + else + { // convert the dst string to a millis number + String offset = tzstr.substring(prevIndex, index); + prevIndex = index; + + if (offset.charAt(0) == '+' || offset.charAt(0) == '-') + dstOffs = parseTime(offset.substring(1)); + else + dstOffs = parseTime(offset); + + if (offset.charAt(0) == '-') + dstOffs = -dstOffs; + + // TZ timezone offsets are positive when WEST of the meridian. + dstOffs = -dstOffs; + } + + // Done yet? (Format: std offset dst offset) + if (index >= idLength) + return new SimpleTimeZone(stdOffs, stdName); + + // get the DST rule + if (tzstr.charAt(index) == ',' + || tzstr.charAt(index) == ';') + { + index++; + int offs = index; + while (tzstr.charAt(index) != ',' + && tzstr.charAt(index) != ';') + index++; + String startTime = tzstr.substring(offs, index); + index++; + String endTime = tzstr.substring(index); + + index = startTime.indexOf('/'); + int startMillis; + int endMillis; + String startDate; + String endDate; + if (index != -1) + { + startDate = startTime.substring(0, index); + startMillis = parseTime(startTime.substring(index + 1)); + } + else + { + startDate = startTime; + // if time isn't given, default to 2:00:00 AM. + startMillis = 2 * 60 * 60 * 1000; + } + index = endTime.indexOf('/'); + if (index != -1) + { + endDate = endTime.substring(0, index); + endMillis = parseTime(endTime.substring(index + 1)); + } + else + { + endDate = endTime; + // if time isn't given, default to 2:00:00 AM. + endMillis = 2 * 60 * 60 * 1000; + } + + int[] start = getDateParams(startDate); + int[] end = getDateParams(endDate); + return new SimpleTimeZone(stdOffs, tzstr, start[0], start[1], + start[2], startMillis, end[0], end[1], + end[2], endMillis, (dstOffs - stdOffs)); + } } catch (IndexOutOfBoundsException _) @@ -1057,44 +1057,44 @@ public class ZoneInfo extends TimeZone if (type > 0) { - int day; - - // Month, week of month, day of week - // "Mm.w.d". d is between 0 (Sunday) and 6. Week w is - // between 1 and 5; Week 1 is the first week in which day d - // occurs and Week 5 specifies the last d day in the month. - // Month m is between 1 and 12. - - // Month, day of month, day of week - // ZoneInfo extension, not in POSIX - // "Am.n.d". d is between 0 (Sunday) and 6. Day of month n is - // between 1 and 25. Month m is between 1 and 12. - - month = Integer.parseInt(date.substring(1, date.indexOf('.'))); - int week = Integer.parseInt(date.substring(date.indexOf('.') + 1, - date.lastIndexOf('.'))); - int dayOfWeek = Integer.parseInt(date.substring(date.lastIndexOf('.') - + 1)); - dayOfWeek++; // Java day of week is one-based, Sunday is first day. - - if (type == 2) - { - day = week; - dayOfWeek = -dayOfWeek; - } - else if (week == 5) - day = -1; // last day of month is -1 in java, 5 in TZ - else - { - // First day of week starting on or after. For example, - // to specify the second Sunday of April, set month to - // APRIL, day-of-month to 8, and day-of-week to -SUNDAY. - day = (week - 1) * 7 + 1; - dayOfWeek = -dayOfWeek; - } - - month--; // Java month is zero-based. - return new int[] { month, day, dayOfWeek }; + int day; + + // Month, week of month, day of week + // "Mm.w.d". d is between 0 (Sunday) and 6. Week w is + // between 1 and 5; Week 1 is the first week in which day d + // occurs and Week 5 specifies the last d day in the month. + // Month m is between 1 and 12. + + // Month, day of month, day of week + // ZoneInfo extension, not in POSIX + // "Am.n.d". d is between 0 (Sunday) and 6. Day of month n is + // between 1 and 25. Month m is between 1 and 12. + + month = Integer.parseInt(date.substring(1, date.indexOf('.'))); + int week = Integer.parseInt(date.substring(date.indexOf('.') + 1, + date.lastIndexOf('.'))); + int dayOfWeek = Integer.parseInt(date.substring(date.lastIndexOf('.') + + 1)); + dayOfWeek++; // Java day of week is one-based, Sunday is first day. + + if (type == 2) + { + day = week; + dayOfWeek = -dayOfWeek; + } + else if (week == 5) + day = -1; // last day of month is -1 in java, 5 in TZ + else + { + // First day of week starting on or after. For example, + // to specify the second Sunday of April, set month to + // APRIL, day-of-month to 8, and day-of-week to -SUNDAY. + day = (week - 1) * 7 + 1; + dayOfWeek = -dayOfWeek; + } + + month--; // Java month is zero-based. + return new int[] { month, day, dayOfWeek }; } // julian day, either zero-based 0<=n<=365 (incl feb 29) @@ -1103,13 +1103,13 @@ public class ZoneInfo extends TimeZone if (date.charAt(0) != 'J' || date.charAt(0) != 'j') { - julianDay = Integer.parseInt(date.substring(1)); - julianDay++; // make 1-based - // Adjust day count to include feb 29. - dayCount = new int[] - { - 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 - }; + julianDay = Integer.parseInt(date.substring(1)); + julianDay++; // make 1-based + // Adjust day count to include feb 29. + dayCount = new int[] + { + 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 + }; } else // 1-based julian day @@ -1118,9 +1118,9 @@ public class ZoneInfo extends TimeZone int i = 11; while (i > 0) if (dayCount[i] < julianDay) - break; + break; else - i--; + i--; julianDay -= dayCount[i]; month = i; return new int[] { month, julianDay, 0 }; @@ -1137,9 +1137,9 @@ public class ZoneInfo extends TimeZone while (i < time.length()) if (time.charAt(i) == ':') - break; + break; else - i++; + i++; millis = 60 * 60 * 1000 * Integer.parseInt(time.substring(0, i)); if (i >= time.length()) return millis; @@ -1147,9 +1147,9 @@ public class ZoneInfo extends TimeZone int iprev = ++i; while (i < time.length()) if (time.charAt(i) == ':') - break; + break; else - i++; + i++; millis += 60 * 1000 * Integer.parseInt(time.substring(iprev, i)); if (i >= time.length()) return millis; diff --git a/gnu/java/util/jar/JarUtils.java b/gnu/java/util/jar/JarUtils.java index c35daec55..eb6a89e61 100644 --- a/gnu/java/util/jar/JarUtils.java +++ b/gnu/java/util/jar/JarUtils.java @@ -70,7 +70,7 @@ public abstract class JarUtils /** * The original string representation of the manifest version attribute name. - */ + */ public static final String MANIFEST_VERSION = "Manifest-Version"; /** @@ -378,20 +378,20 @@ public abstract class JarUtils * The basic method for writing <code>Mainfest</code> attributes. This * implementation respects the rule stated in the Jar Specification concerning * the maximum allowed line length; i.e. - * + * * <pre> * No line may be longer than 72 bytes (not characters), in its UTF8-encoded * form. If a value would make the initial line longer than this, it should * be continued on extra lines (each starting with a single SPACE). * </pre> - * + * * and - * + * * <pre> * Because header names cannot be continued, the maximum length of a header * name is 70 bytes (there must be a colon and a SPACE after the name). * </pre> - * + * * @param name the name of the attribute. * @param value the value of the attribute. * @param out the output stream to write the attribute's name/value pair to. diff --git a/gnu/java/util/prefs/FileBasedFactory.java b/gnu/java/util/prefs/FileBasedFactory.java index e5f24efa3..91ea861c4 100644 --- a/gnu/java/util/prefs/FileBasedFactory.java +++ b/gnu/java/util/prefs/FileBasedFactory.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/util/prefs/FileBasedPreferences.java b/gnu/java/util/prefs/FileBasedPreferences.java index f7566dddd..f89ed6be2 100644 --- a/gnu/java/util/prefs/FileBasedPreferences.java +++ b/gnu/java/util/prefs/FileBasedPreferences.java @@ -57,7 +57,7 @@ import java.util.prefs.BackingStoreException; * beneath the user's home directory. The preferences for the node are * stored in a single properties file in that directory. Sub-nodes are * stored in subdirectories. This implementation uses file locking to - * mediate access to the properties files. + * mediate access to the properties files. */ public class FileBasedPreferences extends AbstractPreferences @@ -217,7 +217,7 @@ public class FileBasedPreferences { // Write the underlying file. directory.mkdirs(); - + FileOutputStream fos = null; FileLock lock = null; try diff --git a/gnu/java/util/prefs/GConfBasedFactory.java b/gnu/java/util/prefs/GConfBasedFactory.java index ae734b609..f5a189471 100644 --- a/gnu/java/util/prefs/GConfBasedFactory.java +++ b/gnu/java/util/prefs/GConfBasedFactory.java @@ -43,7 +43,7 @@ import java.util.prefs.PreferencesFactory; /** * Factory object that generates a Preferences nodes that are read from a GConf * daemon. - * + * * @author Mario Torre <neugens@limasoftware.net> */ public class GConfBasedFactory implements PreferencesFactory @@ -58,7 +58,7 @@ public class GConfBasedFactory implements PreferencesFactory /** * Returns the system root preference node. - * + * * @see java.util.prefs.PreferencesFactory#systemRoot() */ public Preferences systemRoot() @@ -68,7 +68,7 @@ public class GConfBasedFactory implements PreferencesFactory /** * Returns the user root preference node corresponding to the calling user. - * + * * @see java.util.prefs.PreferencesFactory#userRoot() */ public Preferences userRoot() diff --git a/gnu/java/util/prefs/GConfBasedPreferences.java b/gnu/java/util/prefs/GConfBasedPreferences.java index c26fe63c9..e3374eee9 100644 --- a/gnu/java/util/prefs/GConfBasedPreferences.java +++ b/gnu/java/util/prefs/GConfBasedPreferences.java @@ -54,22 +54,22 @@ import java.util.prefs.BackingStoreException; * <br /> * User Root:<br /> * <br /> - * + * * <pre> * gnu.java.util.prefs.gconf.user_root * </pre> - * + * * <br /> * <br /> * and System Root:<br /> * <br /> - * + * * <pre> * gnu.java.util.prefs.gconf.system_root * </pre> - * + * * <br /> - * + * * @author Mario Torre <neugens@limasoftware.net> */ public class GConfBasedPreferences @@ -115,7 +115,7 @@ public class GConfBasedPreferences * Creates a new preference node given a parent node and a name, which has to * be relative to its parent. When <code>isUser</code> is true it will be user * node otherwise it will be a system node. - * + * * @param parent The parent node of this newly created node. * @param name A name relative to the parent node. * @param isUser Set to <code>true</code> initializes this node to be @@ -142,7 +142,7 @@ public class GConfBasedPreferences absolutePath = absolutePath.substring(0, index + 1); absolutePath = absolutePath + GConfNativePeer.escapeString(name); } - + this.node = this.getRealRoot(isUser) + absolutePath; boolean nodeExist = backend.nodeExist(this.node); @@ -153,7 +153,7 @@ public class GConfBasedPreferences /** * Returns a child node with the given name. * If the child node does not exists, it will be created. - * + * * @param name The name of the requested node. * @return A new reference to the node, creating the node if it is necessary. */ @@ -162,10 +162,10 @@ public class GConfBasedPreferences // we don't check anything here, if the node is a new node this will be // detected in the constructor, so we simply return a new reference to // the requested node. - + GConfBasedPreferences preferenceNode = new GConfBasedPreferences(this, name, this.isUser); - + return preferenceNode; } @@ -173,7 +173,7 @@ public class GConfBasedPreferences * Returns an array of names of the children of this preference node. * If the current node does not have children, the returned array will be * of <code>size</code> 0 (that is, not <code>null</code>). - * + * * @return A <code>String</code> array of names of children of the current * node. * @throws BackingStoreException if this operation cannot be completed. @@ -192,7 +192,7 @@ public class GConfBasedPreferences * GConf handles this for us asynchronously. More over, both sync and flush * have the same meaning in this class, so calling sync has exactly the same * effect. - * + * * @see #sync * @throws BackingStoreException if this operation cannot be completed. */ @@ -203,7 +203,7 @@ public class GConfBasedPreferences /** * Request a flush. - * + * * @see #flush * @throws BackingStoreException if this operation cannot be completed. */ @@ -216,7 +216,7 @@ public class GConfBasedPreferences * Returns all of the key in this preference node. * If the current node does not have preferences, the returned array will be * of size zero. - * + * * @return A <code>String</code> array of keys stored under the current * node. * @throws BackingStoreException if this operation cannot be completed. @@ -233,7 +233,7 @@ public class GConfBasedPreferences /** * Does a recursive postorder traversal of the preference tree, starting from * the given directory invalidating every preference found in the node. - * + * * @param directory The name of the starting directory (node) */ private void postorderRemove(String directory) @@ -271,7 +271,7 @@ public class GConfBasedPreferences /** * Stores the given key-value pair into this preference node. - * + * * @param key The key of this preference. * @param value The value of this preference. */ @@ -293,7 +293,7 @@ public class GConfBasedPreferences /** * Removes the given key from this preference node. * If the key does not exist, no operation is performed. - * + * * @param key The key to remove. */ protected void removeSpi(String key) @@ -305,7 +305,7 @@ public class GConfBasedPreferences * Suggest a sync to the backend. Actually, this is only a suggestion as GConf * handles this for us asynchronously. More over, both sync and flush have the * same meaning in this class, so calling flush has exactly the same effect. - * + * * @see #flush * @throws BackingStoreException if this operation cannot be completed due to * a failure in the backing store, or inability to communicate with @@ -318,7 +318,7 @@ public class GConfBasedPreferences /** * Request a sync. - * + * * @see #sync * @throws BackingStoreException if this operation cannot be completed due to * a failure in the backing store, or inability to communicate with @@ -333,7 +333,7 @@ public class GConfBasedPreferences * Returns the value of the given key. * If the keys does not have a value, or there is an error in the backing * store, <code>null</code> is returned instead. - * + * * @param key The key to retrieve. * @return The value associated with the given key. */ @@ -345,7 +345,7 @@ public class GConfBasedPreferences /** * Returns <code>true</code> if this preference node is a user node, * <code>false</code> if is a system preference node. - * + * * @return <code>true</code> if this preference node is a user node, * <code>false</code> if is a system preference node. */ @@ -360,18 +360,18 @@ public class GConfBasedPreferences /** * Builds a GConf key string suitable for operations on the backend. - * + * * @param key The key to convert into a valid GConf key. * @return A valid Gconf key. */ private String getGConfKey(String key) { String nodeName = ""; - + // strip key // please, note that all names are unescaped into the native peer key = GConfNativePeer.escapeString(key); - + if (this.node.endsWith("/")) { nodeName = this.node + key; @@ -380,13 +380,13 @@ public class GConfBasedPreferences { nodeName = this.node + "/" + key; } - + return nodeName; } /** * Builds the root node to use for this preference. - * + * * @param isUser Defines if this node is a user (<code>true</code>) or system * (<code>false</code>) node. * @return The real root of this preference tree. diff --git a/gnu/java/util/prefs/MemoryBasedFactory.java b/gnu/java/util/prefs/MemoryBasedFactory.java index 275b8796e..32ed12fc7 100644 --- a/gnu/java/util/prefs/MemoryBasedFactory.java +++ b/gnu/java/util/prefs/MemoryBasedFactory.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/util/prefs/MemoryBasedPreferences.java b/gnu/java/util/prefs/MemoryBasedPreferences.java index dc8237916..ee184d182 100644 --- a/gnu/java/util/prefs/MemoryBasedPreferences.java +++ b/gnu/java/util/prefs/MemoryBasedPreferences.java @@ -7,7 +7,7 @@ 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 diff --git a/gnu/java/util/prefs/NodeReader.java b/gnu/java/util/prefs/NodeReader.java index ae5510e1c..0a49fc777 100644 --- a/gnu/java/util/prefs/NodeReader.java +++ b/gnu/java/util/prefs/NodeReader.java @@ -7,7 +7,7 @@ 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 @@ -128,7 +128,7 @@ public class NodeReader { readNodes(subnode); skipTill("</node>"); } - + } private void readMap(Preferences node) @@ -169,7 +169,7 @@ public class NodeReader { while(true) { if (line == null) throw new InvalidPreferencesFormatException(s + " not found"); - + int index = line.indexOf(s); if (index == -1) { line = br.readLine(); @@ -199,7 +199,7 @@ public class NodeReader { while(true) { if (line == null) throw new InvalidPreferencesFormatException("unexpected EOF"); - + int start = line.indexOf("<"); if (start == -1) { line = br.readLine(); diff --git a/gnu/java/util/prefs/NodeWriter.java b/gnu/java/util/prefs/NodeWriter.java index d3c095351..3e4f972ed 100644 --- a/gnu/java/util/prefs/NodeWriter.java +++ b/gnu/java/util/prefs/NodeWriter.java @@ -7,7 +7,7 @@ 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 @@ -271,7 +271,7 @@ public class NodeWriter { } } - private void writeMap(Preferences node, int indent) + private void writeMap(Preferences node, int indent) throws BackingStoreException, IOException { // construct String used for indentation diff --git a/gnu/java/util/prefs/gconf/GConfNativePeer.java b/gnu/java/util/prefs/gconf/GConfNativePeer.java index 3c0291959..64fc0498a 100644 --- a/gnu/java/util/prefs/gconf/GConfNativePeer.java +++ b/gnu/java/util/prefs/gconf/GConfNativePeer.java @@ -43,7 +43,7 @@ import java.util.prefs.BackingStoreException; /** * Native peer for GConf based preference backend. - * + * * @author Mario Torre <neugens@limasoftware.net> */ public final class GConfNativePeer @@ -59,7 +59,7 @@ public final class GConfNativePeer /** * Queries whether the node <code>node</code> exists in theGConf database. * Returns <code>true</code> or <code>false</code>. - * + * * @param node the node to check. */ public boolean nodeExist(String node) @@ -72,7 +72,7 @@ public final class GConfNativePeer * exist before (ie it was unset or it only had a default value). * Key names must be valid GConf key names, that is, there can be more * restrictions than for normal Preference Backend. - * + * * @param key the key to alter (or add). * @param value the new value for this key. * @return true if the key was updated, false otherwise. @@ -86,7 +86,7 @@ public final class GConfNativePeer * Unsets the value of key; if key is already unset, has no effect. Depending * on the GConf daemon, unsetting a key may have the side effect to remove it * completely form the database. - * + * * @param key the key to unset. * @return true on success, false if the key was not updated. */ @@ -97,7 +97,7 @@ public final class GConfNativePeer /** * Gets the value of a configuration key. - * + * * @param key the configuration key. * @return the values of this key, null if the key is not valid. */ @@ -110,7 +110,7 @@ public final class GConfNativePeer * Lists the key in the given node. Does not list subnodes. Keys names are the * stripped names (name relative to the current node) of the keys stored in * this node. - * + * * @param node the node where keys are stored. * @return a java.util.List of keys. If there are no keys in the given node, a * list of size 0 is returned. @@ -123,7 +123,7 @@ public final class GConfNativePeer /** * Lists the subnodes in <code>node</code>. The returned list contains * allocated strings. Each string is the name relative tho the given node. - * + * * @param node the node to get subnodes from. If there are no subnodes in the * given node, a list of size 0 is returned. */ @@ -139,7 +139,7 @@ public final class GConfNativePeer { return gconf_escape_key(plain); } - + /** * Unescape a string escaped with {@link #escapeString}. */ @@ -147,7 +147,7 @@ public final class GConfNativePeer { return gconf_unescape_key(escaped); } - + /** * Suggest to the backend GConf daemon to synch with the database. */ @@ -155,7 +155,7 @@ public final class GConfNativePeer { gconf_suggest_sync(); } - + protected void finalize() throws Throwable { try @@ -181,7 +181,7 @@ public final class GConfNativePeer * It is meant to be used by the static initializer. */ native synchronized static final private void init_id_cache(); - + /** * Initialize the GConf native peer. This is meant to be used by the * class constructor. @@ -196,7 +196,7 @@ public final class GConfNativePeer /** * Queries the GConf database to see if the given node exists, returning * true if the node exist, false otherwise. - * + * * @param node the node to query for existence. * @return true if the node exist, false otherwise. */ @@ -206,7 +206,7 @@ public final class GConfNativePeer /** * Sets the given key/value pair into the GConf database. * The key must be a valid GConf key. - * + * * @param key the key to store in the GConf database * @param value the value to associate to the given key. * @return true if the change has effect, false otherwise. @@ -217,7 +217,7 @@ public final class GConfNativePeer /** * Returns the key associated to the given key. Null is returned if the * key is not valid. - * + * * @param key the key to return the value of. * @return The value associated to the given key, or null. */ @@ -226,7 +226,7 @@ public final class GConfNativePeer /** * Usets the given key, removing the key from the database. - * + * * @param key the key to remove. * @return true if the operation success, false otherwise. */ @@ -238,46 +238,46 @@ public final class GConfNativePeer */ native synchronized static final protected void gconf_suggest_sync() throws BackingStoreException; - + /** * Returns a list of all nodes under the given node. - * + * * @param node the source node. * @return A list of nodes under the given source node. */ native static synchronized final protected List<String> gconf_all_nodes(String node) throws BackingStoreException; - + /** * Returns a list of all keys stored in the given node. - * + * * @param node the source node. * @return A list of all keys stored in the given node. */ - native synchronized + native synchronized static final protected List<String> gconf_all_keys(String node) throws BackingStoreException; /** * Escape the input String so that it's a valid element for GConf. - * + * * @param plain the String to escape. * @return An escaped String for use with GConf. */ - native synchronized + native synchronized static final protected String gconf_escape_key(String plain); - + /** * Converts a string escaped with gconf_escape_key back into its * original form. - * - * @param escaped key as returned by gconf_escape_key + * + * @param escaped key as returned by gconf_escape_key * @return An unescaped key. */ - native synchronized + native synchronized static final protected String gconf_unescape_key(String escaped); - + static { System.loadLibrary("gconfpeer"); diff --git a/gnu/java/util/regex/BacktrackStack.java b/gnu/java/util/regex/BacktrackStack.java index 68472615e..b03fb8707 100644 --- a/gnu/java/util/regex/BacktrackStack.java +++ b/gnu/java/util/regex/BacktrackStack.java @@ -50,16 +50,16 @@ final class BacktrackStack /** A set of data to be used for backtracking. */ static class Backtrack { - /** REToken to which to go back */ + /** REToken to which to go back */ REToken token; - /** CharIndexed on which matches are being searched for. */ + /** CharIndexed on which matches are being searched for. */ CharIndexed input; - /** REMatch to be used by the REToken token. */ + /** REMatch to be used by the REToken token. */ REMatch match; - /** Some parameter used by the token's backtrack method. */ + /** Some parameter used by the token's backtrack method. */ Object param; Backtrack (REToken token, CharIndexed input, REMatch match, - Object param) + Object param) { this.token = token; this.input = input; @@ -104,7 +104,7 @@ final class BacktrackStack { for (int i = 0; i < size; i++) { - stack[i] = null; + stack[i] = null; } size = 0; } @@ -113,10 +113,10 @@ final class BacktrackStack { if (size >= capacity) { - capacity += CAPACITY_INCREMENT; - Backtrack[]newStack = new Backtrack[capacity]; - System.arraycopy (stack, 0, newStack, 0, size); - stack = newStack; + capacity += CAPACITY_INCREMENT; + Backtrack[]newStack = new Backtrack[capacity]; + System.arraycopy (stack, 0, newStack, 0, size); + stack = newStack; } stack[size++] = bt; } diff --git a/gnu/java/util/regex/CharIndexed.java b/gnu/java/util/regex/CharIndexed.java index 070547d7f..de4b1667f 100644 --- a/gnu/java/util/regex/CharIndexed.java +++ b/gnu/java/util/regex/CharIndexed.java @@ -82,7 +82,7 @@ public interface CharIndexed * true if the new cursor position is valid or cursor position is at * the end of input. */ - boolean move1 (int index); // I cannot think of a better name for this. + boolean move1 (int index); // I cannot think of a better name for this. /** * Returns true if the most recent move() operation placed the cursor diff --git a/gnu/java/util/regex/CharIndexedInputStream.java b/gnu/java/util/regex/CharIndexedInputStream.java index e42710b5d..d6340298a 100644 --- a/gnu/java/util/regex/CharIndexedInputStream.java +++ b/gnu/java/util/regex/CharIndexedInputStream.java @@ -45,7 +45,7 @@ import java.io.InputStream; class CharIndexedInputStream implements CharIndexed { private static final int BUFFER_INCREMENT = 1024; - private static final int UNKNOWN = Integer.MAX_VALUE; // value for end + private static final int UNKNOWN = Integer.MAX_VALUE; // value for end private BufferedInputStream br; @@ -78,22 +78,22 @@ class CharIndexedInputStream implements CharIndexed { if (end == 1) return false; - end--; // closer to end + end--; // closer to end try { if (index != -1) - { - br.reset (); - } + { + br.reset (); + } int i = br.read (); br.mark (bufsize); if (i == -1) - { - end = 1; - cached = OUT_OF_BOUNDS; - return false; - } + { + end = 1; + cached = OUT_OF_BOUNDS; + return false; + } cached = (char) i; index = 1; } catch (IOException e) @@ -109,62 +109,62 @@ class CharIndexedInputStream implements CharIndexed { if (index == 0) { - return cached; + return cached; } else if (index >= end) { - return OUT_OF_BOUNDS; + return OUT_OF_BOUNDS; } else if (index == -1) { - return lookBehind[0]; + return lookBehind[0]; } else if (index == -2) { - return lookBehind[1]; + return lookBehind[1]; } else if (index < -2) { - return OUT_OF_BOUNDS; + return OUT_OF_BOUNDS; } else if (index >= bufsize) { - // Allocate more space in the buffer. - try - { - while (bufsize <= index) - bufsize += BUFFER_INCREMENT; - br.reset (); - br.mark (bufsize); - br.skip (index - 1); - } - catch (IOException e) - { - } + // Allocate more space in the buffer. + try + { + while (bufsize <= index) + bufsize += BUFFER_INCREMENT; + br.reset (); + br.mark (bufsize); + br.skip (index - 1); + } + catch (IOException e) + { + } } else if (this.index != index) { - try - { - br.reset (); - br.skip (index - 1); - } - catch (IOException e) - { - } + try + { + br.reset (); + br.skip (index - 1); + } + catch (IOException e) + { + } } char ch = OUT_OF_BOUNDS; try { int i = br.read (); - this.index = index + 1; // this.index is index of next pos relative to charAt(0) + this.index = index + 1; // this.index is index of next pos relative to charAt(0) if (i == -1) - { - // set flag that next should fail next time? - end = index; - return ch; - } + { + // set flag that next should fail next time? + end = index; + return ch; + } ch = (char) i; } catch (IOException ie) { diff --git a/gnu/java/util/regex/RE.java b/gnu/java/util/regex/RE.java index d064f7a35..5e9974a49 100644 --- a/gnu/java/util/regex/RE.java +++ b/gnu/java/util/regex/RE.java @@ -53,7 +53,7 @@ import java.util.ResourceBundle; * expressions. * <P> * A regular expression object (class RE) is compiled by constructing it - * from a String, StringBuffer or character array, with optional + * from a String, StringBuffer or character array, with optional * compilation flags (below) * and an optional syntax specification (see RESyntax; if not specified, * <code>RESyntax.RE_SYNTAX_PERL5</code> is used). @@ -110,7 +110,7 @@ import java.util.ResourceBundle; * <P> * You can optionally affect the execution environment by using a * combination of execution flags (constants listed below). - * + * * <P> * All operations on a regular expression are performed in a * thread-safe manner. @@ -281,7 +281,7 @@ public class RE extends REToken { if (messages == null) messages = - PropertyResourceBundle.getBundle (bundle, Locale.getDefault ()); + PropertyResourceBundle.getBundle (bundle, Locale.getDefault ()); return messages.getString (key); } @@ -335,7 +335,7 @@ public class RE extends REToken // internal constructor used for alternation private RE (REToken first, REToken last, int subs, int subIndex, - int minLength, int maxLength) + int minLength, int maxLength) { super (subIndex); firstToken = first; @@ -347,9 +347,9 @@ public class RE extends REToken } private RE (Object patternObj, int cflags, RESyntax syntax, int myIndex, - int nextSub) throws REException + int nextSub) throws REException { - super (myIndex); // Subexpression index of this token. + super (myIndex); // Subexpression index of this token. initialize (patternObj, cflags, syntax, myIndex, nextSub); } @@ -361,41 +361,41 @@ public class RE extends REToken // The meat of construction protected void initialize (Object patternObj, int cflags, RESyntax syntax, - int myIndex, int nextSub) throws REException + int myIndex, int nextSub) throws REException { char[] pattern; if (patternObj instanceof String) { - pattern = ((String) patternObj).toCharArray (); + pattern = ((String) patternObj).toCharArray (); } else if (patternObj instanceof char[]) { - pattern = (char[]) patternObj; + pattern = (char[]) patternObj; } else if (patternObj instanceof StringBuffer) { - pattern = new char[((StringBuffer) patternObj).length ()]; - ((StringBuffer) patternObj).getChars (0, pattern.length, pattern, 0); + pattern = new char[((StringBuffer) patternObj).length ()]; + ((StringBuffer) patternObj).getChars (0, pattern.length, pattern, 0); } else if (patternObj instanceof StringBuilder) { - pattern = new char[((StringBuilder) patternObj).length ()]; - ((StringBuilder) patternObj).getChars (0, pattern.length, pattern, 0); + pattern = new char[((StringBuilder) patternObj).length ()]; + ((StringBuilder) patternObj).getChars (0, pattern.length, pattern, 0); } else if (patternObj instanceof CPStringBuilder) { - pattern = new char[((CPStringBuilder) patternObj).length ()]; - ((CPStringBuilder) patternObj).getChars (0, pattern.length, pattern, - 0); + pattern = new char[((CPStringBuilder) patternObj).length ()]; + ((CPStringBuilder) patternObj).getChars (0, pattern.length, pattern, + 0); } else { - pattern = patternObj.toString ().toCharArray (); + pattern = patternObj.toString ().toCharArray (); } int pLength = pattern.length; - numSubs = 0; // Number of subexpressions in this token. + numSubs = 0; // Number of subexpressions in this token. ArrayList < REToken > branches = null; // linked list of tokens (sort of -- some closed loops can exist) @@ -429,956 +429,956 @@ public class RE extends REToken while (index < pLength) { - // read the next character unit (including backslash escapes) - index = getCharUnit (pattern, index, unit, quot); - - if (unit.bk) - if (unit.ch == 'Q') - { - quot = true; - continue; - } - else if (unit.ch == 'E') - { - quot = false; - continue; - } - if (quot) - unit.bk = false; - - if (((cflags & REG_X_COMMENTS) > 0) && (!unit.bk) && (!quot)) - { - if (Character.isWhitespace (unit.ch)) - { - continue; - } - if (unit.ch == '#') - { - for (int i = index; i < pLength; i++) - { - if (pattern[i] == '\n') - { - index = i + 1; - continue; - } - else if (pattern[i] == '\r') - { - if (i + 1 < pLength && pattern[i + 1] == '\n') - { - index = i + 2; - } - else - { - index = i + 1; - } - continue; - } - } - index = pLength; - continue; - } - } - - // ALTERNATION OPERATOR - // \| or | (if RE_NO_BK_VBAR) or newline (if RE_NEWLINE_ALT) - // not available if RE_LIMITED_OPS is set - - // TODO: the '\n' literal here should be a test against REToken.newline, - // which unfortunately may be more than a single character. - if (((unit.ch == '|' - && (syntax.get (RESyntax.RE_NO_BK_VBAR) ^ (unit.bk || quot))) - || (syntax.get (RESyntax.RE_NEWLINE_ALT) && (unit.ch == '\n') - && !(unit.bk || quot))) - && !syntax.get (RESyntax.RE_LIMITED_OPS)) - { - // make everything up to here be a branch. create vector if nec. - addToken (currentToken); - RE theBranch = - new RE (firstToken, lastToken, numSubs, subIndex, minimumLength, - maximumLength); - minimumLength = 0; - maximumLength = 0; - if (branches == null) - { - branches = new ArrayList < REToken > (); - } - branches.add (theBranch); - firstToken = lastToken = currentToken = null; - } - - // INTERVAL OPERATOR: - // {x} | {x,} | {x,y} (RE_INTERVALS && RE_NO_BK_BRACES) - // \{x\} | \{x,\} | \{x,y\} (RE_INTERVALS && !RE_NO_BK_BRACES) - // - // OPEN QUESTION: - // what is proper interpretation of '{' at start of string? - // - // This method used to check "repeat.empty.token" to avoid such regexp - // as "(a*){2,}", but now "repeat.empty.token" is allowed. - - else if ((unit.ch == '{') && syntax.get (RESyntax.RE_INTERVALS) - && (syntax. - get (RESyntax.RE_NO_BK_BRACES) ^ (unit.bk || quot))) - { - int newIndex = getMinMax (pattern, index, minMax, syntax); - if (newIndex > index) - { - if (minMax.first > minMax.second) - throw new - REException (getLocalizedMessage ("interval.order"), - REException.REG_BADRPT, newIndex); - if (currentToken == null) - throw new - REException (getLocalizedMessage ("repeat.no.token"), - REException.REG_BADRPT, newIndex); - if (currentToken instanceof RETokenRepeated) - throw new - REException (getLocalizedMessage ("repeat.chained"), - REException.REG_BADRPT, newIndex); - if (currentToken instanceof RETokenWordBoundary - || currentToken instanceof RETokenWordBoundary) - throw new - REException (getLocalizedMessage ("repeat.assertion"), - REException.REG_BADRPT, newIndex); - index = newIndex; - currentToken = - setRepeated (currentToken, minMax.first, minMax.second, - index); - } - else - { - addToken (currentToken); - currentToken = new RETokenChar (subIndex, unit.ch, insens); - if (insensUSASCII) - currentToken.unicodeAware = false; - } - } - - // LIST OPERATOR: - // [...] | [^...] - - else if ((unit.ch == '[') && !(unit.bk || quot)) - { - // Create a new RETokenOneOf - ParseCharClassResult result = - parseCharClass (subIndex, pattern, index, pLength, cflags, - syntax, 0); - addToken (currentToken); - currentToken = result.token; - index = result.index; - } - - // SUBEXPRESSIONS - // (...) | \(...\) depending on RE_NO_BK_PARENS - - else if ((unit.ch == '(') - && (syntax. - get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk || quot))) - { - boolean pure = false; - boolean comment = false; - boolean lookAhead = false; - boolean lookBehind = false; - boolean independent = false; - boolean negativelh = false; - boolean negativelb = false; - if ((index + 1 < pLength) && (pattern[index] == '?')) - { - switch (pattern[index + 1]) - { - case '!': - if (syntax.get (RESyntax.RE_LOOKAHEAD)) - { - pure = true; - negativelh = true; - lookAhead = true; - index += 2; - } - break; - case '=': - if (syntax.get (RESyntax.RE_LOOKAHEAD)) - { - pure = true; - lookAhead = true; - index += 2; - } - break; - case '<': - // We assume that if the syntax supports look-ahead, - // it also supports look-behind. - if (syntax.get (RESyntax.RE_LOOKAHEAD)) - { - index++; - switch (pattern[index + 1]) - { - case '!': - pure = true; - negativelb = true; - lookBehind = true; - index += 2; - break; - case '=': - pure = true; - lookBehind = true; - index += 2; - } - } - break; - case '>': - // We assume that if the syntax supports look-ahead, - // it also supports independent group. - if (syntax.get (RESyntax.RE_LOOKAHEAD)) - { - pure = true; - independent = true; - index += 2; - } - break; - case 'i': - case 'd': - case 'm': - case 's': - case 'u': - case 'x': - case '-': - if (!syntax.get (RESyntax.RE_EMBEDDED_FLAGS)) - break; - // Set or reset syntax flags. - int flagIndex = index + 1; - int endFlag = -1; - RESyntax newSyntax = new RESyntax (syntax); - int newCflags = cflags; - boolean negate = false; - while (flagIndex < pLength && endFlag < 0) - { - switch (pattern[flagIndex]) - { - case 'i': - if (negate) - newCflags &= ~REG_ICASE; - else - newCflags |= REG_ICASE; - flagIndex++; - break; - case 'd': - if (negate) - newSyntax.setLineSeparator (RESyntax. - DEFAULT_LINE_SEPARATOR); - else - newSyntax.setLineSeparator ("\n"); - flagIndex++; - break; - case 'm': - if (negate) - newCflags &= ~REG_MULTILINE; - else - newCflags |= REG_MULTILINE; - flagIndex++; - break; - case 's': - if (negate) - newCflags &= ~REG_DOT_NEWLINE; - else - newCflags |= REG_DOT_NEWLINE; - flagIndex++; - break; - case 'u': - if (negate) - newCflags |= REG_ICASE_USASCII; - else - newCflags &= ~REG_ICASE_USASCII; - flagIndex++; - break; - case 'x': - if (negate) - newCflags &= ~REG_X_COMMENTS; - else - newCflags |= REG_X_COMMENTS; - flagIndex++; - break; - case '-': - negate = true; - flagIndex++; - break; - case ':': - case ')': - endFlag = pattern[flagIndex]; - break; - default: - throw new - REException (getLocalizedMessage - ("repeat.no.token"), - REException.REG_BADRPT, index); - } - } - if (endFlag == ')') - { - syntax = newSyntax; - cflags = newCflags; - insens = ((cflags & REG_ICASE) > 0); - insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0); - // This can be treated as though it were a comment. - comment = true; - index = flagIndex - 1; - break; - } - if (endFlag == ':') - { - savedSyntax = syntax; - savedCflags = cflags; - flagsSaved = true; - syntax = newSyntax; - cflags = newCflags; - insens = ((cflags & REG_ICASE) > 0); - insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0); - index = flagIndex - 1; - // Fall through to the next case. - } - else - { - throw new - REException (getLocalizedMessage - ("unmatched.paren"), - REException.REG_ESUBREG, index); - } - case ':': - if (syntax.get (RESyntax.RE_PURE_GROUPING)) - { - pure = true; - index += 2; - } - break; - case '#': - if (syntax.get (RESyntax.RE_COMMENTS)) - { - comment = true; - } - break; - default: - throw new - REException (getLocalizedMessage ("repeat.no.token"), - REException.REG_BADRPT, index); - } - } - - if (index >= pLength) - { - throw new - REException (getLocalizedMessage ("unmatched.paren"), - REException.REG_ESUBREG, index); - } - - // find end of subexpression - int endIndex = index; - int nextIndex = index; - int nested = 0; - - while (((nextIndex = - getCharUnit (pattern, endIndex, unit, false)) > 0) - && !(nested == 0 && (unit.ch == ')') - && (syntax. - get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk - || quot)))) - { - if ((endIndex = nextIndex) >= pLength) - throw new - REException (getLocalizedMessage ("subexpr.no.end"), - REException.REG_ESUBREG, nextIndex); - else - if ((unit.ch == '[') && !(unit.bk || quot)) - { - // I hate to do something similar to the LIST OPERATOR matters - // above, but ... - int listIndex = nextIndex; - if (listIndex < pLength && pattern[listIndex] == '^') - listIndex++; - if (listIndex < pLength && pattern[listIndex] == ']') - listIndex++; - int listEndIndex = -1; - int listNest = 0; - while (listIndex < pLength && listEndIndex < 0) - { - switch (pattern[listIndex++]) - { - case '\\': - listIndex++; - break; - case '[': - // Sun's API document says that regexp like "[a-d[m-p]]" - // is legal. Even something like "[[[^]]]]" is accepted. - listNest++; - if (listIndex < pLength - && pattern[listIndex] == '^') - listIndex++; - if (listIndex < pLength - && pattern[listIndex] == ']') - listIndex++; - break; - case ']': - if (listNest == 0) - listEndIndex = listIndex; - listNest--; - break; - } - } - if (listEndIndex >= 0) - { - nextIndex = listEndIndex; - if ((endIndex = nextIndex) >= pLength) - throw new - REException (getLocalizedMessage ("subexpr.no.end"), - REException.REG_ESUBREG, nextIndex); - else - continue; - } - throw new - REException (getLocalizedMessage ("subexpr.no.end"), - REException.REG_ESUBREG, nextIndex); - } - else if (unit.ch == '(' - && (syntax. - get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk - || quot))) - nested++; - else if (unit.ch == ')' - && (syntax. - get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk - || quot))) - nested--; - } - - // endIndex is now position at a ')','\)' - // nextIndex is end of string or position after ')' or '\)' - - if (comment) - index = nextIndex; - else - { // not a comment - // create RE subexpression as token. - addToken (currentToken); - if (!pure) - { - numSubs++; - } - - int useIndex = (pure || lookAhead || lookBehind - || independent) ? 0 : nextSub + numSubs; - currentToken = - new RE (String.valueOf (pattern, index, endIndex - index). - toCharArray (), cflags, syntax, useIndex, - nextSub + numSubs); - numSubs += ((RE) currentToken).getNumSubs (); - - if (lookAhead) - { - currentToken = - new RETokenLookAhead (currentToken, negativelh); - } - else if (lookBehind) - { - currentToken = - new RETokenLookBehind (currentToken, negativelb); - } - else if (independent) - { - currentToken = new RETokenIndependent (currentToken); - } - - index = nextIndex; - if (flagsSaved) - { - syntax = savedSyntax; - cflags = savedCflags; - insens = ((cflags & REG_ICASE) > 0); - insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0); - flagsSaved = false; - } - } // not a comment - } // subexpression - - // UNMATCHED RIGHT PAREN - // ) or \) throw exception if - // !syntax.get(RESyntax.RE_UNMATCHED_RIGHT_PAREN_ORD) - else if (!syntax.get (RESyntax.RE_UNMATCHED_RIGHT_PAREN_ORD) - && ((unit.ch == ')') - && (syntax. - get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk || quot)))) - { - throw new REException (getLocalizedMessage ("unmatched.paren"), - REException.REG_EPAREN, index); - } - - // START OF LINE OPERATOR - // ^ - - else if ((unit.ch == '^') && !(unit.bk || quot)) - { - addToken (currentToken); - currentToken = null; - RETokenStart token = null; - if ((cflags & REG_MULTILINE) > 0) - { - String sep = syntax.getLineSeparator (); - if (sep == null) - { - token = new RETokenStart (subIndex, null, true); - } - else - { - token = new RETokenStart (subIndex, sep); - } - } - else - { - token = new RETokenStart (subIndex, null); - } - addToken (token); - } - - // END OF LINE OPERATOR - // $ - - else if ((unit.ch == '$') && !(unit.bk || quot)) - { - addToken (currentToken); - currentToken = null; - RETokenEnd token = null; - if ((cflags & REG_MULTILINE) > 0) - { - String sep = syntax.getLineSeparator (); - if (sep == null) - { - token = new RETokenEnd (subIndex, null, true); - } - else - { - token = new RETokenEnd (subIndex, sep); - } - } - else - { - token = new RETokenEnd (subIndex, null); - } - addToken (token); - } - - // MATCH-ANY-CHARACTER OPERATOR (except possibly newline and null) - // . - - else if ((unit.ch == '.') && !(unit.bk || quot)) - { - addToken (currentToken); - currentToken = - new RETokenAny (subIndex, syntax.get (RESyntax.RE_DOT_NEWLINE) - || ((cflags & REG_DOT_NEWLINE) > 0), - syntax.get (RESyntax.RE_DOT_NOT_NULL)); - } - - // ZERO-OR-MORE REPEAT OPERATOR - // * - // - // This method used to check "repeat.empty.token" to avoid such regexp - // as "(a*)*", but now "repeat.empty.token" is allowed. - - else if ((unit.ch == '*') && !(unit.bk || quot)) - { - if (currentToken == null) - throw new REException (getLocalizedMessage ("repeat.no.token"), - REException.REG_BADRPT, index); - if (currentToken instanceof RETokenRepeated) - throw new REException (getLocalizedMessage ("repeat.chained"), - REException.REG_BADRPT, index); - if (currentToken instanceof RETokenWordBoundary - || currentToken instanceof RETokenWordBoundary) - throw new REException (getLocalizedMessage ("repeat.assertion"), - REException.REG_BADRPT, index); - currentToken = - setRepeated (currentToken, 0, Integer.MAX_VALUE, index); - } - - // ONE-OR-MORE REPEAT OPERATOR / POSSESSIVE MATCHING OPERATOR - // + | \+ depending on RE_BK_PLUS_QM - // not available if RE_LIMITED_OPS is set - // - // This method used to check "repeat.empty.token" to avoid such regexp - // as "(a*)+", but now "repeat.empty.token" is allowed. - - else if ((unit.ch == '+') && !syntax.get (RESyntax.RE_LIMITED_OPS) - && (!syntax. - get (RESyntax.RE_BK_PLUS_QM) ^ (unit.bk || quot))) - { - if (currentToken == null) - throw new REException (getLocalizedMessage ("repeat.no.token"), - REException.REG_BADRPT, index); - - // Check for possessive matching on RETokenRepeated - if (currentToken instanceof RETokenRepeated) - { - RETokenRepeated tokenRep = (RETokenRepeated) currentToken; - if (syntax.get (RESyntax.RE_POSSESSIVE_OPS) - && !tokenRep.isPossessive () && !tokenRep.isStingy ()) - tokenRep.makePossessive (); - else - throw new - REException (getLocalizedMessage ("repeat.chained"), - REException.REG_BADRPT, index); - - } - else if (currentToken instanceof RETokenWordBoundary - || currentToken instanceof RETokenWordBoundary) - throw new REException (getLocalizedMessage ("repeat.assertion"), - REException.REG_BADRPT, index); - else - currentToken = - setRepeated (currentToken, 1, Integer.MAX_VALUE, index); - } - - // ZERO-OR-ONE REPEAT OPERATOR / STINGY MATCHING OPERATOR - // ? | \? depending on RE_BK_PLUS_QM - // not available if RE_LIMITED_OPS is set - // stingy matching if RE_STINGY_OPS is set and it follows a quantifier - - else if ((unit.ch == '?') && !syntax.get (RESyntax.RE_LIMITED_OPS) - && (!syntax. - get (RESyntax.RE_BK_PLUS_QM) ^ (unit.bk || quot))) - { - if (currentToken == null) - throw new REException (getLocalizedMessage ("repeat.no.token"), - REException.REG_BADRPT, index); - - // Check for stingy matching on RETokenRepeated - if (currentToken instanceof RETokenRepeated) - { - RETokenRepeated tokenRep = (RETokenRepeated) currentToken; - if (syntax.get (RESyntax.RE_STINGY_OPS) - && !tokenRep.isStingy () && !tokenRep.isPossessive ()) - tokenRep.makeStingy (); - else - throw new - REException (getLocalizedMessage ("repeat.chained"), - REException.REG_BADRPT, index); - } - else if (currentToken instanceof RETokenWordBoundary - || currentToken instanceof RETokenWordBoundary) - throw new REException (getLocalizedMessage ("repeat.assertion"), - REException.REG_BADRPT, index); - else - currentToken = setRepeated (currentToken, 0, 1, index); - } - - // OCTAL CHARACTER - // \0377 - - else if (unit.bk && (unit.ch == '0') - && syntax.get (RESyntax.RE_OCTAL_CHAR)) - { - CharExpression ce = - getCharExpression (pattern, index - 2, pLength, syntax); - if (ce == null) - throw new REException ("invalid octal character", - REException.REG_ESCAPE, index); - index = index - 2 + ce.len; - addToken (currentToken); - currentToken = new RETokenChar (subIndex, ce.ch, insens); - if (insensUSASCII) - currentToken.unicodeAware = false; - } - - // BACKREFERENCE OPERATOR - // \1 \2 ... \9 and \10 \11 \12 ... - // not available if RE_NO_BK_REFS is set - // Perl recognizes \10, \11, and so on only if enough number of - // parentheses have opened before it, otherwise they are treated - // as aliases of \010, \011, ... (octal characters). In case of - // Sun's JDK, octal character expression must always begin with \0. - // We will do as JDK does. But FIXME, take a look at "(a)(b)\29". - // JDK treats \2 as a back reference to the 2nd group because - // there are only two groups. But in our poor implementation, - // we cannot help but treat \29 as a back reference to the 29th group. - - else if (unit.bk && Character.isDigit (unit.ch) - && !syntax.get (RESyntax.RE_NO_BK_REFS)) - { - addToken (currentToken); - int numBegin = index - 1; - int numEnd = pLength; - for (int i = index; i < pLength; i++) - { - if (!Character.isDigit (pattern[i])) - { - numEnd = i; - break; - } - } - int num = parseInt (pattern, numBegin, numEnd - numBegin, 10); - - currentToken = new RETokenBackRef (subIndex, num, insens); - if (insensUSASCII) - currentToken.unicodeAware = false; - index = numEnd; - } - - // START OF STRING OPERATOR - // \A if RE_STRING_ANCHORS is set - - else if (unit.bk && (unit.ch == 'A') - && syntax.get (RESyntax.RE_STRING_ANCHORS)) - { - addToken (currentToken); - currentToken = new RETokenStart (subIndex, null); - } - - // WORD BREAK OPERATOR - // \b if ???? - - else if (unit.bk && (unit.ch == 'b') - && syntax.get (RESyntax.RE_STRING_ANCHORS)) - { - addToken (currentToken); - currentToken = - new RETokenWordBoundary (subIndex, - RETokenWordBoundary. - BEGIN | RETokenWordBoundary.END, - false); - } - - // WORD BEGIN OPERATOR - // \< if ???? - else if (unit.bk && (unit.ch == '<')) - { - addToken (currentToken); - currentToken = - new RETokenWordBoundary (subIndex, RETokenWordBoundary.BEGIN, - false); - } - - // WORD END OPERATOR - // \> if ???? - else if (unit.bk && (unit.ch == '>')) - { - addToken (currentToken); - currentToken = - new RETokenWordBoundary (subIndex, RETokenWordBoundary.END, - false); - } - - // NON-WORD BREAK OPERATOR - // \B if ???? - - else if (unit.bk && (unit.ch == 'B') - && syntax.get (RESyntax.RE_STRING_ANCHORS)) - { - addToken (currentToken); - currentToken = - new RETokenWordBoundary (subIndex, - RETokenWordBoundary. - BEGIN | RETokenWordBoundary.END, true); - } - - - // DIGIT OPERATOR - // \d if RE_CHAR_CLASS_ESCAPES is set - - else if (unit.bk && (unit.ch == 'd') - && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES)) - { - addToken (currentToken); - currentToken = - new RETokenPOSIX (subIndex, RETokenPOSIX.DIGIT, insens, false); - if (insensUSASCII) - currentToken.unicodeAware = false; - } - - // NON-DIGIT OPERATOR - // \D - - else if (unit.bk && (unit.ch == 'D') - && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES)) - { - addToken (currentToken); - currentToken = - new RETokenPOSIX (subIndex, RETokenPOSIX.DIGIT, insens, true); - if (insensUSASCII) - currentToken.unicodeAware = false; - } - - // NEWLINE ESCAPE - // \n - - else if (unit.bk && (unit.ch == 'n')) - { - addToken (currentToken); - currentToken = new RETokenChar (subIndex, '\n', false); - } - - // RETURN ESCAPE - // \r - - else if (unit.bk && (unit.ch == 'r')) - { - addToken (currentToken); - currentToken = new RETokenChar (subIndex, '\r', false); - } - - // WHITESPACE OPERATOR - // \s if RE_CHAR_CLASS_ESCAPES is set - - else if (unit.bk && (unit.ch == 's') - && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES)) - { - addToken (currentToken); - currentToken = - new RETokenPOSIX (subIndex, RETokenPOSIX.SPACE, insens, false); - if (insensUSASCII) - currentToken.unicodeAware = false; - } - - // NON-WHITESPACE OPERATOR - // \S - - else if (unit.bk && (unit.ch == 'S') - && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES)) - { - addToken (currentToken); - currentToken = - new RETokenPOSIX (subIndex, RETokenPOSIX.SPACE, insens, true); - if (insensUSASCII) - currentToken.unicodeAware = false; - } - - // TAB ESCAPE - // \t - - else if (unit.bk && (unit.ch == 't')) - { - addToken (currentToken); - currentToken = new RETokenChar (subIndex, '\t', false); - } - - // ALPHANUMERIC OPERATOR - // \w - - else if (unit.bk && (unit.ch == 'w') - && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES)) - { - addToken (currentToken); - currentToken = - new RETokenPOSIX (subIndex, RETokenPOSIX.ALNUM, insens, false); - if (insensUSASCII) - currentToken.unicodeAware = false; - } - - // NON-ALPHANUMERIC OPERATOR - // \W - - else if (unit.bk && (unit.ch == 'W') - && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES)) - { - addToken (currentToken); - currentToken = - new RETokenPOSIX (subIndex, RETokenPOSIX.ALNUM, insens, true); - if (insensUSASCII) - currentToken.unicodeAware = false; - } - - // END OF STRING OPERATOR - // \Z, \z - - // FIXME: \Z and \z are different in that if the input string - // ends with a line terminator, \Z matches the position before - // the final terminator. This special behavior of \Z is yet - // to be implemented. - - else if (unit.bk && (unit.ch == 'Z' || unit.ch == 'z') && - syntax.get (RESyntax.RE_STRING_ANCHORS)) - { - addToken (currentToken); - currentToken = new RETokenEnd (subIndex, null); - } - - // HEX CHARACTER, UNICODE CHARACTER - // \x1B, \u1234 - - else - if ((unit.bk && (unit.ch == 'x') - && syntax.get (RESyntax.RE_HEX_CHAR)) || (unit.bk - && (unit.ch == 'u') - && syntax. - get (RESyntax. - RE_UNICODE_CHAR))) - { - CharExpression ce = - getCharExpression (pattern, index - 2, pLength, syntax); - if (ce == null) - throw new REException ("invalid hex character", - REException.REG_ESCAPE, index); - index = index - 2 + ce.len; - addToken (currentToken); - currentToken = new RETokenChar (subIndex, ce.ch, insens); - if (insensUSASCII) - currentToken.unicodeAware = false; - } - - // NAMED PROPERTY - // \p{prop}, \P{prop} - - else - if ((unit.bk && (unit.ch == 'p') - && syntax.get (RESyntax.RE_NAMED_PROPERTY)) || (unit.bk - && (unit.ch == - 'P') - && syntax. - get (RESyntax. - RE_NAMED_PROPERTY))) - { - NamedProperty np = getNamedProperty (pattern, index - 2, pLength); - if (np == null) - throw new REException ("invalid escape sequence", - REException.REG_ESCAPE, index); - index = index - 2 + np.len; - addToken (currentToken); - currentToken = - getRETokenNamedProperty (subIndex, np, insens, index); - if (insensUSASCII) - currentToken.unicodeAware = false; - } - - // END OF PREVIOUS MATCH - // \G - - else if (unit.bk && (unit.ch == 'G') && - syntax.get (RESyntax.RE_STRING_ANCHORS)) - { - addToken (currentToken); - currentToken = new RETokenEndOfPreviousMatch (subIndex); - } - - // NON-SPECIAL CHARACTER (or escape to make literal) - // c | \* for example - - else - { // not a special character - addToken (currentToken); - currentToken = new RETokenChar (subIndex, unit.ch, insens); - if (insensUSASCII) - currentToken.unicodeAware = false; - } - } // end while + // read the next character unit (including backslash escapes) + index = getCharUnit (pattern, index, unit, quot); + + if (unit.bk) + if (unit.ch == 'Q') + { + quot = true; + continue; + } + else if (unit.ch == 'E') + { + quot = false; + continue; + } + if (quot) + unit.bk = false; + + if (((cflags & REG_X_COMMENTS) > 0) && (!unit.bk) && (!quot)) + { + if (Character.isWhitespace (unit.ch)) + { + continue; + } + if (unit.ch == '#') + { + for (int i = index; i < pLength; i++) + { + if (pattern[i] == '\n') + { + index = i + 1; + continue; + } + else if (pattern[i] == '\r') + { + if (i + 1 < pLength && pattern[i + 1] == '\n') + { + index = i + 2; + } + else + { + index = i + 1; + } + continue; + } + } + index = pLength; + continue; + } + } + + // ALTERNATION OPERATOR + // \| or | (if RE_NO_BK_VBAR) or newline (if RE_NEWLINE_ALT) + // not available if RE_LIMITED_OPS is set + + // TODO: the '\n' literal here should be a test against REToken.newline, + // which unfortunately may be more than a single character. + if (((unit.ch == '|' + && (syntax.get (RESyntax.RE_NO_BK_VBAR) ^ (unit.bk || quot))) + || (syntax.get (RESyntax.RE_NEWLINE_ALT) && (unit.ch == '\n') + && !(unit.bk || quot))) + && !syntax.get (RESyntax.RE_LIMITED_OPS)) + { + // make everything up to here be a branch. create vector if nec. + addToken (currentToken); + RE theBranch = + new RE (firstToken, lastToken, numSubs, subIndex, minimumLength, + maximumLength); + minimumLength = 0; + maximumLength = 0; + if (branches == null) + { + branches = new ArrayList < REToken > (); + } + branches.add (theBranch); + firstToken = lastToken = currentToken = null; + } + + // INTERVAL OPERATOR: + // {x} | {x,} | {x,y} (RE_INTERVALS && RE_NO_BK_BRACES) + // \{x\} | \{x,\} | \{x,y\} (RE_INTERVALS && !RE_NO_BK_BRACES) + // + // OPEN QUESTION: + // what is proper interpretation of '{' at start of string? + // + // This method used to check "repeat.empty.token" to avoid such regexp + // as "(a*){2,}", but now "repeat.empty.token" is allowed. + + else if ((unit.ch == '{') && syntax.get (RESyntax.RE_INTERVALS) + && (syntax. + get (RESyntax.RE_NO_BK_BRACES) ^ (unit.bk || quot))) + { + int newIndex = getMinMax (pattern, index, minMax, syntax); + if (newIndex > index) + { + if (minMax.first > minMax.second) + throw new + REException (getLocalizedMessage ("interval.order"), + REException.REG_BADRPT, newIndex); + if (currentToken == null) + throw new + REException (getLocalizedMessage ("repeat.no.token"), + REException.REG_BADRPT, newIndex); + if (currentToken instanceof RETokenRepeated) + throw new + REException (getLocalizedMessage ("repeat.chained"), + REException.REG_BADRPT, newIndex); + if (currentToken instanceof RETokenWordBoundary + || currentToken instanceof RETokenWordBoundary) + throw new + REException (getLocalizedMessage ("repeat.assertion"), + REException.REG_BADRPT, newIndex); + index = newIndex; + currentToken = + setRepeated (currentToken, minMax.first, minMax.second, + index); + } + else + { + addToken (currentToken); + currentToken = new RETokenChar (subIndex, unit.ch, insens); + if (insensUSASCII) + currentToken.unicodeAware = false; + } + } + + // LIST OPERATOR: + // [...] | [^...] + + else if ((unit.ch == '[') && !(unit.bk || quot)) + { + // Create a new RETokenOneOf + ParseCharClassResult result = + parseCharClass (subIndex, pattern, index, pLength, cflags, + syntax, 0); + addToken (currentToken); + currentToken = result.token; + index = result.index; + } + + // SUBEXPRESSIONS + // (...) | \(...\) depending on RE_NO_BK_PARENS + + else if ((unit.ch == '(') + && (syntax. + get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk || quot))) + { + boolean pure = false; + boolean comment = false; + boolean lookAhead = false; + boolean lookBehind = false; + boolean independent = false; + boolean negativelh = false; + boolean negativelb = false; + if ((index + 1 < pLength) && (pattern[index] == '?')) + { + switch (pattern[index + 1]) + { + case '!': + if (syntax.get (RESyntax.RE_LOOKAHEAD)) + { + pure = true; + negativelh = true; + lookAhead = true; + index += 2; + } + break; + case '=': + if (syntax.get (RESyntax.RE_LOOKAHEAD)) + { + pure = true; + lookAhead = true; + index += 2; + } + break; + case '<': + // We assume that if the syntax supports look-ahead, + // it also supports look-behind. + if (syntax.get (RESyntax.RE_LOOKAHEAD)) + { + index++; + switch (pattern[index + 1]) + { + case '!': + pure = true; + negativelb = true; + lookBehind = true; + index += 2; + break; + case '=': + pure = true; + lookBehind = true; + index += 2; + } + } + break; + case '>': + // We assume that if the syntax supports look-ahead, + // it also supports independent group. + if (syntax.get (RESyntax.RE_LOOKAHEAD)) + { + pure = true; + independent = true; + index += 2; + } + break; + case 'i': + case 'd': + case 'm': + case 's': + case 'u': + case 'x': + case '-': + if (!syntax.get (RESyntax.RE_EMBEDDED_FLAGS)) + break; + // Set or reset syntax flags. + int flagIndex = index + 1; + int endFlag = -1; + RESyntax newSyntax = new RESyntax (syntax); + int newCflags = cflags; + boolean negate = false; + while (flagIndex < pLength && endFlag < 0) + { + switch (pattern[flagIndex]) + { + case 'i': + if (negate) + newCflags &= ~REG_ICASE; + else + newCflags |= REG_ICASE; + flagIndex++; + break; + case 'd': + if (negate) + newSyntax.setLineSeparator (RESyntax. + DEFAULT_LINE_SEPARATOR); + else + newSyntax.setLineSeparator ("\n"); + flagIndex++; + break; + case 'm': + if (negate) + newCflags &= ~REG_MULTILINE; + else + newCflags |= REG_MULTILINE; + flagIndex++; + break; + case 's': + if (negate) + newCflags &= ~REG_DOT_NEWLINE; + else + newCflags |= REG_DOT_NEWLINE; + flagIndex++; + break; + case 'u': + if (negate) + newCflags |= REG_ICASE_USASCII; + else + newCflags &= ~REG_ICASE_USASCII; + flagIndex++; + break; + case 'x': + if (negate) + newCflags &= ~REG_X_COMMENTS; + else + newCflags |= REG_X_COMMENTS; + flagIndex++; + break; + case '-': + negate = true; + flagIndex++; + break; + case ':': + case ')': + endFlag = pattern[flagIndex]; + break; + default: + throw new + REException (getLocalizedMessage + ("repeat.no.token"), + REException.REG_BADRPT, index); + } + } + if (endFlag == ')') + { + syntax = newSyntax; + cflags = newCflags; + insens = ((cflags & REG_ICASE) > 0); + insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0); + // This can be treated as though it were a comment. + comment = true; + index = flagIndex - 1; + break; + } + if (endFlag == ':') + { + savedSyntax = syntax; + savedCflags = cflags; + flagsSaved = true; + syntax = newSyntax; + cflags = newCflags; + insens = ((cflags & REG_ICASE) > 0); + insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0); + index = flagIndex - 1; + // Fall through to the next case. + } + else + { + throw new + REException (getLocalizedMessage + ("unmatched.paren"), + REException.REG_ESUBREG, index); + } + case ':': + if (syntax.get (RESyntax.RE_PURE_GROUPING)) + { + pure = true; + index += 2; + } + break; + case '#': + if (syntax.get (RESyntax.RE_COMMENTS)) + { + comment = true; + } + break; + default: + throw new + REException (getLocalizedMessage ("repeat.no.token"), + REException.REG_BADRPT, index); + } + } + + if (index >= pLength) + { + throw new + REException (getLocalizedMessage ("unmatched.paren"), + REException.REG_ESUBREG, index); + } + + // find end of subexpression + int endIndex = index; + int nextIndex = index; + int nested = 0; + + while (((nextIndex = + getCharUnit (pattern, endIndex, unit, false)) > 0) + && !(nested == 0 && (unit.ch == ')') + && (syntax. + get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk + || quot)))) + { + if ((endIndex = nextIndex) >= pLength) + throw new + REException (getLocalizedMessage ("subexpr.no.end"), + REException.REG_ESUBREG, nextIndex); + else + if ((unit.ch == '[') && !(unit.bk || quot)) + { + // I hate to do something similar to the LIST OPERATOR matters + // above, but ... + int listIndex = nextIndex; + if (listIndex < pLength && pattern[listIndex] == '^') + listIndex++; + if (listIndex < pLength && pattern[listIndex] == ']') + listIndex++; + int listEndIndex = -1; + int listNest = 0; + while (listIndex < pLength && listEndIndex < 0) + { + switch (pattern[listIndex++]) + { + case '\\': + listIndex++; + break; + case '[': + // Sun's API document says that regexp like "[a-d[m-p]]" + // is legal. Even something like "[[[^]]]]" is accepted. + listNest++; + if (listIndex < pLength + && pattern[listIndex] == '^') + listIndex++; + if (listIndex < pLength + && pattern[listIndex] == ']') + listIndex++; + break; + case ']': + if (listNest == 0) + listEndIndex = listIndex; + listNest--; + break; + } + } + if (listEndIndex >= 0) + { + nextIndex = listEndIndex; + if ((endIndex = nextIndex) >= pLength) + throw new + REException (getLocalizedMessage ("subexpr.no.end"), + REException.REG_ESUBREG, nextIndex); + else + continue; + } + throw new + REException (getLocalizedMessage ("subexpr.no.end"), + REException.REG_ESUBREG, nextIndex); + } + else if (unit.ch == '(' + && (syntax. + get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk + || quot))) + nested++; + else if (unit.ch == ')' + && (syntax. + get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk + || quot))) + nested--; + } + + // endIndex is now position at a ')','\)' + // nextIndex is end of string or position after ')' or '\)' + + if (comment) + index = nextIndex; + else + { // not a comment + // create RE subexpression as token. + addToken (currentToken); + if (!pure) + { + numSubs++; + } + + int useIndex = (pure || lookAhead || lookBehind + || independent) ? 0 : nextSub + numSubs; + currentToken = + new RE (String.valueOf (pattern, index, endIndex - index). + toCharArray (), cflags, syntax, useIndex, + nextSub + numSubs); + numSubs += ((RE) currentToken).getNumSubs (); + + if (lookAhead) + { + currentToken = + new RETokenLookAhead (currentToken, negativelh); + } + else if (lookBehind) + { + currentToken = + new RETokenLookBehind (currentToken, negativelb); + } + else if (independent) + { + currentToken = new RETokenIndependent (currentToken); + } + + index = nextIndex; + if (flagsSaved) + { + syntax = savedSyntax; + cflags = savedCflags; + insens = ((cflags & REG_ICASE) > 0); + insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0); + flagsSaved = false; + } + } // not a comment + } // subexpression + + // UNMATCHED RIGHT PAREN + // ) or \) throw exception if + // !syntax.get(RESyntax.RE_UNMATCHED_RIGHT_PAREN_ORD) + else if (!syntax.get (RESyntax.RE_UNMATCHED_RIGHT_PAREN_ORD) + && ((unit.ch == ')') + && (syntax. + get (RESyntax.RE_NO_BK_PARENS) ^ (unit.bk || quot)))) + { + throw new REException (getLocalizedMessage ("unmatched.paren"), + REException.REG_EPAREN, index); + } + + // START OF LINE OPERATOR + // ^ + + else if ((unit.ch == '^') && !(unit.bk || quot)) + { + addToken (currentToken); + currentToken = null; + RETokenStart token = null; + if ((cflags & REG_MULTILINE) > 0) + { + String sep = syntax.getLineSeparator (); + if (sep == null) + { + token = new RETokenStart (subIndex, null, true); + } + else + { + token = new RETokenStart (subIndex, sep); + } + } + else + { + token = new RETokenStart (subIndex, null); + } + addToken (token); + } + + // END OF LINE OPERATOR + // $ + + else if ((unit.ch == '$') && !(unit.bk || quot)) + { + addToken (currentToken); + currentToken = null; + RETokenEnd token = null; + if ((cflags & REG_MULTILINE) > 0) + { + String sep = syntax.getLineSeparator (); + if (sep == null) + { + token = new RETokenEnd (subIndex, null, true); + } + else + { + token = new RETokenEnd (subIndex, sep); + } + } + else + { + token = new RETokenEnd (subIndex, null); + } + addToken (token); + } + + // MATCH-ANY-CHARACTER OPERATOR (except possibly newline and null) + // . + + else if ((unit.ch == '.') && !(unit.bk || quot)) + { + addToken (currentToken); + currentToken = + new RETokenAny (subIndex, syntax.get (RESyntax.RE_DOT_NEWLINE) + || ((cflags & REG_DOT_NEWLINE) > 0), + syntax.get (RESyntax.RE_DOT_NOT_NULL)); + } + + // ZERO-OR-MORE REPEAT OPERATOR + // * + // + // This method used to check "repeat.empty.token" to avoid such regexp + // as "(a*)*", but now "repeat.empty.token" is allowed. + + else if ((unit.ch == '*') && !(unit.bk || quot)) + { + if (currentToken == null) + throw new REException (getLocalizedMessage ("repeat.no.token"), + REException.REG_BADRPT, index); + if (currentToken instanceof RETokenRepeated) + throw new REException (getLocalizedMessage ("repeat.chained"), + REException.REG_BADRPT, index); + if (currentToken instanceof RETokenWordBoundary + || currentToken instanceof RETokenWordBoundary) + throw new REException (getLocalizedMessage ("repeat.assertion"), + REException.REG_BADRPT, index); + currentToken = + setRepeated (currentToken, 0, Integer.MAX_VALUE, index); + } + + // ONE-OR-MORE REPEAT OPERATOR / POSSESSIVE MATCHING OPERATOR + // + | \+ depending on RE_BK_PLUS_QM + // not available if RE_LIMITED_OPS is set + // + // This method used to check "repeat.empty.token" to avoid such regexp + // as "(a*)+", but now "repeat.empty.token" is allowed. + + else if ((unit.ch == '+') && !syntax.get (RESyntax.RE_LIMITED_OPS) + && (!syntax. + get (RESyntax.RE_BK_PLUS_QM) ^ (unit.bk || quot))) + { + if (currentToken == null) + throw new REException (getLocalizedMessage ("repeat.no.token"), + REException.REG_BADRPT, index); + + // Check for possessive matching on RETokenRepeated + if (currentToken instanceof RETokenRepeated) + { + RETokenRepeated tokenRep = (RETokenRepeated) currentToken; + if (syntax.get (RESyntax.RE_POSSESSIVE_OPS) + && !tokenRep.isPossessive () && !tokenRep.isStingy ()) + tokenRep.makePossessive (); + else + throw new + REException (getLocalizedMessage ("repeat.chained"), + REException.REG_BADRPT, index); + + } + else if (currentToken instanceof RETokenWordBoundary + || currentToken instanceof RETokenWordBoundary) + throw new REException (getLocalizedMessage ("repeat.assertion"), + REException.REG_BADRPT, index); + else + currentToken = + setRepeated (currentToken, 1, Integer.MAX_VALUE, index); + } + + // ZERO-OR-ONE REPEAT OPERATOR / STINGY MATCHING OPERATOR + // ? | \? depending on RE_BK_PLUS_QM + // not available if RE_LIMITED_OPS is set + // stingy matching if RE_STINGY_OPS is set and it follows a quantifier + + else if ((unit.ch == '?') && !syntax.get (RESyntax.RE_LIMITED_OPS) + && (!syntax. + get (RESyntax.RE_BK_PLUS_QM) ^ (unit.bk || quot))) + { + if (currentToken == null) + throw new REException (getLocalizedMessage ("repeat.no.token"), + REException.REG_BADRPT, index); + + // Check for stingy matching on RETokenRepeated + if (currentToken instanceof RETokenRepeated) + { + RETokenRepeated tokenRep = (RETokenRepeated) currentToken; + if (syntax.get (RESyntax.RE_STINGY_OPS) + && !tokenRep.isStingy () && !tokenRep.isPossessive ()) + tokenRep.makeStingy (); + else + throw new + REException (getLocalizedMessage ("repeat.chained"), + REException.REG_BADRPT, index); + } + else if (currentToken instanceof RETokenWordBoundary + || currentToken instanceof RETokenWordBoundary) + throw new REException (getLocalizedMessage ("repeat.assertion"), + REException.REG_BADRPT, index); + else + currentToken = setRepeated (currentToken, 0, 1, index); + } + + // OCTAL CHARACTER + // \0377 + + else if (unit.bk && (unit.ch == '0') + && syntax.get (RESyntax.RE_OCTAL_CHAR)) + { + CharExpression ce = + getCharExpression (pattern, index - 2, pLength, syntax); + if (ce == null) + throw new REException ("invalid octal character", + REException.REG_ESCAPE, index); + index = index - 2 + ce.len; + addToken (currentToken); + currentToken = new RETokenChar (subIndex, ce.ch, insens); + if (insensUSASCII) + currentToken.unicodeAware = false; + } + + // BACKREFERENCE OPERATOR + // \1 \2 ... \9 and \10 \11 \12 ... + // not available if RE_NO_BK_REFS is set + // Perl recognizes \10, \11, and so on only if enough number of + // parentheses have opened before it, otherwise they are treated + // as aliases of \010, \011, ... (octal characters). In case of + // Sun's JDK, octal character expression must always begin with \0. + // We will do as JDK does. But FIXME, take a look at "(a)(b)\29". + // JDK treats \2 as a back reference to the 2nd group because + // there are only two groups. But in our poor implementation, + // we cannot help but treat \29 as a back reference to the 29th group. + + else if (unit.bk && Character.isDigit (unit.ch) + && !syntax.get (RESyntax.RE_NO_BK_REFS)) + { + addToken (currentToken); + int numBegin = index - 1; + int numEnd = pLength; + for (int i = index; i < pLength; i++) + { + if (!Character.isDigit (pattern[i])) + { + numEnd = i; + break; + } + } + int num = parseInt (pattern, numBegin, numEnd - numBegin, 10); + + currentToken = new RETokenBackRef (subIndex, num, insens); + if (insensUSASCII) + currentToken.unicodeAware = false; + index = numEnd; + } + + // START OF STRING OPERATOR + // \A if RE_STRING_ANCHORS is set + + else if (unit.bk && (unit.ch == 'A') + && syntax.get (RESyntax.RE_STRING_ANCHORS)) + { + addToken (currentToken); + currentToken = new RETokenStart (subIndex, null); + } + + // WORD BREAK OPERATOR + // \b if ???? + + else if (unit.bk && (unit.ch == 'b') + && syntax.get (RESyntax.RE_STRING_ANCHORS)) + { + addToken (currentToken); + currentToken = + new RETokenWordBoundary (subIndex, + RETokenWordBoundary. + BEGIN | RETokenWordBoundary.END, + false); + } + + // WORD BEGIN OPERATOR + // \< if ???? + else if (unit.bk && (unit.ch == '<')) + { + addToken (currentToken); + currentToken = + new RETokenWordBoundary (subIndex, RETokenWordBoundary.BEGIN, + false); + } + + // WORD END OPERATOR + // \> if ???? + else if (unit.bk && (unit.ch == '>')) + { + addToken (currentToken); + currentToken = + new RETokenWordBoundary (subIndex, RETokenWordBoundary.END, + false); + } + + // NON-WORD BREAK OPERATOR + // \B if ???? + + else if (unit.bk && (unit.ch == 'B') + && syntax.get (RESyntax.RE_STRING_ANCHORS)) + { + addToken (currentToken); + currentToken = + new RETokenWordBoundary (subIndex, + RETokenWordBoundary. + BEGIN | RETokenWordBoundary.END, true); + } + + + // DIGIT OPERATOR + // \d if RE_CHAR_CLASS_ESCAPES is set + + else if (unit.bk && (unit.ch == 'd') + && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES)) + { + addToken (currentToken); + currentToken = + new RETokenPOSIX (subIndex, RETokenPOSIX.DIGIT, insens, false); + if (insensUSASCII) + currentToken.unicodeAware = false; + } + + // NON-DIGIT OPERATOR + // \D + + else if (unit.bk && (unit.ch == 'D') + && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES)) + { + addToken (currentToken); + currentToken = + new RETokenPOSIX (subIndex, RETokenPOSIX.DIGIT, insens, true); + if (insensUSASCII) + currentToken.unicodeAware = false; + } + + // NEWLINE ESCAPE + // \n + + else if (unit.bk && (unit.ch == 'n')) + { + addToken (currentToken); + currentToken = new RETokenChar (subIndex, '\n', false); + } + + // RETURN ESCAPE + // \r + + else if (unit.bk && (unit.ch == 'r')) + { + addToken (currentToken); + currentToken = new RETokenChar (subIndex, '\r', false); + } + + // WHITESPACE OPERATOR + // \s if RE_CHAR_CLASS_ESCAPES is set + + else if (unit.bk && (unit.ch == 's') + && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES)) + { + addToken (currentToken); + currentToken = + new RETokenPOSIX (subIndex, RETokenPOSIX.SPACE, insens, false); + if (insensUSASCII) + currentToken.unicodeAware = false; + } + + // NON-WHITESPACE OPERATOR + // \S + + else if (unit.bk && (unit.ch == 'S') + && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES)) + { + addToken (currentToken); + currentToken = + new RETokenPOSIX (subIndex, RETokenPOSIX.SPACE, insens, true); + if (insensUSASCII) + currentToken.unicodeAware = false; + } + + // TAB ESCAPE + // \t + + else if (unit.bk && (unit.ch == 't')) + { + addToken (currentToken); + currentToken = new RETokenChar (subIndex, '\t', false); + } + + // ALPHANUMERIC OPERATOR + // \w + + else if (unit.bk && (unit.ch == 'w') + && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES)) + { + addToken (currentToken); + currentToken = + new RETokenPOSIX (subIndex, RETokenPOSIX.ALNUM, insens, false); + if (insensUSASCII) + currentToken.unicodeAware = false; + } + + // NON-ALPHANUMERIC OPERATOR + // \W + + else if (unit.bk && (unit.ch == 'W') + && syntax.get (RESyntax.RE_CHAR_CLASS_ESCAPES)) + { + addToken (currentToken); + currentToken = + new RETokenPOSIX (subIndex, RETokenPOSIX.ALNUM, insens, true); + if (insensUSASCII) + currentToken.unicodeAware = false; + } + + // END OF STRING OPERATOR + // \Z, \z + + // FIXME: \Z and \z are different in that if the input string + // ends with a line terminator, \Z matches the position before + // the final terminator. This special behavior of \Z is yet + // to be implemented. + + else if (unit.bk && (unit.ch == 'Z' || unit.ch == 'z') && + syntax.get (RESyntax.RE_STRING_ANCHORS)) + { + addToken (currentToken); + currentToken = new RETokenEnd (subIndex, null); + } + + // HEX CHARACTER, UNICODE CHARACTER + // \x1B, \u1234 + + else + if ((unit.bk && (unit.ch == 'x') + && syntax.get (RESyntax.RE_HEX_CHAR)) || (unit.bk + && (unit.ch == 'u') + && syntax. + get (RESyntax. + RE_UNICODE_CHAR))) + { + CharExpression ce = + getCharExpression (pattern, index - 2, pLength, syntax); + if (ce == null) + throw new REException ("invalid hex character", + REException.REG_ESCAPE, index); + index = index - 2 + ce.len; + addToken (currentToken); + currentToken = new RETokenChar (subIndex, ce.ch, insens); + if (insensUSASCII) + currentToken.unicodeAware = false; + } + + // NAMED PROPERTY + // \p{prop}, \P{prop} + + else + if ((unit.bk && (unit.ch == 'p') + && syntax.get (RESyntax.RE_NAMED_PROPERTY)) || (unit.bk + && (unit.ch == + 'P') + && syntax. + get (RESyntax. + RE_NAMED_PROPERTY))) + { + NamedProperty np = getNamedProperty (pattern, index - 2, pLength); + if (np == null) + throw new REException ("invalid escape sequence", + REException.REG_ESCAPE, index); + index = index - 2 + np.len; + addToken (currentToken); + currentToken = + getRETokenNamedProperty (subIndex, np, insens, index); + if (insensUSASCII) + currentToken.unicodeAware = false; + } + + // END OF PREVIOUS MATCH + // \G + + else if (unit.bk && (unit.ch == 'G') && + syntax.get (RESyntax.RE_STRING_ANCHORS)) + { + addToken (currentToken); + currentToken = new RETokenEndOfPreviousMatch (subIndex); + } + + // NON-SPECIAL CHARACTER (or escape to make literal) + // c | \* for example + + else + { // not a special character + addToken (currentToken); + currentToken = new RETokenChar (subIndex, unit.ch, insens); + if (insensUSASCII) + currentToken.unicodeAware = false; + } + } // end while // Add final buffered token and an EndSub marker addToken (currentToken); if (branches != null) { - branches. - add (new - RE (firstToken, lastToken, numSubs, subIndex, minimumLength, - maximumLength)); - branches.trimToSize (); // compact the Vector - minimumLength = 0; - maximumLength = 0; - firstToken = lastToken = null; - addToken (new RETokenOneOf (subIndex, branches, false)); + branches. + add (new + RE (firstToken, lastToken, numSubs, subIndex, minimumLength, + maximumLength)); + branches.trimToSize (); // compact the Vector + minimumLength = 0; + maximumLength = 0; + firstToken = lastToken = null; + addToken (new RETokenOneOf (subIndex, branches, false)); } else addToken (new RETokenEndSub (subIndex)); @@ -1403,11 +1403,11 @@ public class RE extends REToken * @param syntax Syntax used to parse the pattern. */ private static ParseCharClassResult parseCharClass (int subIndex, - char[]pattern, - int index, int pLength, - int cflags, - RESyntax syntax, - int pflags) throws + char[]pattern, + int index, int pLength, + int cflags, + RESyntax syntax, + int pflags) throws REException { @@ -1425,256 +1425,256 @@ public class RE extends REToken boolean lastCharIsSet = false; if (index == pLength) throw new REException (getLocalizedMessage ("unmatched.bracket"), - REException.REG_EBRACK, index); + REException.REG_EBRACK, index); // Check for initial caret, negation if ((ch = pattern[index]) == '^') { - negative = true; - if (++index == pLength) - throw new REException (getLocalizedMessage ("class.no.end"), - REException.REG_EBRACK, index); - ch = pattern[index]; + negative = true; + if (++index == pLength) + throw new REException (getLocalizedMessage ("class.no.end"), + REException.REG_EBRACK, index); + ch = pattern[index]; } // Check for leading right bracket literal if (ch == ']') { - lastChar = ch; - lastCharIsSet = true; - if (++index == pLength) - throw new REException (getLocalizedMessage ("class.no.end"), - REException.REG_EBRACK, index); + lastChar = ch; + lastCharIsSet = true; + if (++index == pLength) + throw new REException (getLocalizedMessage ("class.no.end"), + REException.REG_EBRACK, index); } while ((ch = pattern[index++]) != ']') { - if ((ch == '-') && (lastCharIsSet)) - { - if (index == pLength) - throw new REException (getLocalizedMessage ("class.no.end"), - REException.REG_EBRACK, index); - if ((ch = pattern[index]) == ']') - { - RETokenChar t = new RETokenChar (subIndex, lastChar, insens); - if (insensUSASCII) - t.unicodeAware = false; - options.add (t); - lastChar = '-'; - } - else - { - if ((ch == '\\') - && syntax.get (RESyntax.RE_BACKSLASH_ESCAPE_IN_LISTS)) - { - CharExpression ce = - getCharExpression (pattern, index, pLength, syntax); - if (ce == null) - throw new REException ("invalid escape sequence", - REException.REG_ESCAPE, index); - ch = ce.ch; - index = index + ce.len - 1; - } - RETokenRange t = - new RETokenRange (subIndex, lastChar, ch, insens); - if (insensUSASCII) - t.unicodeAware = false; - options.add (t); - lastChar = 0; - lastCharIsSet = false; - index++; - } - } - else if ((ch == '\\') - && syntax.get (RESyntax.RE_BACKSLASH_ESCAPE_IN_LISTS)) - { - if (index == pLength) - throw new REException (getLocalizedMessage ("class.no.end"), - REException.REG_EBRACK, index); - int posixID = -1; - boolean negate = false; - char asciiEsc = 0; - boolean asciiEscIsSet = false; - NamedProperty np = null; - if (("dswDSW".indexOf (pattern[index]) != -1) - && syntax.get (RESyntax.RE_CHAR_CLASS_ESC_IN_LISTS)) - { - switch (pattern[index]) - { - case 'D': - negate = true; - case 'd': - posixID = RETokenPOSIX.DIGIT; - break; - case 'S': - negate = true; - case 's': - posixID = RETokenPOSIX.SPACE; - break; - case 'W': - negate = true; - case 'w': - posixID = RETokenPOSIX.ALNUM; - break; - } - } - if (("pP".indexOf (pattern[index]) != -1) - && syntax.get (RESyntax.RE_NAMED_PROPERTY)) - { - np = getNamedProperty (pattern, index - 1, pLength); - if (np == null) - throw new REException ("invalid escape sequence", - REException.REG_ESCAPE, index); - index = index - 1 + np.len - 1; - } - else - { - CharExpression ce = - getCharExpression (pattern, index - 1, pLength, syntax); - if (ce == null) - throw new REException ("invalid escape sequence", - REException.REG_ESCAPE, index); - asciiEsc = ce.ch; - asciiEscIsSet = true; - index = index - 1 + ce.len - 1; - } - if (lastCharIsSet) - { - RETokenChar t = new RETokenChar (subIndex, lastChar, insens); - if (insensUSASCII) - t.unicodeAware = false; - options.add (t); - } - - if (posixID != -1) - { - RETokenPOSIX t = - new RETokenPOSIX (subIndex, posixID, insens, negate); - if (insensUSASCII) - t.unicodeAware = false; - options.add (t); - } - else if (np != null) - { - RETokenNamedProperty t = - getRETokenNamedProperty (subIndex, np, insens, index); - if (insensUSASCII) - t.unicodeAware = false; - options.add (t); - } - else if (asciiEscIsSet) - { - lastChar = asciiEsc; - lastCharIsSet = true; - } - else - { - lastChar = pattern[index]; - lastCharIsSet = true; - } - ++index; - } - else if ((ch == '[') && (syntax.get (RESyntax.RE_CHAR_CLASSES)) - && (index < pLength) && (pattern[index] == ':')) - { - CPStringBuilder posixSet = new CPStringBuilder (); - index = getPosixSet (pattern, index + 1, posixSet); - int posixId = RETokenPOSIX.intValue (posixSet.toString ()); - if (posixId != -1) - { - RETokenPOSIX t = - new RETokenPOSIX (subIndex, posixId, insens, false); - if (insensUSASCII) - t.unicodeAware = false; - options.add (t); - } - } - else if ((ch == '[') && (syntax.get (RESyntax.RE_NESTED_CHARCLASS))) - { - ParseCharClassResult result = - parseCharClass (subIndex, pattern, index, pLength, cflags, - syntax, 0); - addition.add (result.token); - addition.add ("|"); - index = result.index; - } - else if ((ch == '&') && - (syntax.get (RESyntax.RE_NESTED_CHARCLASS)) && - (index < pLength) && (pattern[index] == '&')) - { - if (returnAtAndOperator) - { - ParseCharClassResult result = new ParseCharClassResult (); - options.trimToSize (); - if (additionAndAppeared) - addition.add ("&"); - if (addition.size () == 0) - addition = null; - result.token = new RETokenOneOf (subIndex, - options, addition, negative); - result.index = index - 1; - result.returnAtAndOperator = true; - return result; - } - // The precedence of the operator "&&" is the lowest. - // So we postpone adding "&" until other elements - // are added. And we insert Boolean.FALSE at the - // beginning of the list of tokens following "&&". - // So, "&&[a-b][k-m]" will be stored in the Vecter - // addition in this order: - // Boolean.FALSE, [a-b], "|", [k-m], "|", "&" - if (additionAndAppeared) - addition.add ("&"); - addition.add (Boolean.FALSE); - additionAndAppeared = true; - - // The part on which "&&" operates may be either - // (1) explicitly enclosed by [] - // or - // (2) not enclosed by [] and terminated by the - // next "&&" or the end of the character list. - // Let the preceding else if block do the case (1). - // We must do something in case of (2). - if ((index + 1 < pLength) && (pattern[index + 1] != '[')) - { - ParseCharClassResult result = - parseCharClass (subIndex, pattern, index + 1, pLength, - cflags, syntax, - RETURN_AT_AND); - addition.add (result.token); - addition.add ("|"); - // If the method returned at the next "&&", it is OK. - // Otherwise we have eaten the mark of the end of this - // character list "]". In this case we must give back - // the end mark. - index = (result.returnAtAndOperator ? - result.index : result.index - 1); - } - } - else - { - if (lastCharIsSet) - { - RETokenChar t = new RETokenChar (subIndex, lastChar, insens); - if (insensUSASCII) - t.unicodeAware = false; - options.add (t); - } - lastChar = ch; - lastCharIsSet = true; - } - if (index == pLength) - throw new REException (getLocalizedMessage ("class.no.end"), - REException.REG_EBRACK, index); - } // while in list + if ((ch == '-') && (lastCharIsSet)) + { + if (index == pLength) + throw new REException (getLocalizedMessage ("class.no.end"), + REException.REG_EBRACK, index); + if ((ch = pattern[index]) == ']') + { + RETokenChar t = new RETokenChar (subIndex, lastChar, insens); + if (insensUSASCII) + t.unicodeAware = false; + options.add (t); + lastChar = '-'; + } + else + { + if ((ch == '\\') + && syntax.get (RESyntax.RE_BACKSLASH_ESCAPE_IN_LISTS)) + { + CharExpression ce = + getCharExpression (pattern, index, pLength, syntax); + if (ce == null) + throw new REException ("invalid escape sequence", + REException.REG_ESCAPE, index); + ch = ce.ch; + index = index + ce.len - 1; + } + RETokenRange t = + new RETokenRange (subIndex, lastChar, ch, insens); + if (insensUSASCII) + t.unicodeAware = false; + options.add (t); + lastChar = 0; + lastCharIsSet = false; + index++; + } + } + else if ((ch == '\\') + && syntax.get (RESyntax.RE_BACKSLASH_ESCAPE_IN_LISTS)) + { + if (index == pLength) + throw new REException (getLocalizedMessage ("class.no.end"), + REException.REG_EBRACK, index); + int posixID = -1; + boolean negate = false; + char asciiEsc = 0; + boolean asciiEscIsSet = false; + NamedProperty np = null; + if (("dswDSW".indexOf (pattern[index]) != -1) + && syntax.get (RESyntax.RE_CHAR_CLASS_ESC_IN_LISTS)) + { + switch (pattern[index]) + { + case 'D': + negate = true; + case 'd': + posixID = RETokenPOSIX.DIGIT; + break; + case 'S': + negate = true; + case 's': + posixID = RETokenPOSIX.SPACE; + break; + case 'W': + negate = true; + case 'w': + posixID = RETokenPOSIX.ALNUM; + break; + } + } + if (("pP".indexOf (pattern[index]) != -1) + && syntax.get (RESyntax.RE_NAMED_PROPERTY)) + { + np = getNamedProperty (pattern, index - 1, pLength); + if (np == null) + throw new REException ("invalid escape sequence", + REException.REG_ESCAPE, index); + index = index - 1 + np.len - 1; + } + else + { + CharExpression ce = + getCharExpression (pattern, index - 1, pLength, syntax); + if (ce == null) + throw new REException ("invalid escape sequence", + REException.REG_ESCAPE, index); + asciiEsc = ce.ch; + asciiEscIsSet = true; + index = index - 1 + ce.len - 1; + } + if (lastCharIsSet) + { + RETokenChar t = new RETokenChar (subIndex, lastChar, insens); + if (insensUSASCII) + t.unicodeAware = false; + options.add (t); + } + + if (posixID != -1) + { + RETokenPOSIX t = + new RETokenPOSIX (subIndex, posixID, insens, negate); + if (insensUSASCII) + t.unicodeAware = false; + options.add (t); + } + else if (np != null) + { + RETokenNamedProperty t = + getRETokenNamedProperty (subIndex, np, insens, index); + if (insensUSASCII) + t.unicodeAware = false; + options.add (t); + } + else if (asciiEscIsSet) + { + lastChar = asciiEsc; + lastCharIsSet = true; + } + else + { + lastChar = pattern[index]; + lastCharIsSet = true; + } + ++index; + } + else if ((ch == '[') && (syntax.get (RESyntax.RE_CHAR_CLASSES)) + && (index < pLength) && (pattern[index] == ':')) + { + CPStringBuilder posixSet = new CPStringBuilder (); + index = getPosixSet (pattern, index + 1, posixSet); + int posixId = RETokenPOSIX.intValue (posixSet.toString ()); + if (posixId != -1) + { + RETokenPOSIX t = + new RETokenPOSIX (subIndex, posixId, insens, false); + if (insensUSASCII) + t.unicodeAware = false; + options.add (t); + } + } + else if ((ch == '[') && (syntax.get (RESyntax.RE_NESTED_CHARCLASS))) + { + ParseCharClassResult result = + parseCharClass (subIndex, pattern, index, pLength, cflags, + syntax, 0); + addition.add (result.token); + addition.add ("|"); + index = result.index; + } + else if ((ch == '&') && + (syntax.get (RESyntax.RE_NESTED_CHARCLASS)) && + (index < pLength) && (pattern[index] == '&')) + { + if (returnAtAndOperator) + { + ParseCharClassResult result = new ParseCharClassResult (); + options.trimToSize (); + if (additionAndAppeared) + addition.add ("&"); + if (addition.size () == 0) + addition = null; + result.token = new RETokenOneOf (subIndex, + options, addition, negative); + result.index = index - 1; + result.returnAtAndOperator = true; + return result; + } + // The precedence of the operator "&&" is the lowest. + // So we postpone adding "&" until other elements + // are added. And we insert Boolean.FALSE at the + // beginning of the list of tokens following "&&". + // So, "&&[a-b][k-m]" will be stored in the Vecter + // addition in this order: + // Boolean.FALSE, [a-b], "|", [k-m], "|", "&" + if (additionAndAppeared) + addition.add ("&"); + addition.add (Boolean.FALSE); + additionAndAppeared = true; + + // The part on which "&&" operates may be either + // (1) explicitly enclosed by [] + // or + // (2) not enclosed by [] and terminated by the + // next "&&" or the end of the character list. + // Let the preceding else if block do the case (1). + // We must do something in case of (2). + if ((index + 1 < pLength) && (pattern[index + 1] != '[')) + { + ParseCharClassResult result = + parseCharClass (subIndex, pattern, index + 1, pLength, + cflags, syntax, + RETURN_AT_AND); + addition.add (result.token); + addition.add ("|"); + // If the method returned at the next "&&", it is OK. + // Otherwise we have eaten the mark of the end of this + // character list "]". In this case we must give back + // the end mark. + index = (result.returnAtAndOperator ? + result.index : result.index - 1); + } + } + else + { + if (lastCharIsSet) + { + RETokenChar t = new RETokenChar (subIndex, lastChar, insens); + if (insensUSASCII) + t.unicodeAware = false; + options.add (t); + } + lastChar = ch; + lastCharIsSet = true; + } + if (index == pLength) + throw new REException (getLocalizedMessage ("class.no.end"), + REException.REG_EBRACK, index); + } // while in list // Out of list, index is one past ']' if (lastCharIsSet) { - RETokenChar t = new RETokenChar (subIndex, lastChar, insens); - if (insensUSASCII) - t.unicodeAware = false; - options.add (t); + RETokenChar t = new RETokenChar (subIndex, lastChar, insens); + if (insensUSASCII) + t.unicodeAware = false; + options.add (t); } ParseCharClassResult result = new ParseCharClassResult (); @@ -1690,17 +1690,17 @@ public class RE extends REToken } private static int getCharUnit (char[]input, int index, CharUnit unit, - boolean quot) throws REException + boolean quot) throws REException { unit.ch = input[index++]; unit.bk = (unit.ch == '\\' - && (!quot || index >= input.length || input[index] == 'E')); + && (!quot || index >= input.length || input[index] == 'E')); if (unit.bk) if (index < input.length) - unit.ch = input[index++]; + unit.ch = input[index++]; else - throw new REException (getLocalizedMessage ("ends.with.backslash"), - REException.REG_ESCAPE, index); + throw new REException (getLocalizedMessage ("ends.with.backslash"), + REException.REG_ESCAPE, index); return index; } @@ -1709,7 +1709,7 @@ public class RE extends REToken int ret = 0; for (int i = pos; i < pos + len; i++) { - ret = ret * radix + Character.digit (input[i], radix); + ret = ret * radix + Character.digit (input[i], radix); } return ret; } @@ -1736,92 +1736,92 @@ public class RE extends REToken } private static CharExpression getCharExpression (char[]input, int pos, - int lim, RESyntax syntax) + int lim, RESyntax syntax) { CharExpression ce = new CharExpression (); char c = input[pos]; if (c == '\\') { - if (pos + 1 >= lim) - return null; - c = input[pos + 1]; - switch (c) - { - case 't': - ce.ch = '\t'; - ce.len = 2; - break; - case 'n': - ce.ch = '\n'; - ce.len = 2; - break; - case 'r': - ce.ch = '\r'; - ce.len = 2; - break; - case 'x': - case 'u': - if ((c == 'x' && syntax.get (RESyntax.RE_HEX_CHAR)) || - (c == 'u' && syntax.get (RESyntax.RE_UNICODE_CHAR))) - { - int l = 0; - int expectedLength = (c == 'x' ? 2 : 4); - for (int i = pos + 2; i < pos + 2 + expectedLength; i++) - { - if (i >= lim) - break; - if (!((input[i] >= '0' && input[i] <= '9') || - (input[i] >= 'A' && input[i] <= 'F') || - (input[i] >= 'a' && input[i] <= 'f'))) - break; - l++; - } - if (l != expectedLength) - return null; - ce.ch = (char) (parseInt (input, pos + 2, l, 16)); - ce.len = l + 2; - } - else - { - ce.ch = c; - ce.len = 2; - } - break; - case '0': - if (syntax.get (RESyntax.RE_OCTAL_CHAR)) - { - int l = 0; - for (int i = pos + 2; i < pos + 2 + 3; i++) - { - if (i >= lim) - break; - if (input[i] < '0' || input[i] > '7') - break; - l++; - } - if (l == 3 && input[pos + 2] > '3') - l--; - if (l <= 0) - return null; - ce.ch = (char) (parseInt (input, pos + 2, l, 8)); - ce.len = l + 2; - } - else - { - ce.ch = c; - ce.len = 2; - } - break; - default: - ce.ch = c; - ce.len = 2; - break; - } + if (pos + 1 >= lim) + return null; + c = input[pos + 1]; + switch (c) + { + case 't': + ce.ch = '\t'; + ce.len = 2; + break; + case 'n': + ce.ch = '\n'; + ce.len = 2; + break; + case 'r': + ce.ch = '\r'; + ce.len = 2; + break; + case 'x': + case 'u': + if ((c == 'x' && syntax.get (RESyntax.RE_HEX_CHAR)) || + (c == 'u' && syntax.get (RESyntax.RE_UNICODE_CHAR))) + { + int l = 0; + int expectedLength = (c == 'x' ? 2 : 4); + for (int i = pos + 2; i < pos + 2 + expectedLength; i++) + { + if (i >= lim) + break; + if (!((input[i] >= '0' && input[i] <= '9') || + (input[i] >= 'A' && input[i] <= 'F') || + (input[i] >= 'a' && input[i] <= 'f'))) + break; + l++; + } + if (l != expectedLength) + return null; + ce.ch = (char) (parseInt (input, pos + 2, l, 16)); + ce.len = l + 2; + } + else + { + ce.ch = c; + ce.len = 2; + } + break; + case '0': + if (syntax.get (RESyntax.RE_OCTAL_CHAR)) + { + int l = 0; + for (int i = pos + 2; i < pos + 2 + 3; i++) + { + if (i >= lim) + break; + if (input[i] < '0' || input[i] > '7') + break; + l++; + } + if (l == 3 && input[pos + 2] > '3') + l--; + if (l <= 0) + return null; + ce.ch = (char) (parseInt (input, pos + 2, l, 8)); + ce.len = l + 2; + } + else + { + ce.ch = c; + ce.len = 2; + } + break; + default: + ce.ch = c; + ce.len = 2; + break; + } } else { - ce.ch = input[pos]; - ce.len = 1; + ce.ch = input[pos]; + ce.len = 1; } ce.expr = new String (input, pos, ce.len); return ce; @@ -1846,60 +1846,60 @@ public class RE extends REToken } private static NamedProperty getNamedProperty (char[]input, int pos, - int lim) + int lim) { NamedProperty np = new NamedProperty (); char c = input[pos]; if (c == '\\') { - if (++pos >= lim) - return null; - c = input[pos++]; - switch (c) - { - case 'p': - np.negate = false; - break; - case 'P': - np.negate = true; - break; - default: - return null; - } - c = input[pos++]; - if (c == '{') - { - int p = -1; - for (int i = pos; i < lim; i++) - { - if (input[i] == '}') - { - p = i; - break; - } - } - if (p < 0) - return null; - int len = p - pos; - np.name = new String (input, pos, len); - np.len = len + 4; - } - else - { - np.name = new String (input, pos - 1, 1); - np.len = 3; - } - return np; + if (++pos >= lim) + return null; + c = input[pos++]; + switch (c) + { + case 'p': + np.negate = false; + break; + case 'P': + np.negate = true; + break; + default: + return null; + } + c = input[pos++]; + if (c == '{') + { + int p = -1; + for (int i = pos; i < lim; i++) + { + if (input[i] == '}') + { + p = i; + break; + } + } + if (p < 0) + return null; + int len = p - pos; + np.name = new String (input, pos, len); + np.len = len + 4; + } + else + { + np.name = new String (input, pos - 1, 1); + np.len = 3; + } + return np; } else return null; } private static RETokenNamedProperty getRETokenNamedProperty (int subIndex, - NamedProperty - np, - boolean insens, - int index) + NamedProperty + np, + boolean insens, + int index) throws REException { try @@ -1953,18 +1953,18 @@ public class RE extends REToken private boolean isMatchImpl (CharIndexed input, int index, int eflags) { - if (firstToken == null) // Trivial case + if (firstToken == null) // Trivial case return (input.charAt (0) == CharIndexed.OUT_OF_BOUNDS); REMatch m = new REMatch (numSubs, index, eflags); if (firstToken.match (input, m)) { - if (m != null) - { - if (input.charAt (m.index) == CharIndexed.OUT_OF_BOUNDS) - { - return true; - } - } + if (m != null) + { + if (input.charAt (m.index) == CharIndexed.OUT_OF_BOUNDS) + { + return true; + } + } } return false; } @@ -1984,10 +1984,10 @@ public class RE extends REToken { if (lastToken != null) { - lastToken.setUncle (uncle); + lastToken.setUncle (uncle); } else - super.setUncle (uncle); // to deal with empty subexpressions + super.setUncle (uncle); // to deal with empty subexpressions } // Overrides REToken.chain @@ -2063,25 +2063,25 @@ public class RE extends REToken // this has been changed since 1.03 to be non-overlapping matches private REMatch[] getAllMatchesImpl (CharIndexed input, int index, - int eflags) + int eflags) { List < REMatch > all = new ArrayList < REMatch > (); REMatch m = null; while ((m = getMatchImpl (input, index, eflags, null)) != null) { - all.add (m); - index = m.getEndIndex (); - if (m.end[0] == 0) - { // handle pathological case of zero-length match - index++; - input.move (1); - } - else - { - input.move (m.end[0]); - } - if (!input.isValid ()) - break; + all.add (m); + index = m.getEndIndex (); + if (m.end[0] == 0) + { // handle pathological case of zero-length match + index++; + input.move (1); + } + else + { + input.move (m.end[0]); + } + if (!input.isValid ()) + break; } return all.toArray (new REMatch[all.size ()]); } @@ -2092,7 +2092,7 @@ public class RE extends REToken input.setHitEnd (mymatch); if (firstToken == null) { - return next (input, mymatch); + return next (input, mymatch); } // Note the start of this subexpression @@ -2108,7 +2108,7 @@ public class RE extends REToken boolean b = match (input, mymatch); if (b) { - return mymatch; + return mymatch; } return null; } @@ -2168,78 +2168,78 @@ public class RE extends REToken * @param buffer The StringBuffer to save pre-match text in. * @return An REMatch instance referencing the match, or null if none. */ public REMatch getMatch (Object input, int index, int eflags, - CPStringBuilder buffer) + CPStringBuilder buffer) { return getMatchImpl (makeCharIndexed (input, index), index, eflags, - buffer); + buffer); } REMatch getMatchImpl (CharIndexed input, int anchor, int eflags, - CPStringBuilder buffer) + CPStringBuilder buffer) { boolean tryEntireMatch = ((eflags & REG_TRY_ENTIRE_MATCH) != 0); boolean doMove = ((eflags & REG_FIX_STARTING_POSITION) == 0); RE re = (tryEntireMatch ? (RE) this.clone () : this); if (tryEntireMatch) { - RETokenEnd reEnd = new RETokenEnd (0, null); - reEnd.setFake (true); - re.chain (reEnd); + RETokenEnd reEnd = new RETokenEnd (0, null); + reEnd.setFake (true); + re.chain (reEnd); } // Create a new REMatch to hold results REMatch mymatch = new REMatch (numSubs, anchor, eflags); do { - /* The following potimization is commented out because - the matching should be tried even if the length of - input is obviously too short in order that - java.util.regex.Matcher#hitEnd() may work correctly. - // Optimization: check if anchor + minimumLength > length - if (minimumLength == 0 || input.charAt(minimumLength-1) != CharIndexed.OUT_OF_BOUNDS) { - */ - if (re.match (input, mymatch)) - { - REMatch best = mymatch; - // We assume that the match that coms first is the best. - // And the following "The longer, the better" rule has - // been commented out. The longest is not neccesarily - // the best. For example, "a" out of "aaa" is the best - // match for /a+?/. - /* - // Find best match of them all to observe leftmost longest - while ((mymatch = mymatch.next) != null) { - if (mymatch.index > best.index) { - best = mymatch; - } - } - */ - best.end[0] = best.index; - best.finish (input); - input.setLastMatch (best); - return best; - } - /* End of the optimization commented out - } - */ - mymatch.clear (++anchor); - // Append character to buffer if needed - if (buffer != null && input.charAt (0) != CharIndexed.OUT_OF_BOUNDS) - { - buffer.append (input.charAt (0)); - } - // java.util.regex.Matcher#hitEnd() requires that the search should - // be tried at the end of input, so we use move1(1) instead of move(1) + /* The following potimization is commented out because + the matching should be tried even if the length of + input is obviously too short in order that + java.util.regex.Matcher#hitEnd() may work correctly. + // Optimization: check if anchor + minimumLength > length + if (minimumLength == 0 || input.charAt(minimumLength-1) != CharIndexed.OUT_OF_BOUNDS) { + */ + if (re.match (input, mymatch)) + { + REMatch best = mymatch; + // We assume that the match that coms first is the best. + // And the following "The longer, the better" rule has + // been commented out. The longest is not neccesarily + // the best. For example, "a" out of "aaa" is the best + // match for /a+?/. + /* + // Find best match of them all to observe leftmost longest + while ((mymatch = mymatch.next) != null) { + if (mymatch.index > best.index) { + best = mymatch; + } + } + */ + best.end[0] = best.index; + best.finish (input); + input.setLastMatch (best); + return best; + } + /* End of the optimization commented out + } + */ + mymatch.clear (++anchor); + // Append character to buffer if needed + if (buffer != null && input.charAt (0) != CharIndexed.OUT_OF_BOUNDS) + { + buffer.append (input.charAt (0)); + } + // java.util.regex.Matcher#hitEnd() requires that the search should + // be tried at the end of input, so we use move1(1) instead of move(1) } while (doMove && input.move1 (1)); // Special handling at end of input for e.g. "$" if (minimumLength == 0) { - if (match (input, mymatch)) - { - mymatch.finish (input); - return mymatch; - } + if (match (input, mymatch)) + { + mymatch.finish (input); + return mymatch; + } } return null; @@ -2283,10 +2283,10 @@ public class RE extends REToken * set to the index position specified. */ public REMatchEnumeration getMatchEnumeration (Object input, int index, - int eflags) + int eflags) { return new REMatchEnumeration (this, makeCharIndexed (input, index), - index, eflags); + index, eflags); } @@ -2307,7 +2307,7 @@ public class RE extends REToken * Substitutes the replacement text for the first match found in the input * beginning at the specified index position. Specifying an index * effectively causes the regular expression engine to throw away the - * specified number of characters. + * specified number of characters. * * @param input The input text. * @param replace The replacement text, which may contain $x metacharacters (see REMatch.substituteInto). @@ -2335,14 +2335,14 @@ public class RE extends REToken * @see REMatch#substituteInto */ public String substitute (Object input, String replace, int index, - int eflags) + int eflags) { return substituteImpl (makeCharIndexed (input, index), replace, index, - eflags); + eflags); } private String substituteImpl (CharIndexed input, String replace, int index, - int eflags) + int eflags) { CPStringBuilder buffer = new CPStringBuilder (); REMatch m = getMatchImpl (input, index, eflags, buffer); @@ -2351,17 +2351,17 @@ public class RE extends REToken buffer.append (getReplacement (replace, m, eflags)); if (input.move (m.end[0])) { - do - { - buffer.append (input.charAt (0)); - } - while (input.move (1)); + do + { + buffer.append (input.charAt (0)); + } + while (input.move (1)); } return buffer.toString (); } /** - * Substitutes the replacement text for each non-overlapping match found + * Substitutes the replacement text for each non-overlapping match found * in the input text. * * @param input The input text. @@ -2375,7 +2375,7 @@ public class RE extends REToken } /** - * Substitutes the replacement text for each non-overlapping match found + * Substitutes the replacement text for each non-overlapping match found * in the input text, starting at the specified index. * * If the regular expression allows the empty string to match, it will @@ -2394,7 +2394,7 @@ public class RE extends REToken } /** - * Substitutes the replacement text for each non-overlapping match found + * Substitutes the replacement text for each non-overlapping match found * in the input text, starting at the specified index and using the * specified execution flags. * @@ -2407,35 +2407,35 @@ public class RE extends REToken * @see REMatch#substituteInto */ public String substituteAll (Object input, String replace, int index, - int eflags) + int eflags) { return substituteAllImpl (makeCharIndexed (input, index), replace, index, - eflags); + eflags); } private String substituteAllImpl (CharIndexed input, String replace, - int index, int eflags) + int index, int eflags) { CPStringBuilder buffer = new CPStringBuilder (); REMatch m; while ((m = getMatchImpl (input, index, eflags, buffer)) != null) { - buffer.append (getReplacement (replace, m, eflags)); - index = m.getEndIndex (); - if (m.end[0] == 0) - { - char ch = input.charAt (0); - if (ch != CharIndexed.OUT_OF_BOUNDS) - buffer.append (ch); - input.move (1); - } - else - { - input.move (m.end[0]); - } - - if (!input.isValid ()) - break; + buffer.append (getReplacement (replace, m, eflags)); + index = m.getEndIndex (); + if (m.end[0] == 0) + { + char ch = input.charAt (0); + if (ch != CharIndexed.OUT_OF_BOUNDS) + buffer.append (ch); + input.move (1); + } + else + { + input.move (m.end[0]); + } + + if (!input.isValid ()) + break; } return buffer.toString (); } @@ -2446,36 +2446,36 @@ public class RE extends REToken return replace; else { - if ((eflags & REG_REPLACE_USE_BACKSLASHESCAPE) > 0) - { - CPStringBuilder sb = new CPStringBuilder (); - int l = replace.length (); - for (int i = 0; i < l; i++) - { - char c = replace.charAt (i); - switch (c) - { - case '\\': - i++; - // Let StringIndexOutOfBoundsException be thrown. - sb.append (replace.charAt (i)); - break; - case '$': - int i1 = i + 1; - while (i1 < replace.length () && - Character.isDigit (replace.charAt (i1))) - i1++; - sb.append (m.substituteInto (replace.substring (i, i1))); - i = i1 - 1; - break; - default: - sb.append (c); - } - } - return sb.toString (); - } - else - return m.substituteInto (replace); + if ((eflags & REG_REPLACE_USE_BACKSLASHESCAPE) > 0) + { + CPStringBuilder sb = new CPStringBuilder (); + int l = replace.length (); + for (int i = 0; i < l; i++) + { + char c = replace.charAt (i); + switch (c) + { + case '\\': + i++; + // Let StringIndexOutOfBoundsException be thrown. + sb.append (replace.charAt (i)); + break; + case '$': + int i1 = i + 1; + while (i1 < replace.length () && + Character.isDigit (replace.charAt (i1))) + i1++; + sb.append (m.substituteInto (replace.substring (i, i1))); + i = i1 - 1; + break; + default: + sb.append (c); + } + } + return sb.toString (); + } + else + return m.substituteInto (replace); } } @@ -2493,45 +2493,45 @@ public class RE extends REToken if (firstToken == null) { - lastToken = firstToken = next; + lastToken = firstToken = next; } else { - // if chain returns false, it "rejected" the token due to - // an optimization, and next was combined with lastToken - if (lastToken.chain (next)) - { - lastToken = next; - } + // if chain returns false, it "rejected" the token due to + // an optimization, and next was combined with lastToken + if (lastToken.chain (next)) + { + lastToken = next; + } } } private static REToken setRepeated (REToken current, int min, int max, - int index) throws REException + int index) throws REException { if (current == null) throw new REException (getLocalizedMessage ("repeat.no.token"), - REException.REG_BADRPT, index); + REException.REG_BADRPT, index); return new RETokenRepeated (current.subIndex, current, min, max); } private static int getPosixSet (char[]pattern, int index, - CPStringBuilder buf) + CPStringBuilder buf) { // Precondition: pattern[index-1] == ':' // we will return pos of closing ']'. int i; for (i = index; i < (pattern.length - 1); i++) { - if ((pattern[i] == ':') && (pattern[i + 1] == ']')) - return i + 2; - buf.append (pattern[i]); + if ((pattern[i] == ':') && (pattern[i + 1] == ']')) + return i + 2; + buf.append (pattern[i]); } - return index; // didn't match up + return index; // didn't match up } private int getMinMax (char[]input, int index, IntPair minMax, - RESyntax syntax) throws REException + RESyntax syntax) throws REException { // Precondition: input[index-1] == '{', minMax != null @@ -2539,11 +2539,11 @@ public class RE extends REToken int startIndex = index; if (index == input.length) { - if (mustMatch) - throw new REException (getLocalizedMessage ("unmatched.brace"), - REException.REG_EBRACE, index); - else - return startIndex; + if (mustMatch) + throw new REException (getLocalizedMessage ("unmatched.brace"), + REException.REG_EBRACE, index); + else + return startIndex; } int min, max = 0; @@ -2553,20 +2553,20 @@ public class RE extends REToken // Read string of digits do { - index = getCharUnit (input, index, unit, false); - if (Character.isDigit (unit.ch)) - buf.append (unit.ch); + index = getCharUnit (input, index, unit, false); + if (Character.isDigit (unit.ch)) + buf.append (unit.ch); } while ((index != input.length) && Character.isDigit (unit.ch)); // Check for {} tomfoolery if (buf.length () == 0) { - if (mustMatch) - throw new REException (getLocalizedMessage ("interval.error"), - REException.REG_EBRACE, index); - else - return startIndex; + if (mustMatch) + throw new REException (getLocalizedMessage ("interval.error"), + REException.REG_EBRACE, index); + else + return startIndex; } min = Integer.parseInt (buf.toString ()); @@ -2575,8 +2575,8 @@ public class RE extends REToken max = min; else if (index == input.length) if (mustMatch) - throw new REException (getLocalizedMessage ("interval.no.end"), - REException.REG_EBRACE, index); + throw new REException (getLocalizedMessage ("interval.no.end"), + REException.REG_EBRACE, index); else return startIndex; else @@ -2585,28 +2585,28 @@ public class RE extends REToken buf = new CPStringBuilder (); // Read string of digits while (((index = - getCharUnit (input, index, unit, false)) != input.length) - && Character.isDigit (unit.ch)) - buf.append (unit.ch); + getCharUnit (input, index, unit, false)) != input.length) + && Character.isDigit (unit.ch)) + buf.append (unit.ch); if (! - ((unit.ch == '}') - && (syntax.get (RESyntax.RE_NO_BK_BRACES) ^ unit.bk))) - if (mustMatch) - throw new REException (getLocalizedMessage ("interval.error"), - REException.REG_EBRACE, index); + ((unit.ch == '}') + && (syntax.get (RESyntax.RE_NO_BK_BRACES) ^ unit.bk))) + if (mustMatch) + throw new REException (getLocalizedMessage ("interval.error"), + REException.REG_EBRACE, index); else return startIndex; // This is the case of {x,} if (buf.length () == 0) - max = Integer.MAX_VALUE; + max = Integer.MAX_VALUE; else - max = Integer.parseInt (buf.toString ()); + max = Integer.parseInt (buf.toString ()); } else if (mustMatch) throw new REException (getLocalizedMessage ("interval.error"), - REException.REG_EBRACE, index); + REException.REG_EBRACE, index); else return startIndex; @@ -2651,13 +2651,13 @@ public class RE extends REToken // be the most likely because this is the case with // java.util.regex.Matcher. // We could let a String or a CharSequence fall through - // to final input, but since it'a very likely input type, + // to final input, but since it'a very likely input type, // we check it first. if (input instanceof CharIndexed) { - CharIndexed ci = (CharIndexed) input; - ci.setAnchor (index); - return ci; + CharIndexed ci = (CharIndexed) input; + ci.setAnchor (index); + return ci; } else if (input instanceof CharSequence) return new CharIndexedCharSequence ((CharSequence) input, index); diff --git a/gnu/java/util/regex/REFilterInputStream.java b/gnu/java/util/regex/REFilterInputStream.java index c7acb714a..c9fb346ba 100644 --- a/gnu/java/util/regex/REFilterInputStream.java +++ b/gnu/java/util/regex/REFilterInputStream.java @@ -70,7 +70,7 @@ public class REFilterInputStream extends FilterInputStream * * @param stream The InputStream to be filtered. * @param expr The regular expression to search for. - * @param replace The text pattern to replace matches with. + * @param replace The text pattern to replace matches with. */ public REFilterInputStream (InputStream stream, RE expr, String replace) { @@ -89,7 +89,7 @@ public class REFilterInputStream extends FilterInputStream // If we have buffered replace data, use it. if ((buffer != null) && (bufpos < buffer.length ())) { - return (int) buffer.charAt (bufpos++); + return (int) buffer.charAt (bufpos++); } // check if input is at a valid position @@ -99,18 +99,18 @@ public class REFilterInputStream extends FilterInputStream REMatch mymatch = new REMatch (expr.getNumSubs (), offset, 0); if (expr.match (stream, mymatch)) { - mymatch.end[0] = mymatch.index; - mymatch.finish (stream); - stream.move (mymatch.toString ().length ()); - offset += mymatch.toString ().length (); - buffer = mymatch.substituteInto (replace); - bufpos = 1; - - // This is prone to infinite loops if replace string turns out empty. - if (buffer.length () > 0) - { - return buffer.charAt (0); - } + mymatch.end[0] = mymatch.index; + mymatch.finish (stream); + stream.move (mymatch.toString ().length ()); + offset += mymatch.toString ().length (); + buffer = mymatch.substituteInto (replace); + bufpos = 1; + + // This is prone to infinite loops if replace string turns out empty. + if (buffer.length () > 0) + { + return buffer.charAt (0); + } } char ch = stream.charAt (0); if (ch == CharIndexed.OUT_OF_BOUNDS) @@ -120,9 +120,9 @@ public class REFilterInputStream extends FilterInputStream return ch; } - /** + /** * Returns false. REFilterInputStream does not support mark() and - * reset() methods. + * reset() methods. */ public boolean markSupported () { @@ -136,11 +136,11 @@ public class REFilterInputStream extends FilterInputStream int ok = 0; while (len-- > 0) { - i = read (); - if (i == -1) - return (ok == 0) ? -1 : ok; - b[off++] = (byte) i; - ok++; + i = read (); + if (i == -1) + return (ok == 0) ? -1 : ok; + b[off++] = (byte) i; + ok++; } return ok; } diff --git a/gnu/java/util/regex/REMatch.java b/gnu/java/util/regex/REMatch.java index d29972e1d..5940094ba 100644 --- a/gnu/java/util/regex/REMatch.java +++ b/gnu/java/util/regex/REMatch.java @@ -56,7 +56,7 @@ public final class REMatch implements Serializable, Cloneable private CharIndexed matchedCharIndexed; // These variables are package scope for fast access within the engine - int eflags; // execution flags this match was made using + int eflags; // execution flags this match was made using // Offset in source text where match was tried. This is zero-based; // the actual position in the source text is given by (offset + anchor). @@ -68,19 +68,19 @@ public final class REMatch implements Serializable, Cloneable int anchor; // Package scope; used by RE. - int index; // used while matching to mark current match position in input + int index; // used while matching to mark current match position in input // start1[i] is set when the i-th subexp starts. And start1[i] is copied // to start[i] when the i-th subexp ends. So start[i] keeps the previously // assigned value while the i-th subexp is being processed. This makes // backreference to the i-th subexp within the i-th subexp possible. - int[] start; // start positions (relative to offset) for each (sub)exp. - int[] start1; // start positions (relative to offset) for each (sub)exp. - int[] end; // end positions for the same + int[] start; // start positions (relative to offset) for each (sub)exp. + int[] start1; // start positions (relative to offset) for each (sub)exp. + int[] end; // end positions for the same // start[i] == -1 or end[i] == -1 means that the start/end position is void. // start[i] == p or end[i] == p where p < 0 and p != -1 means that // the actual start/end position is (p+1). Start/end positions may // become negative when the subexpression is in a RETokenLookBehind. - boolean empty; // empty string matched. This flag is used only within + boolean empty; // empty string matched. This flag is used only within // RETokenRepeated. BacktrackStack backtrackStack; @@ -99,7 +99,7 @@ public final class REMatch implements Serializable, Cloneable } catch (CloneNotSupportedException e) { - throw new Error (); // doesn't happen + throw new Error (); // doesn't happen } } @@ -133,13 +133,13 @@ public final class REMatch implements Serializable, Cloneable matchedCharIndexed = text; for (i = 0; i < start.length; i++) { - // If any subexpressions didn't terminate, they don't count - // TODO check if this code ever gets hit - if ((start[i] == -1) ^ (end[i] == -1)) - { - start[i] = -1; - end[i] = -1; - } + // If any subexpressions didn't terminate, they don't count + // TODO check if this code ever gets hit + if ((start[i] == -1) ^ (end[i] == -1)) + { + start[i] = -1; + end[i] = -1; + } } backtrackStack = null; } @@ -151,7 +151,7 @@ public final class REMatch implements Serializable, Cloneable this.index = 0; for (int i = 0; i < start.length; i++) { - start[i] = start1[i] = end[i] = -1; + start[i] = start1[i] = end[i] = -1; } backtrackStack = null; } @@ -160,7 +160,7 @@ public final class REMatch implements Serializable, Cloneable * Returns the string matching the pattern. This makes it convenient * to write code like the following: * <P> - * <code> + * <code> * REMatch myMatch = myExpression.getMatch(myString);<br> * if (myMatch != null) System.out.println("Regexp found: "+myMatch); * </code> @@ -194,7 +194,7 @@ public final class REMatch implements Serializable, Cloneable * myMatch.getEndIndex());</code> * <P> * But you can save yourself that work, since the <code>toString()</code> - * method (above) does exactly that for you. + * method (above) does exactly that for you. */ public int getEndIndex () { @@ -219,21 +219,21 @@ public final class REMatch implements Serializable, Cloneable return (matchedText.substring (start[sub], end[sub])); else { - // This case occurs with RETokenLookAhead or RETokenLookBehind. - CPStringBuilder sb = new CPStringBuilder (); - int s = start[sub]; - int e = end[sub]; - if (s < 0) - s += 1; - if (e < 0) - e += 1; - for (int i = start[0] + s; i < start[0] + e; i++) - sb.append (matchedCharIndexed.charAt (i)); - return sb.toString (); + // This case occurs with RETokenLookAhead or RETokenLookBehind. + CPStringBuilder sb = new CPStringBuilder (); + int s = start[sub]; + int e = end[sub]; + if (s < 0) + s += 1; + if (e < 0) + e += 1; + for (int i = start[0] + s; i < start[0] + e; i++) + sb.append (matchedCharIndexed.charAt (i)); + return sb.toString (); } } - /** + /** * Returns the index within the input string used to generate this match * where subexpression number <i>sub</i> begins, or <code>-1</code> if * the subexpression does not exist. The initial position is zero. @@ -249,7 +249,7 @@ public final class REMatch implements Serializable, Cloneable return (x == -1) ? x : (x >= 0) ? offset + x : offset + x + 1; } - /** + /** * Returns the index within the input string used to generate this match * where subexpression number <i>sub</i> begins, or <code>-1</code> if * the subexpression does not exist. The initial position is zero. @@ -265,7 +265,7 @@ public final class REMatch implements Serializable, Cloneable return (x == -1) ? x : (x >= 0) ? offset + x : offset + x + 1; } - /** + /** * Returns the index within the input string used to generate this match * where subexpression number <i>sub</i> ends, or <code>-1</code> if * the subexpression does not exist. The initial position is zero. @@ -281,7 +281,7 @@ public final class REMatch implements Serializable, Cloneable return (x == -1) ? x : (x >= 0) ? offset + x : offset + x + 1; } - /** + /** * Returns the index within the input string used to generate this match * where subexpression number <i>sub</i> ends, or <code>-1</code> if * the subexpression does not exist. The initial position is zero. @@ -314,30 +314,30 @@ public final class REMatch implements Serializable, Cloneable int pos; for (pos = 0; pos < input.length () - 1; pos++) { - if ((input.charAt (pos) == '$') - && (Character.isDigit (input.charAt (pos + 1)))) - { - int val = Character.digit (input.charAt (++pos), 10); - int pos1 = pos + 1; - while (pos1 < input.length () && - Character.isDigit (input.charAt (pos1))) - { - int val1 = - val * 10 + Character.digit (input.charAt (pos1), 10); - if (val1 >= start.length) - break; - pos1++; - val = val1; - } - pos = pos1 - 1; - - if (val < start.length) - { - output.append (toString (val)); - } - } - else - output.append (input.charAt (pos)); + if ((input.charAt (pos) == '$') + && (Character.isDigit (input.charAt (pos + 1)))) + { + int val = Character.digit (input.charAt (++pos), 10); + int pos1 = pos + 1; + while (pos1 < input.length () && + Character.isDigit (input.charAt (pos1))) + { + int val1 = + val * 10 + Character.digit (input.charAt (pos1), 10); + if (val1 >= start.length) + break; + pos1++; + val = val1; + } + pos = pos1 - 1; + + if (val < start.length) + { + output.append (toString (val)); + } + } + else + output.append (input.charAt (pos)); } if (pos < input.length ()) output.append (input.charAt (pos)); @@ -346,16 +346,16 @@ public final class REMatch implements Serializable, Cloneable /* The following are used for debugging purpose public static String d(REMatch m) { - if (m == null) return "null"; + if (m == null) return "null"; else return "[" + m.index + "]"; } public String substringUptoIndex(CharIndexed input) { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < index; i++) { - sb.append(input.charAt(i)); - } - return sb.toString(); + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < index; i++) { + sb.append(input.charAt(i)); + } + return sb.toString(); } */ diff --git a/gnu/java/util/regex/REMatchEnumeration.java b/gnu/java/util/regex/REMatchEnumeration.java index f0c78be92..04432d07c 100644 --- a/gnu/java/util/regex/REMatchEnumeration.java +++ b/gnu/java/util/regex/REMatchEnumeration.java @@ -47,7 +47,7 @@ import java.util.NoSuchElementException; * An REMatchEnumeration enumerates regular expression matches over a * given input text. You obtain a reference to an enumeration using * the <code>getMatchEnumeration()</code> methods on an instance of - * RE. + * RE. * * <P> * @@ -59,15 +59,15 @@ import java.util.NoSuchElementException; * not need to be searched immediately. * * <P> - * + * * The enumerated type is especially useful when searching on a Reader * or InputStream, because the InputStream read position cannot be * guaranteed after calling <code>getMatch()</code> (see the * description of that method for an explanation of why). Enumeration * also saves a lot of overhead required when calling * <code>getMatch()</code> multiple times. - * - * @author <A HREF="mailto:wes@cacas.org">Wes Biggs</A> + * + * @author <A HREF="mailto:wes@cacas.org">Wes Biggs</A> */ public class REMatchEnumeration implements Enumeration < REMatch >, Serializable @@ -113,17 +113,17 @@ public class REMatchEnumeration { if (more == MAYBE) { - match = expr.getMatchImpl (input, index, eflags, buffer); - if (match != null) - { - input.move ((match.end[0] > 0) ? match.end[0] : 1); - - index = - (match.end[0] > 0) ? match.end[0] + match.offset : index + 1; - more = YES; - } - else - more = NO; + match = expr.getMatchImpl (input, index, eflags, buffer); + if (match != null) + { + input.move ((match.end[0] > 0) ? match.end[0] : 1); + + index = + (match.end[0] > 0) ? match.end[0] + match.offset : index + 1; + more = YES; + } + else + more = NO; } return (more == YES); } @@ -133,8 +133,8 @@ public class REMatchEnumeration { if (hasMoreElements ()) { - more = (input.isValid ())? MAYBE : NO; - return match; + more = (input.isValid ())? MAYBE : NO; + return match; } throw new NoSuchElementException (); } diff --git a/gnu/java/util/regex/RESyntax.java b/gnu/java/util/regex/RESyntax.java index 38d70564d..2080cb763 100644 --- a/gnu/java/util/regex/RESyntax.java +++ b/gnu/java/util/regex/RESyntax.java @@ -94,7 +94,7 @@ public final class RESyntax implements Serializable /** * Syntax bit. Repetition and alternation operators are invalid - * at start and end of pattern and other places. + * at start and end of pattern and other places. * <B>Not implemented</B>. */ public static final int RE_CONTEXT_INVALID_OPS = 5; @@ -115,7 +115,7 @@ public final class RESyntax implements Serializable public static final int RE_INTERVALS = 8; /** - * Syntax bit. No alternation (|), match one-or-more (+), or + * Syntax bit. No alternation (|), match one-or-more (+), or * match zero-or-one (?) operators. */ public static final int RE_LIMITED_OPS = 9; @@ -123,7 +123,7 @@ public final class RESyntax implements Serializable /** * Syntax bit. Newline is an alternation operator. */ - public static final int RE_NEWLINE_ALT = 10; // impl. + public static final int RE_NEWLINE_ALT = 10; // impl. /** * Syntax bit. Intervals use { } instead of \{ \} @@ -317,7 +317,7 @@ public final class RESyntax implements Serializable * Emulates regular expression support in Larry Wall's perl, version 4, * using single line mode (/s modifier). */ - public static final RESyntax RE_SYNTAX_PERL4_S; // single line mode (/s) + public static final RESyntax RE_SYNTAX_PERL4_S; // single line mode (/s) /** * Predefined syntax. @@ -403,23 +403,23 @@ public final class RESyntax implements Serializable /* There is no official Perl spec, but here's a "best guess" */ - RE_SYNTAX_PERL4 = new RESyntax ().set (RE_BACKSLASH_ESCAPE_IN_LISTS).set (RE_CONTEXT_INDEP_ANCHORS).set (RE_CONTEXT_INDEP_OPS) // except for '{', apparently - .set (RE_INTERVALS).set (RE_NO_BK_BRACES).set (RE_NO_BK_PARENS).set (RE_NO_BK_VBAR).set (RE_NO_EMPTY_RANGES).set (RE_CHAR_CLASS_ESCAPES) // \d,\D,\w,\W,\s,\S + RE_SYNTAX_PERL4 = new RESyntax ().set (RE_BACKSLASH_ESCAPE_IN_LISTS).set (RE_CONTEXT_INDEP_ANCHORS).set (RE_CONTEXT_INDEP_OPS) // except for '{', apparently + .set (RE_INTERVALS).set (RE_NO_BK_BRACES).set (RE_NO_BK_PARENS).set (RE_NO_BK_VBAR).set (RE_NO_EMPTY_RANGES).set (RE_CHAR_CLASS_ESCAPES) // \d,\D,\w,\W,\s,\S .makeFinal (); RE_SYNTAX_PERL4_S = new RESyntax (RE_SYNTAX_PERL4).set (RE_DOT_NEWLINE).makeFinal (); - RE_SYNTAX_PERL5 = new RESyntax (RE_SYNTAX_PERL4).set (RE_PURE_GROUPING) // (?:) - .set (RE_STINGY_OPS) // *?,??,+?,{}? - .set (RE_LOOKAHEAD) // (?=)(?!) - .set (RE_STRING_ANCHORS) // \A,\Z - .set (RE_CHAR_CLASS_ESC_IN_LISTS) // \d,\D,\w,\W,\s,\S within [] - .set (RE_COMMENTS) // (?#) - .set (RE_EMBEDDED_FLAGS) // (?imsx-imsx) - .set (RE_OCTAL_CHAR) // \0377 - .set (RE_HEX_CHAR) // \x1b - .set (RE_NAMED_PROPERTY) // \p{prop}, \P{prop} + RE_SYNTAX_PERL5 = new RESyntax (RE_SYNTAX_PERL4).set (RE_PURE_GROUPING) // (?:) + .set (RE_STINGY_OPS) // *?,??,+?,{}? + .set (RE_LOOKAHEAD) // (?=)(?!) + .set (RE_STRING_ANCHORS) // \A,\Z + .set (RE_CHAR_CLASS_ESC_IN_LISTS) // \d,\D,\w,\W,\s,\S within [] + .set (RE_COMMENTS) // (?#) + .set (RE_EMBEDDED_FLAGS) // (?imsx-imsx) + .set (RE_OCTAL_CHAR) // \0377 + .set (RE_HEX_CHAR) // \x1b + .set (RE_NAMED_PROPERTY) // \p{prop}, \P{prop} .makeFinal (); RE_SYNTAX_PERL5_S = @@ -427,9 +427,9 @@ public final class RESyntax implements Serializable RE_SYNTAX_JAVA_1_4 = new RESyntax (RE_SYNTAX_PERL5) // XXX - .set (RE_POSSESSIVE_OPS) // *+,?+,++,{}+ - .set (RE_UNICODE_CHAR) // \u1234 - .set (RE_NESTED_CHARCLASS) // [a-z&&[^p-r]] + .set (RE_POSSESSIVE_OPS) // *+,?+,++,{}+ + .set (RE_UNICODE_CHAR) // \u1234 + .set (RE_NESTED_CHARCLASS) // [a-z&&[^p-r]] .makeFinal (); } @@ -457,7 +457,7 @@ public final class RESyntax implements Serializable } /** - * Construct a new syntax object with all bits set the same + * Construct a new syntax object with all bits set the same * as the other syntax. */ public RESyntax (RESyntax other) @@ -474,7 +474,7 @@ public final class RESyntax implements Serializable } /** - * Set a given bit in this syntax. + * Set a given bit in this syntax. * * @param index the constant (RESyntax.RE_xxx) bit to set. * @return a reference to this object for easy chaining. @@ -488,7 +488,7 @@ public final class RESyntax implements Serializable } /** - * Clear a given bit in this syntax. + * Clear a given bit in this syntax. * * @param index the constant (RESyntax.RE_xxx) bit to clear. * @return a reference to this object for easy chaining. @@ -516,7 +516,7 @@ public final class RESyntax implements Serializable * characters that have specific meaning within the current syntax * can cause unexpected chronosynclastic infundibula. * - * @return this object for convenient chaining + * @return this object for convenient chaining */ public RESyntax setLineSeparator (String aSeparator) { diff --git a/gnu/java/util/regex/REToken.java b/gnu/java/util/regex/REToken.java index 681ac517f..ed9b31747 100644 --- a/gnu/java/util/regex/REToken.java +++ b/gnu/java/util/regex/REToken.java @@ -58,7 +58,7 @@ abstract class REToken implements Serializable, Cloneable } catch (CloneNotSupportedException e) { - throw new Error (); // doesn't happen + throw new Error (); // doesn't happen } } @@ -96,15 +96,15 @@ abstract class REToken implements Serializable, Cloneable { if (!fake) { - setHitEnd (input, mymatch); + setHitEnd (input, mymatch); } REMatch m = matchThis (input, mymatch); if (m == null) return false; if (next (input, m)) { - mymatch.assignFrom (m); - return true; + mymatch.assignFrom (m); + return true; } return false; } @@ -188,7 +188,7 @@ abstract class REToken implements Serializable, Cloneable boolean chain (REToken token) { next = token; - return true; // Token was accepted + return true; // Token was accepted } abstract void dump (CPStringBuilder os); diff --git a/gnu/java/util/regex/RETokenAny.java b/gnu/java/util/regex/RETokenAny.java index c002d0504..f5039682d 100644 --- a/gnu/java/util/regex/RETokenAny.java +++ b/gnu/java/util/regex/RETokenAny.java @@ -71,8 +71,8 @@ final class RETokenAny extends REToken boolean retval = matchOneChar (ch); if (retval) { - ++mymatch.index; - return mymatch; + ++mymatch.index; + return mymatch; } return null; } @@ -80,9 +80,9 @@ final class RETokenAny extends REToken boolean matchOneChar (char ch) { if ((ch == CharIndexed.OUT_OF_BOUNDS) - || (!newline && (ch == '\n')) || (matchNull && (ch == 0))) + || (!newline && (ch == '\n')) || (matchNull && (ch == 0))) { - return false; + return false; } return true; } @@ -98,12 +98,12 @@ final class RETokenAny extends REToken int numRepeats = 0; while (true) { - if (numRepeats >= max) - break; - char ch = input.charAt (index++); - if (!matchOneChar (ch)) - break; - numRepeats++; + if (numRepeats >= max) + break; + char ch = input.charAt (index++); + if (!matchOneChar (ch)) + break; + numRepeats++; } return numRepeats; } diff --git a/gnu/java/util/regex/RETokenBackRef.java b/gnu/java/util/regex/RETokenBackRef.java index 8f146222d..52061ca2e 100644 --- a/gnu/java/util/regex/RETokenBackRef.java +++ b/gnu/java/util/regex/RETokenBackRef.java @@ -64,30 +64,30 @@ final class RETokenBackRef extends REToken b = mymatch.start[num]; e = mymatch.end[num]; if ((b == -1) || (e == -1)) - return null; // this shouldn't happen, but... + return null; // this shouldn't happen, but... if (b < 0) b += 1; if (e < 0) e += 1; for (int i = b; i < e; i++) { - char c1 = input.charAt (mymatch.index + i - b); - char c2 = input.charAt (i); - if (c1 != c2) - { - if (insens) - { - if (c1 != toLowerCase (c2, unicodeAware) && - c1 != toUpperCase (c2, unicodeAware)) - { - return null; - } - } - else - { - return null; - } - } + char c1 = input.charAt (mymatch.index + i - b); + char c2 = input.charAt (i); + if (c1 != c2) + { + if (insens) + { + if (c1 != toLowerCase (c2, unicodeAware) && + c1 != toUpperCase (c2, unicodeAware)) + { + return null; + } + } + else + { + return null; + } + } } mymatch.index += e - b; return mymatch; diff --git a/gnu/java/util/regex/RETokenChar.java b/gnu/java/util/regex/RETokenChar.java index babcf3e4e..3469ecfa8 100644 --- a/gnu/java/util/regex/RETokenChar.java +++ b/gnu/java/util/regex/RETokenChar.java @@ -67,8 +67,8 @@ final class RETokenChar extends REToken { if (matchOneString (input, mymatch.index)) { - mymatch.index += matchedLength; - return mymatch; + mymatch.index += matchedLength; + return mymatch; } // java.util.regex.Matcher#hitEnd() requires that the length of // partial match be counted. @@ -85,12 +85,12 @@ final class RETokenChar extends REToken char c; for (int i = 0; i < z; i++) { - c = input.charAt (index + i); - if (!charEquals (c, ch[i])) - { - return false; - } - ++matchedLength; + c = input.charAt (index + i); + if (!charEquals (c, ch[i])) + { + return false; + } + ++matchedLength; } return true; } @@ -120,15 +120,15 @@ final class RETokenChar extends REToken int z = ch.length; while (true) { - if (numRepeats >= max) - break; - if (matchOneString (input, index)) - { - index += z; - numRepeats++; - } - else - break; + if (numRepeats >= max) + break; + if (matchOneString (input, index)) + { + index += z; + numRepeats++; + } + else + break; } return numRepeats; } @@ -138,18 +138,18 @@ final class RETokenChar extends REToken { if (next instanceof RETokenChar && ((RETokenChar) next).insens == insens) { - RETokenChar cnext = (RETokenChar) next; - int newsize = ch.length + cnext.ch.length; + RETokenChar cnext = (RETokenChar) next; + int newsize = ch.length + cnext.ch.length; - char[] chTemp = new char[newsize]; + char[] chTemp = new char[newsize]; - System.arraycopy (ch, 0, chTemp, 0, ch.length); - System.arraycopy (cnext.ch, 0, chTemp, ch.length, cnext.ch.length); + System.arraycopy (ch, 0, chTemp, 0, ch.length); + System.arraycopy (cnext.ch, 0, chTemp, ch.length, cnext.ch.length); - ch = chTemp; - if (cnext.next == null) - return false; - return chain (cnext.next); + ch = chTemp; + if (cnext.next == null) + return false; + return chain (cnext.next); } else return super.chain (next); diff --git a/gnu/java/util/regex/RETokenEnd.java b/gnu/java/util/regex/RETokenEnd.java index 33e0febb7..28d78231a 100644 --- a/gnu/java/util/regex/RETokenEnd.java +++ b/gnu/java/util/regex/RETokenEnd.java @@ -92,38 +92,38 @@ final class RETokenEnd extends REToken return ((mymatch.eflags & RE.REG_NOTEOL) > 0) ? null : mymatch; if (check_java_line_terminators) { - if (ch == '\n') - { - char ch1 = input.charAt (mymatch.index - 1); - if (ch1 == '\r') - return null; - return mymatch; - } - if (ch == '\r') - return mymatch; - if (ch == '\u0085') - return mymatch; // A next-line character - if (ch == '\u2028') - return mymatch; // A line-separator character - if (ch == '\u2029') - return mymatch; // A paragraph-separator character - return null; + if (ch == '\n') + { + char ch1 = input.charAt (mymatch.index - 1); + if (ch1 == '\r') + return null; + return mymatch; + } + if (ch == '\r') + return mymatch; + if (ch == '\u0085') + return mymatch; // A next-line character + if (ch == '\u2028') + return mymatch; // A line-separator character + if (ch == '\u2029') + return mymatch; // A paragraph-separator character + return null; } if (newline != null) { - char z; - int i = 0; // position in newline - do - { - z = newline.charAt (i); - if (ch != z) - return null; - ++i; - ch = input.charAt (mymatch.index + i); - } - while (i < newline.length ()); - - return mymatch; + char z; + int i = 0; // position in newline + do + { + z = newline.charAt (i); + if (ch != z) + return null; + ++i; + ch = input.charAt (mymatch.index + i); + } + while (i < newline.length ()); + + return mymatch; } return null; } diff --git a/gnu/java/util/regex/RETokenEndOfPreviousMatch.java b/gnu/java/util/regex/RETokenEndOfPreviousMatch.java index e4ad61941..67a1b852e 100644 --- a/gnu/java/util/regex/RETokenEndOfPreviousMatch.java +++ b/gnu/java/util/regex/RETokenEndOfPreviousMatch.java @@ -58,13 +58,13 @@ class RETokenEndOfPreviousMatch extends RETokenStart if (lastMatch == null) return super.matchThis (input, mymatch); if (input.getAnchor () + mymatch.index == - lastMatch.anchor + lastMatch.index) + lastMatch.anchor + lastMatch.index) { - return mymatch; + return mymatch; } else { - return null; + return null; } } diff --git a/gnu/java/util/regex/RETokenIndependent.java b/gnu/java/util/regex/RETokenIndependent.java index 8ad728df8..089aa18af 100644 --- a/gnu/java/util/regex/RETokenIndependent.java +++ b/gnu/java/util/regex/RETokenIndependent.java @@ -67,10 +67,10 @@ final class RETokenIndependent extends REToken boolean b = re.match (input, mymatch); if (b) { - // Once we have found a match, we do not see other possible matches. - if (mymatch.backtrackStack != null) - mymatch.backtrackStack.clear (); - return mymatch; + // Once we have found a match, we do not see other possible matches. + if (mymatch.backtrackStack != null) + mymatch.backtrackStack.clear (); + return mymatch; } return null; diff --git a/gnu/java/util/regex/RETokenLookAhead.java b/gnu/java/util/regex/RETokenLookAhead.java index 1dc601938..34625aac6 100644 --- a/gnu/java/util/regex/RETokenLookAhead.java +++ b/gnu/java/util/regex/RETokenLookAhead.java @@ -65,16 +65,16 @@ final class RETokenLookAhead extends REToken REMatch trymatch = (REMatch) mymatch.clone (); if (re.match (input, trymatch)) { - if (negative) - return null; - trymatch.index = mymatch.index; - return trymatch; + if (negative) + return null; + trymatch.index = mymatch.index; + return trymatch; } else { - if (negative) - return mymatch; - return null; + if (negative) + return mymatch; + return null; } } diff --git a/gnu/java/util/regex/RETokenLookBehind.java b/gnu/java/util/regex/RETokenLookBehind.java index f61c93c0a..c85e37f69 100644 --- a/gnu/java/util/regex/RETokenLookBehind.java +++ b/gnu/java/util/regex/RETokenLookBehind.java @@ -73,29 +73,29 @@ final class RETokenLookBehind extends REToken re1.chain (stopper); if (re1.match (behind, trymatch)) { - if (negative) - return null; - for (int i = 0; i < trymatch.start.length; i++) - { - if (trymatch.start[i] != -1 && trymatch.end[i] != -1) - { - trymatch.start[i] -= diff; - if (trymatch.start[i] < 0) - trymatch.start[i] -= 1; - trymatch.end[i] -= diff; - if (trymatch.end[i] < 0) - trymatch.end[i] -= 1; - } - } - trymatch.index = mymatch.index; - trymatch.offset = mymatch.offset; - return trymatch; + if (negative) + return null; + for (int i = 0; i < trymatch.start.length; i++) + { + if (trymatch.start[i] != -1 && trymatch.end[i] != -1) + { + trymatch.start[i] -= diff; + if (trymatch.start[i] < 0) + trymatch.start[i] -= 1; + trymatch.end[i] -= diff; + if (trymatch.end[i] < 0) + trymatch.end[i] -= 1; + } + } + trymatch.index = mymatch.index; + trymatch.offset = mymatch.offset; + return trymatch; } else { - if (negative) - return mymatch; - return null; + if (negative) + return mymatch; + return null; } } diff --git a/gnu/java/util/regex/RETokenNamedProperty.java b/gnu/java/util/regex/RETokenNamedProperty.java index 1683cb1bf..340da03fb 100644 --- a/gnu/java/util/regex/RETokenNamedProperty.java +++ b/gnu/java/util/regex/RETokenNamedProperty.java @@ -96,7 +96,7 @@ final class RETokenNamedProperty extends REToken }; RETokenNamedProperty (int subIndex, String name, boolean insens, - boolean negate) throws REException + boolean negate) throws REException { super (subIndex); this.name = name; @@ -121,8 +121,8 @@ final class RETokenNamedProperty extends REToken boolean retval = matchOneChar (ch); if (retval) { - ++mymatch.index; - return mymatch; + ++mymatch.index; + return mymatch; } return null; } @@ -135,9 +135,9 @@ final class RETokenNamedProperty extends REToken boolean retval = handler.includes (ch); if (insens) { - retval = retval || - handler.includes (toUpperCase (ch, unicodeAware)) || - handler.includes (toLowerCase (ch, unicodeAware)); + retval = retval || + handler.includes (toUpperCase (ch, unicodeAware)) || + handler.includes (toLowerCase (ch, unicodeAware)); } if (negate) @@ -156,12 +156,12 @@ final class RETokenNamedProperty extends REToken int numRepeats = 0; while (true) { - if (numRepeats >= max) - break; - char ch = input.charAt (index++); - if (!matchOneChar (ch)) - break; - numRepeats++; + if (numRepeats >= max) + break; + char ch = input.charAt (index++); + if (!matchOneChar (ch)) + break; + numRepeats++; } return numRepeats; } @@ -179,37 +179,37 @@ final class RETokenNamedProperty extends REToken private Handler getHandler (String name) throws REException { if (name.equals ("Lower") || name.equals ("Upper") || - // name.equals("ASCII") || - name.equals ("Alpha") || - name.equals ("Digit") || - name.equals ("Alnum") || - name.equals ("Punct") || - name.equals ("Graph") || - name.equals ("Print") || - name.equals ("Blank") || - name.equals ("Cntrl") || - name.equals ("XDigit") || name.equals ("Space")) + // name.equals("ASCII") || + name.equals ("Alpha") || + name.equals ("Digit") || + name.equals ("Alnum") || + name.equals ("Punct") || + name.equals ("Graph") || + name.equals ("Print") || + name.equals ("Blank") || + name.equals ("Cntrl") || + name.equals ("XDigit") || name.equals ("Space")) { - return new POSIXHandler (name); + return new POSIXHandler (name); } if (name.startsWith ("In")) { - try - { - name = name.substring (2); - Character.UnicodeBlock block = - Character.UnicodeBlock.forName (name); - return new UnicodeBlockHandler (block); - } - catch (IllegalArgumentException e) - { - throw new REException ("Invalid Unicode block name: " + name, - REException.REG_ESCAPE, 0); - } + try + { + name = name.substring (2); + Character.UnicodeBlock block = + Character.UnicodeBlock.forName (name); + return new UnicodeBlockHandler (block); + } + catch (IllegalArgumentException e) + { + throw new REException ("Invalid Unicode block name: " + name, + REException.REG_ESCAPE, 0); + } } if (name.startsWith ("Is")) { - name = name.substring (2); + name = name.substring (2); } // "grouped properties" @@ -291,27 +291,27 @@ final class RETokenNamedProperty extends REToken if (name.equals ("all")) return new Handler () { - public boolean includes (char c) - { - return true; - } + public boolean includes (char c) + { + return true; + } }; if (name.startsWith ("java")) { - try - { - Method m = Character.class.getMethod ("is" + name.substring (4), - Character.TYPE); - return new JavaCategoryHandler (m); - } - catch (NoSuchMethodException e) - { - throw new REException ("Unsupported Java handler: " + name, e, - REException.REG_ESCAPE, 0); - } + try + { + Method m = Character.class.getMethod ("is" + name.substring (4), + Character.TYPE); + return new JavaCategoryHandler (m); + } + catch (NoSuchMethodException e) + { + throw new REException ("Unsupported Java handler: " + name, e, + REException.REG_ESCAPE, 0); + } } throw new REException ("unsupported name " + name, REException.REG_ESCAPE, - 0); + 0); } private static class POSIXHandler extends Handler @@ -321,9 +321,9 @@ final class RETokenNamedProperty extends REToken { int posixId = RETokenPOSIX.intValue (name.toLowerCase ()); if (posixId != -1) - retoken = new RETokenPOSIX (0, posixId, false, false); + retoken = new RETokenPOSIX (0, posixId, false, false); else - throw new RuntimeException ("Unknown posix ID: " + name); + throw new RuntimeException ("Unknown posix ID: " + name); } public boolean includes (char c) { @@ -355,8 +355,8 @@ final class RETokenNamedProperty extends REToken { int category = Character.getType (c); for (int i = 0; i < categories.length; i++) - if (category == categories[i]) - return true; + if (category == categories[i]) + return true; return false; } } @@ -394,15 +394,15 @@ final class RETokenNamedProperty extends REToken { try { - return (Boolean) method.invoke (null, c); + return (Boolean) method.invoke (null, c); } catch (IllegalAccessException e) { - throw new InternalError ("Unable to access method " + method); + throw new InternalError ("Unable to access method " + method); } catch (InvocationTargetException e) { - throw new InternalError ("Error invoking " + method); + throw new InternalError ("Error invoking " + method); } } } diff --git a/gnu/java/util/regex/RETokenOneOf.java b/gnu/java/util/regex/RETokenOneOf.java index fcae3c2d1..3bea889ec 100644 --- a/gnu/java/util/regex/RETokenOneOf.java +++ b/gnu/java/util/regex/RETokenOneOf.java @@ -59,7 +59,7 @@ final class RETokenOneOf extends REToken // the basic part /2-7a-c/ is stored in the ArrayList options, and // the additional part /[f-k][m-z]&&[^p-v][st]/ is stored in the // ArrayList addition in the following order (Reverse Polish Notation): - // -- The matching result of the basic part is assumed here. + // -- The matching result of the basic part is assumed here. // [f-k] -- REToken // "|" -- or // [m-z] -- REToken @@ -80,7 +80,7 @@ final class RETokenOneOf extends REToken // \D --> new RETokenOneOf("0123456789",true, ..) RETokenOneOf (int subIndex, String optionsStr, boolean negative, - boolean insens) + boolean insens) { super (subIndex); options = new ArrayList < REToken > (); @@ -97,7 +97,7 @@ final class RETokenOneOf extends REToken } RETokenOneOf (int subIndex, List < REToken > options, - List < Object > addition, boolean negative) + List < Object > addition, boolean negative) { super (subIndex); this.options = options; @@ -114,8 +114,8 @@ final class RETokenOneOf extends REToken int x; for (REToken t:options) { - if ((x = t.getMinimumLength ()) < min) - min = x; + if ((x = t.getMinimumLength ()) < min) + min = x; } return min; } @@ -128,8 +128,8 @@ final class RETokenOneOf extends REToken int x; for (REToken t:options) { - if ((x = t.getMaximumLength ()) > max) - max = x; + if ((x = t.getMaximumLength ()) > max) + max = x; } return max; } @@ -149,13 +149,13 @@ final class RETokenOneOf extends REToken boolean tryOnly; if (addition == null) { - tryMatch = mymatch; - tryOnly = false; + tryMatch = mymatch; + tryOnly = false; } else { - tryMatch = (REMatch) mymatch.clone (); - tryOnly = true; + tryMatch = (REMatch) mymatch.clone (); + tryOnly = true; } boolean b = negative ? matchN (input, tryMatch, tryOnly) : matchP (input, tryMatch, tryOnly); @@ -166,36 +166,36 @@ final class RETokenOneOf extends REToken stack.push (new Boolean (b)); for (Object obj:addition) { - if (obj instanceof REToken) - { - b = ((REToken) obj).match (input, (REMatch) mymatch.clone ()); - stack.push (new Boolean (b)); - } - else if (obj instanceof Boolean) - { - stack.push ((Boolean) obj); - } - else if (obj.equals ("|")) - { - b = stack.pop (); - b = stack.pop () || b; - stack.push (new Boolean (b)); - } - else if (obj.equals ("&")) - { - b = stack.pop (); - b = stack.pop () && b; - stack.push (new Boolean (b)); - } - else - { - throw new RuntimeException ("Invalid object found"); - } + if (obj instanceof REToken) + { + b = ((REToken) obj).match (input, (REMatch) mymatch.clone ()); + stack.push (new Boolean (b)); + } + else if (obj instanceof Boolean) + { + stack.push ((Boolean) obj); + } + else if (obj.equals ("|")) + { + b = stack.pop (); + b = stack.pop () || b; + stack.push (new Boolean (b)); + } + else if (obj.equals ("&")) + { + b = stack.pop (); + b = stack.pop () && b; + stack.push (new Boolean (b)); + } + else + { + throw new RuntimeException ("Invalid object found"); + } } if (stack.pop ()) { - ++mymatch.index; - return next (input, mymatch); + ++mymatch.index; + return next (input, mymatch); } return false; } @@ -207,12 +207,12 @@ final class RETokenOneOf extends REToken for (REToken tk:options) { - REMatch tryMatch = (REMatch) mymatch.clone (); - if (tk.match (input, tryMatch)) - { // match was successful - return false; - } // is a match - } // try next option + REMatch tryMatch = (REMatch) mymatch.clone (); + if (tk.match (input, tryMatch)) + { // match was successful + return false; + } // is a match + } // try next option if (tryOnly) return true; @@ -224,17 +224,17 @@ final class RETokenOneOf extends REToken { for (REToken tk:options) { - REMatch tryMatch = (REMatch) mymatch.clone (); - if (tk.match (input, tryMatch)) - { // match was successful - if (tryOnly) - return true; - if (next (input, tryMatch)) - { - mymatch.assignFrom (tryMatch); - return true; - } - } + REMatch tryMatch = (REMatch) mymatch.clone (); + if (tk.match (input, tryMatch)) + { // match was successful + if (tryOnly) + return true; + if (next (input, tryMatch)) + { + mymatch.assignFrom (tryMatch); + return true; + } + } } return false; } @@ -244,8 +244,8 @@ final class RETokenOneOf extends REToken REMatch newMatch = findMatch (input, mymatch); if (newMatch != null) { - mymatch.assignFrom (newMatch); - return true; + mymatch.assignFrom (newMatch); + return true; } return false; } @@ -263,32 +263,32 @@ final class RETokenOneOf extends REToken } private REMatch findMatch (CharIndexed input, REMatch mymatch, - int optionIndex) + int optionIndex) { for (int i = optionIndex; i < options.size (); i++) { - REToken tk = options.get (i); - tk = (REToken) tk.clone (); - tk.chain (getNext ()); - REMatch tryMatch = (REMatch) mymatch.clone (); - if (tryMatch.backtrackStack == null) - { - tryMatch.backtrackStack = new BacktrackStack (); - } - boolean stackPushed = false; - if (i + 1 < options.size ()) - { - tryMatch.backtrackStack.push (new BacktrackStack. - Backtrack (this, input, mymatch, - i + 1)); - stackPushed = true; - } - if (tk.match (input, tryMatch)) - { - return tryMatch; - } - if (stackPushed) - tryMatch.backtrackStack.pop (); + REToken tk = options.get (i); + tk = (REToken) tk.clone (); + tk.chain (getNext ()); + REMatch tryMatch = (REMatch) mymatch.clone (); + if (tryMatch.backtrackStack == null) + { + tryMatch.backtrackStack = new BacktrackStack (); + } + boolean stackPushed = false; + if (i + 1 < options.size ()) + { + tryMatch.backtrackStack.push (new BacktrackStack. + Backtrack (this, input, mymatch, + i + 1)); + stackPushed = true; + } + if (tk.match (input, tryMatch)) + { + return tryMatch; + } + if (stackPushed) + tryMatch.backtrackStack.pop (); } return null; } @@ -308,12 +308,12 @@ final class RETokenOneOf extends REToken tk.chain (null); while (true) { - if (numRepeats >= max) - break; - m = tk.findMatch (input, m); - if (m == null) - break; - numRepeats++; + if (numRepeats >= max) + break; + m = tk.findMatch (input, m); + if (m == null) + break; + numRepeats++; } return numRepeats; } @@ -323,9 +323,9 @@ final class RETokenOneOf extends REToken os.append (negative ? "[^" : "(?:"); for (int i = 0; i < options.size (); i++) { - if (!negative && (i > 0)) - os.append ('|'); - options.get (i).dumpAll (os); + if (!negative && (i > 0)) + os.append ('|'); + options.get (i).dumpAll (os); } os.append (negative ? ']' : ')'); } diff --git a/gnu/java/util/regex/RETokenPOSIX.java b/gnu/java/util/regex/RETokenPOSIX.java index 2c809570b..f0fd04bd3 100644 --- a/gnu/java/util/regex/RETokenPOSIX.java +++ b/gnu/java/util/regex/RETokenPOSIX.java @@ -70,8 +70,8 @@ final class RETokenPOSIX extends REToken { for (int i = 0; i < s_nameTable.length; i++) { - if (s_nameTable[i].equals (key)) - return i; + if (s_nameTable[i].equals (key)) + return i; } return -1; } @@ -100,8 +100,8 @@ final class RETokenPOSIX extends REToken boolean retval = matchOneChar (ch); if (retval) { - ++mymatch.index; - return mymatch; + ++mymatch.index; + return mymatch; } return null; } @@ -115,49 +115,49 @@ final class RETokenPOSIX extends REToken switch (type) { case ALNUM: - // Note that there is some debate over whether '_' should be included - retval = Character.isLetterOrDigit (ch) || (ch == '_'); - break; + // Note that there is some debate over whether '_' should be included + retval = Character.isLetterOrDigit (ch) || (ch == '_'); + break; case ALPHA: - retval = Character.isLetter (ch); - break; + retval = Character.isLetter (ch); + break; case BLANK: - retval = ((ch == ' ') || (ch == '\t')); - break; + retval = ((ch == ' ') || (ch == '\t')); + break; case CNTRL: - retval = Character.isISOControl (ch); - break; + retval = Character.isISOControl (ch); + break; case DIGIT: - retval = Character.isDigit (ch); - break; + retval = Character.isDigit (ch); + break; case GRAPH: - retval = - (!(Character.isWhitespace (ch) || Character.isISOControl (ch))); - break; + retval = + (!(Character.isWhitespace (ch) || Character.isISOControl (ch))); + break; case LOWER: - retval = ((insens && Character.isLetter (ch)) - || Character.isLowerCase (ch)); - break; + retval = ((insens && Character.isLetter (ch)) + || Character.isLowerCase (ch)); + break; case PRINT: - retval = - (!(Character.isWhitespace (ch) || Character.isISOControl (ch))) - || (ch == ' '); - break; + retval = + (!(Character.isWhitespace (ch) || Character.isISOControl (ch))) + || (ch == ' '); + break; case PUNCT: - // This feels sloppy, especially for non-U.S. locales. - retval = ("`~!@#$%^&*()-_=+[]{}\\|;:'\"/?,.<>".indexOf (ch) != -1); - break; + // This feels sloppy, especially for non-U.S. locales. + retval = ("`~!@#$%^&*()-_=+[]{}\\|;:'\"/?,.<>".indexOf (ch) != -1); + break; case SPACE: - retval = Character.isWhitespace (ch); - break; + retval = Character.isWhitespace (ch); + break; case UPPER: - retval = ((insens && Character.isLetter (ch)) - || Character.isUpperCase (ch)); - break; + retval = ((insens && Character.isLetter (ch)) + || Character.isUpperCase (ch)); + break; case XDIGIT: - retval = (Character.isDigit (ch) - || ("abcdefABCDEF".indexOf (ch) != -1)); - break; + retval = (Character.isDigit (ch) + || ("abcdefABCDEF".indexOf (ch) != -1)); + break; } if (negated) @@ -176,12 +176,12 @@ final class RETokenPOSIX extends REToken int numRepeats = 0; while (true) { - if (numRepeats >= max) - break; - char ch = input.charAt (index++); - if (!matchOneChar (ch)) - break; - numRepeats++; + if (numRepeats >= max) + break; + char ch = input.charAt (index++); + if (!matchOneChar (ch)) + break; + numRepeats++; } return numRepeats; } diff --git a/gnu/java/util/regex/RETokenRange.java b/gnu/java/util/regex/RETokenRange.java index 2597d4d07..8898ef502 100644 --- a/gnu/java/util/regex/RETokenRange.java +++ b/gnu/java/util/regex/RETokenRange.java @@ -67,8 +67,8 @@ final class RETokenRange extends REToken char c = input.charAt (mymatch.index); if (matchOneChar (c)) { - ++mymatch.index; - return mymatch; + ++mymatch.index; + return mymatch; } return null; } @@ -80,13 +80,13 @@ final class RETokenRange extends REToken boolean matches = (c >= lo) && (c <= hi); if (!matches && insens) { - char c1 = toLowerCase (c, unicodeAware); - matches = (c1 >= lo) && (c1 <= hi); - if (!matches) - { - c1 = toUpperCase (c, unicodeAware); - matches = (c1 >= lo) && (c1 <= hi); - } + char c1 = toLowerCase (c, unicodeAware); + matches = (c1 >= lo) && (c1 <= hi); + if (!matches) + { + c1 = toUpperCase (c, unicodeAware); + matches = (c1 >= lo) && (c1 <= hi); + } } return matches; } @@ -102,12 +102,12 @@ final class RETokenRange extends REToken int numRepeats = 0; while (true) { - if (numRepeats >= max) - break; - char ch = input.charAt (index++); - if (!matchOneChar (ch)) - break; - numRepeats++; + if (numRepeats >= max) + break; + char ch = input.charAt (index++); + if (!matchOneChar (ch)) + break; + numRepeats++; } return numRepeats; } diff --git a/gnu/java/util/regex/RETokenRepeated.java b/gnu/java/util/regex/RETokenRepeated.java index 0ba880d39..cd8635396 100644 --- a/gnu/java/util/regex/RETokenRepeated.java +++ b/gnu/java/util/regex/RETokenRepeated.java @@ -59,11 +59,11 @@ final class RETokenRepeated extends REToken this.max = max; if (token.returnsFixedLengthMatches ()) { - tokenFixedLength = token.getMaximumLength (); + tokenFixedLength = token.getMaximumLength (); } else { - tokenFixedLength = -1; + tokenFixedLength = -1; } } @@ -125,7 +125,7 @@ final class RETokenRepeated extends REToken { this.tk = tk; this.input = input; - this.rematch = (REMatch) mymatch.clone (); // MUST make a clone + this.rematch = (REMatch) mymatch.clone (); // MUST make a clone this.rematch.backtrackStack = new BacktrackStack (); findFirst = true; } @@ -135,31 +135,31 @@ final class RETokenRepeated extends REToken int origin = rematch.index; REMatch rem; if (findFirst) - { - rem = tk.findMatch (input, rematch); - findFirst = false; - } + { + rem = tk.findMatch (input, rematch); + findFirst = false; + } else - { - while (true) - { - if (rematch.backtrackStack.empty ()) - { - rem = null; - break; - } - BacktrackStack.Backtrack bt = rematch.backtrackStack.pop (); - rem = bt.token.backtrack (bt.input, bt.match, bt.param); - if (rem != null) - break; - } - } + { + while (true) + { + if (rematch.backtrackStack.empty ()) + { + rem = null; + break; + } + BacktrackStack.Backtrack bt = rematch.backtrackStack.pop (); + rem = bt.token.backtrack (bt.input, bt.match, bt.param); + if (rem != null) + break; + } + } if (rem == null) - return null; + return null; if (rem.index == origin) - rem.empty = true; + rem.empty = true; rematch = rem; - return (REMatch) rem.clone (); // MUST make a clone. + return (REMatch) rem.clone (); // MUST make a clone. } boolean noMore () @@ -190,7 +190,7 @@ final class RETokenRepeated extends REToken int[] visited; DoablesFinder finder; StackedInfo (CharIndexed input, int numRepeats, REMatch match, - int[]visited, DoablesFinder finder) + int[]visited, DoablesFinder finder) { super (null, input, match, null); this.numRepeats = numRepeats; @@ -214,7 +214,7 @@ final class RETokenRepeated extends REToken } private REMatch findMatch (BacktrackStack stack, - Deque < FindMatchControl > controlStack) + Deque < FindMatchControl > controlStack) { REMatch result = null; StackedInfo si = null; @@ -235,180 +235,180 @@ final class RETokenRepeated extends REToken while (true) { - // This is the second entry point of this method. - // If you want to call this method recursively but you do not need the - // result returned, just continue from this point. + // This is the second entry point of this method. + // If you want to call this method recursively but you do not need the + // result returned, just continue from this point. MAIN_LOOP: - while (true) - { - - if (stack.empty ()) - break MAIN_LOOP; - si = (StackedInfo) (stack.peek ()); - input = si.input; - numRepeats = si.numRepeats; - mymatch = si.match; - visited = si.visited; - finder = si.finder; - - if (mymatch.backtrackStack == null) - mymatch.backtrackStack = new BacktrackStack (); - - if (numRepeats >= max) - { - stack.pop (); - REMatch m1 = matchRest (input, mymatch); - if (m1 != null) - { - if (!stack.empty ()) - { - m1.backtrackStack.push (new BacktrackStack. - Backtrack (this, input, - mymatch, stack)); - } - result = m1; - break MAIN_LOOP; - } - if (stingy) - { - continue MAIN_LOOP; - } - break MAIN_LOOP; - } - - if (finder == null) - { - finder = new DoablesFinder (token, input, mymatch); - si.finder = finder; - } - - if (numRepeats < min) - { - while (true) - { - REMatch doable = finder.find (); - if (doable == null) - { - if (stack.empty ()) - return null; - stack.pop (); - continue MAIN_LOOP; - } - if (finder.noMore ()) - stack.pop (); - int newNumRepeats = (doable.empty ? min : numRepeats + 1); - stack. - push (new - StackedInfo (input, newNumRepeats, doable, - visited, null)); - continue MAIN_LOOP; - } - } - - if (visited == null) - visited = initVisited (); - - if (stingy) - { - REMatch nextMatch = finder.find (); - if (nextMatch != null && !nextMatch.empty) - { - stack. - push (new - StackedInfo (input, numRepeats + 1, nextMatch, - visited, null)); - } - else - { - stack.pop (); - } - REMatch m1 = matchRest (input, mymatch); - if (m1 != null) - { - if (!stack.empty ()) - { - m1.backtrackStack.push (new BacktrackStack. - Backtrack (this, input, - mymatch, stack)); - } - result = m1; - break MAIN_LOOP; - } - else - { - continue MAIN_LOOP; - } - } - - visited = addVisited (mymatch.index, visited); - - TryAnotherResult taresult = - tryAnother (stack, input, mymatch, numRepeats, finder, visited); - visited = taresult.visited; - switch (taresult.status) - { - case TryAnotherResult.TRY_FURTHER: - controlStack.push (new FindMatchControl (finder)); - continue MAIN_LOOP0; - case TryAnotherResult.RESULT_FOUND: - result = taresult.result; - break MAIN_LOOP; - } - - if (!stack.empty ()) - { - stack.pop (); - } - if (possessive) - { - stack.clear (); - } - REMatch m1 = matchRest (input, mymatch); - if (m1 != null) - { - if (!stack.empty ()) - { - m1.backtrackStack.push (new BacktrackStack. - Backtrack (this, input, mymatch, - stack)); - } - result = m1; - break MAIN_LOOP; - } - - } // MAIN_LOOP - - if (controlStack.isEmpty ()) - return result; - FindMatchControl control = controlStack.pop (); - if (possessive) - { - return result; - } - if (result != null) - { - result.backtrackStack.push (new BacktrackStack. - Backtrack (this, input, mymatch, - stack)); - return result; - } - - finder = control.finder; - - TryAnotherResult taresult = - tryAnother (stack, input, mymatch, numRepeats, finder, visited); - visited = taresult.visited; - switch (taresult.status) - { - case TryAnotherResult.TRY_FURTHER: - controlStack.push (new FindMatchControl (finder)); - continue MAIN_LOOP0; - case TryAnotherResult.RESULT_FOUND: - return taresult.result; - } - continue MAIN_LOOP0; - - } // MAIN_LOOP0 + while (true) + { + + if (stack.empty ()) + break MAIN_LOOP; + si = (StackedInfo) (stack.peek ()); + input = si.input; + numRepeats = si.numRepeats; + mymatch = si.match; + visited = si.visited; + finder = si.finder; + + if (mymatch.backtrackStack == null) + mymatch.backtrackStack = new BacktrackStack (); + + if (numRepeats >= max) + { + stack.pop (); + REMatch m1 = matchRest (input, mymatch); + if (m1 != null) + { + if (!stack.empty ()) + { + m1.backtrackStack.push (new BacktrackStack. + Backtrack (this, input, + mymatch, stack)); + } + result = m1; + break MAIN_LOOP; + } + if (stingy) + { + continue MAIN_LOOP; + } + break MAIN_LOOP; + } + + if (finder == null) + { + finder = new DoablesFinder (token, input, mymatch); + si.finder = finder; + } + + if (numRepeats < min) + { + while (true) + { + REMatch doable = finder.find (); + if (doable == null) + { + if (stack.empty ()) + return null; + stack.pop (); + continue MAIN_LOOP; + } + if (finder.noMore ()) + stack.pop (); + int newNumRepeats = (doable.empty ? min : numRepeats + 1); + stack. + push (new + StackedInfo (input, newNumRepeats, doable, + visited, null)); + continue MAIN_LOOP; + } + } + + if (visited == null) + visited = initVisited (); + + if (stingy) + { + REMatch nextMatch = finder.find (); + if (nextMatch != null && !nextMatch.empty) + { + stack. + push (new + StackedInfo (input, numRepeats + 1, nextMatch, + visited, null)); + } + else + { + stack.pop (); + } + REMatch m1 = matchRest (input, mymatch); + if (m1 != null) + { + if (!stack.empty ()) + { + m1.backtrackStack.push (new BacktrackStack. + Backtrack (this, input, + mymatch, stack)); + } + result = m1; + break MAIN_LOOP; + } + else + { + continue MAIN_LOOP; + } + } + + visited = addVisited (mymatch.index, visited); + + TryAnotherResult taresult = + tryAnother (stack, input, mymatch, numRepeats, finder, visited); + visited = taresult.visited; + switch (taresult.status) + { + case TryAnotherResult.TRY_FURTHER: + controlStack.push (new FindMatchControl (finder)); + continue MAIN_LOOP0; + case TryAnotherResult.RESULT_FOUND: + result = taresult.result; + break MAIN_LOOP; + } + + if (!stack.empty ()) + { + stack.pop (); + } + if (possessive) + { + stack.clear (); + } + REMatch m1 = matchRest (input, mymatch); + if (m1 != null) + { + if (!stack.empty ()) + { + m1.backtrackStack.push (new BacktrackStack. + Backtrack (this, input, mymatch, + stack)); + } + result = m1; + break MAIN_LOOP; + } + + } // MAIN_LOOP + + if (controlStack.isEmpty ()) + return result; + FindMatchControl control = controlStack.pop (); + if (possessive) + { + return result; + } + if (result != null) + { + result.backtrackStack.push (new BacktrackStack. + Backtrack (this, input, mymatch, + stack)); + return result; + } + + finder = control.finder; + + TryAnotherResult taresult = + tryAnother (stack, input, mymatch, numRepeats, finder, visited); + visited = taresult.visited; + switch (taresult.status) + { + case TryAnotherResult.TRY_FURTHER: + controlStack.push (new FindMatchControl (finder)); + continue MAIN_LOOP0; + case TryAnotherResult.RESULT_FOUND: + return taresult.result; + } + continue MAIN_LOOP0; + + } // MAIN_LOOP0 } private static class TryAnotherResult @@ -422,9 +422,9 @@ final class RETokenRepeated extends REToken } private TryAnotherResult tryAnother (BacktrackStack stack, - CharIndexed input, REMatch mymatch, - int numRepeats, DoablesFinder finder, - int[]visited) + CharIndexed input, REMatch mymatch, + int numRepeats, DoablesFinder finder, + int[]visited) { TryAnotherResult taresult = new TryAnotherResult (); @@ -437,58 +437,58 @@ final class RETokenRepeated extends REToken DO_ONE_DOABLE: while (true) - { - - REMatch doable = finder.find (); - if (doable == null) - { - break DO_THIS; - } - if (doable.empty) - emptyMatchFound = true; - - if (!emptyMatchFound) - { - int n = doable.index; - if (visitedContains (n, visited)) - { - continue DO_ONE_DOABLE; - } - visited = addVisited (n, visited); - stack. - push (new - StackedInfo (input, numRepeats + 1, doable, visited, - null)); - taresult.visited = visited; - taresult.status = TryAnotherResult.TRY_FURTHER; - return taresult; - } - else - { - REMatch m1 = matchRest (input, doable); - if (possessive) - { - taresult.result = m1; - taresult.status = TryAnotherResult.RESULT_FOUND; - return taresult; - } - if (m1 != null) - { - if (!stack.empty ()) - { - m1.backtrackStack.push (new BacktrackStack. - Backtrack (this, input, mymatch, - stack)); - } - taresult.result = m1; - taresult.status = TryAnotherResult.RESULT_FOUND; - return taresult; - } - } - - } // DO_ONE_DOABLE - - } // DO_THIS + { + + REMatch doable = finder.find (); + if (doable == null) + { + break DO_THIS; + } + if (doable.empty) + emptyMatchFound = true; + + if (!emptyMatchFound) + { + int n = doable.index; + if (visitedContains (n, visited)) + { + continue DO_ONE_DOABLE; + } + visited = addVisited (n, visited); + stack. + push (new + StackedInfo (input, numRepeats + 1, doable, visited, + null)); + taresult.visited = visited; + taresult.status = TryAnotherResult.TRY_FURTHER; + return taresult; + } + else + { + REMatch m1 = matchRest (input, doable); + if (possessive) + { + taresult.result = m1; + taresult.status = TryAnotherResult.RESULT_FOUND; + return taresult; + } + if (m1 != null) + { + if (!stack.empty ()) + { + m1.backtrackStack.push (new BacktrackStack. + Backtrack (this, input, mymatch, + stack)); + } + taresult.result = m1; + taresult.status = TryAnotherResult.RESULT_FOUND; + return taresult; + } + } + + } // DO_ONE_DOABLE + + } // DO_THIS taresult.status = TryAnotherResult.NOTHING_FOUND; return taresult; @@ -501,8 +501,8 @@ final class RETokenRepeated extends REToken REMatch m1 = findMatch (input, mymatch); if (m1 != null) { - mymatch.assignFrom (m1); - return true; + mymatch.assignFrom (m1); + return true; } return false; } @@ -523,8 +523,8 @@ final class RETokenRepeated extends REToken // simple linear search is faster than binary search. for (int i = 1; i < visited[0]; i++) { - if (n == visited[i]) - return true; + if (n == visited[i]) + return true; } return false; } @@ -535,9 +535,9 @@ final class RETokenRepeated extends REToken return visited; if (visited[0] >= visited.length - 1) { - int[] newvisited = new int[visited.length + 32]; - System.arraycopy (visited, 0, newvisited, 0, visited.length); - visited = newvisited; + int[] newvisited = new int[visited.length + 32]; + System.arraycopy (visited, 0, newvisited, 0, visited.length); + visited = newvisited; } visited[0]++; visited[visited[0]] = n; @@ -548,7 +548,7 @@ final class RETokenRepeated extends REToken { if (next (input, newMatch)) { - return newMatch; + return newMatch; } return null; } @@ -573,7 +573,7 @@ final class RETokenRepeated extends REToken } private REMatch backtrackFixedLength (CharIndexed input, REMatch mymatch, - Object param) + Object param) { int[] params = (int[]) param; int index = params[0]; @@ -582,34 +582,34 @@ final class RETokenRepeated extends REToken } private REMatch findMatchFixedLength (CharIndexed input, REMatch mymatch, - int index, int count) + int index, int count) { REMatch tryMatch = (REMatch) mymatch.clone (); while (true) { - tryMatch.index = index; - REMatch m = matchRest (input, tryMatch); - count--; - if (stingy) - index += tokenFixedLength; - else - index -= tokenFixedLength; - if (possessive) - return m; - if (m != null) - { - if (count > 0) - { - m.backtrackStack.push (new BacktrackStack. - Backtrack (this, input, mymatch, - new int[] - { - index, count})); - } - return m; - } - if (count <= 0) - return null; + tryMatch.index = index; + REMatch m = matchRest (input, tryMatch); + count--; + if (stingy) + index += tokenFixedLength; + else + index -= tokenFixedLength; + if (possessive) + return m; + if (m != null) + { + if (count > 0) + { + m.backtrackStack.push (new BacktrackStack. + Backtrack (this, input, mymatch, + new int[] + { + index, count})); + } + return m; + } + if (count <= 0) + return null; } } @@ -624,14 +624,14 @@ final class RETokenRepeated extends REToken os.append ('?'); else { - os.append ('{').append (min); - if (max > min) - { - os.append (','); - if (max != Integer.MAX_VALUE) - os.append (max); - } - os.append ('}'); + os.append ('{').append (min); + if (max > min) + { + os.append (','); + if (max != Integer.MAX_VALUE) + os.append (max); + } + os.append ('}'); } if (stingy) os.append ('?'); diff --git a/gnu/java/util/regex/RETokenStart.java b/gnu/java/util/regex/RETokenStart.java index 6a8d247c9..c57ba9c75 100644 --- a/gnu/java/util/regex/RETokenStart.java +++ b/gnu/java/util/regex/RETokenStart.java @@ -41,7 +41,7 @@ import gnu.java.lang.CPStringBuilder; class RETokenStart extends REToken { - private String newline; // matches after a newline + private String newline; // matches after a newline private boolean check_java_line_terminators; RETokenStart (int subIndex, String newline) @@ -58,13 +58,13 @@ class RETokenStart extends REToken this.check_java_line_terminators = b; } - @Override + @Override int getMaximumLength () { return 0; } - @Override + @Override REMatch matchThis (CharIndexed input, REMatch mymatch) { // charAt(index-n) may be unknown on a Reader/InputStream. FIXME @@ -72,52 +72,52 @@ class RETokenStart extends REToken if (check_java_line_terminators) { - char ch = input.charAt (mymatch.index - 1); - if (ch != CharIndexed.OUT_OF_BOUNDS) - { - if (ch == '\n') - return mymatch; - if (ch == '\r') - { - char ch1 = input.charAt (mymatch.index); - if (ch1 != '\n') - return mymatch; - return null; - } - if (ch == '\u0085') - return mymatch; // A next-line character - if (ch == '\u2028') - return mymatch; // A line-separator character - if (ch == '\u2029') - return mymatch; // A paragraph-separator character - } + char ch = input.charAt (mymatch.index - 1); + if (ch != CharIndexed.OUT_OF_BOUNDS) + { + if (ch == '\n') + return mymatch; + if (ch == '\r') + { + char ch1 = input.charAt (mymatch.index); + if (ch1 != '\n') + return mymatch; + return null; + } + if (ch == '\u0085') + return mymatch; // A next-line character + if (ch == '\u2028') + return mymatch; // A line-separator character + if (ch == '\u2029') + return mymatch; // A paragraph-separator character + } } if (newline != null) { - int len = newline.length (); - if (mymatch.offset >= len) - { - boolean found = true; - char z; - int i = 0; // position in REToken.newline - char ch = input.charAt (mymatch.index - len); - do - { - z = newline.charAt (i); - if (ch != z) - { - found = false; - break; - } - ++i; - ch = input.charAt (mymatch.index - len + i); - } - while (i < len); - - if (found) - return mymatch; - } + int len = newline.length (); + if (mymatch.offset >= len) + { + boolean found = true; + char z; + int i = 0; // position in REToken.newline + char ch = input.charAt (mymatch.index - len); + do + { + z = newline.charAt (i); + if (ch != z) + { + found = false; + break; + } + ++i; + ch = input.charAt (mymatch.index - len + i); + } + while (i < len); + + if (found) + return mymatch; + } } // Don't match at all if REG_NOTBOL is set. @@ -130,7 +130,7 @@ class RETokenStart extends REToken return ((mymatch.index == 0) && (mymatch.offset == 0)) ? mymatch : null; } - @Override + @Override boolean returnsFixedLengthMatches () { return true; diff --git a/gnu/java/util/regex/RETokenWordBoundary.java b/gnu/java/util/regex/RETokenWordBoundary.java index 9f758b635..04fd8391f 100644 --- a/gnu/java/util/regex/RETokenWordBoundary.java +++ b/gnu/java/util/regex/RETokenWordBoundary.java @@ -71,24 +71,24 @@ final class RETokenWordBoundary extends REToken // In the string "one two three", these positions match: // |o|n|e| |t|w|o| |t|h|r|e|e| // ^ ^ ^ ^ ^ ^ - boolean after = false; // is current character a letter or digit? - boolean before = false; // is previous character a letter or digit? + boolean after = false; // is current character a letter or digit? + boolean before = false; // is previous character a letter or digit? char ch; // TODO: Also check REG_ANCHORINDEX vs. anchor if (((mymatch.eflags & RE.REG_ANCHORINDEX) != RE.REG_ANCHORINDEX) - || (mymatch.offset + mymatch.index > mymatch.anchor)) + || (mymatch.offset + mymatch.index > mymatch.anchor)) { - if ((ch = - input.charAt (mymatch.index - 1)) != CharIndexed.OUT_OF_BOUNDS) - { - before = Character.isLetterOrDigit (ch) || (ch == '_'); - } + if ((ch = + input.charAt (mymatch.index - 1)) != CharIndexed.OUT_OF_BOUNDS) + { + before = Character.isLetterOrDigit (ch) || (ch == '_'); + } } if ((ch = input.charAt (mymatch.index)) != CharIndexed.OUT_OF_BOUNDS) { - after = Character.isLetterOrDigit (ch) || (ch == '_'); + after = Character.isLetterOrDigit (ch) || (ch == '_'); } // if (before) and (!after), we're at end (\>) @@ -97,11 +97,11 @@ final class RETokenWordBoundary extends REToken if ((where & BEGIN) == BEGIN) { - doNext = after && !before; + doNext = after && !before; } if ((where & END) == END) { - doNext ^= before && !after; + doNext ^= before && !after; } if (negated) @@ -127,15 +127,15 @@ final class RETokenWordBoundary extends REToken { if (where == (BEGIN | END)) { - os.append (negated ? "\\B" : "\\b"); + os.append (negated ? "\\B" : "\\b"); } else if (where == BEGIN) { - os.append ("\\<"); + os.append ("\\<"); } else { - os.append ("\\>"); + os.append ("\\>"); } } } diff --git a/gnu/java/util/regex/UncheckedRE.java b/gnu/java/util/regex/UncheckedRE.java index 5f8c74902..7d215a6c1 100644 --- a/gnu/java/util/regex/UncheckedRE.java +++ b/gnu/java/util/regex/UncheckedRE.java @@ -47,11 +47,11 @@ package gnu.java.util.regex; * <P> * Note that this makes UncheckedRE dangerous if constructed with * dynamic data. Do not use UncheckedRE unless you are completely sure - * that all input being passed to it contains valid, well-formed + * that all input being passed to it contains valid, well-formed * regular expressions for the syntax specified. * * @author <A HREF="mailto:wes@cacas.org">Wes Biggs</A> - * @see gnu.java.util.regex.RE + * @see gnu.java.util.regex.RE * @since gnu.regexp 1.1.4 */ @@ -105,7 +105,7 @@ public final class UncheckedRE extends RE try { initialize (pattern, cflags, syntax, 0, 0); - } + } catch (REException e) { throw new RuntimeException (e.getMessage ()); |