You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by gs...@apache.org on 2007/10/15 23:23:31 UTC
svn commit: r584925 [20/34] - in /wicket/trunk/jdk-1.4/wicket/src:
main/java/org/apache/wicket/ main/java/org/apache/wicket/ajax/
main/java/org/apache/wicket/ajax/calldecorator/
main/java/org/apache/wicket/ajax/form/ main/java/org/apache/wicket/ajax/ma...
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/ClassStreamHandler.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/ClassStreamHandler.java?rev=584925&r1=584924&r2=584925&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/ClassStreamHandler.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/ClassStreamHandler.java Mon Oct 15 14:21:25 2007
@@ -41,9 +41,9 @@
/**
* TODO DOC ME!
*
- * NOTE: this class uses Sun-specific features: we use {@link Unsafe} because we
- * need to set the final fields, and we use {@link ReflectionFactory} to be able
- * to find constructors appropriate for serialization.
+ * NOTE: this class uses Sun-specific features: we use {@link Unsafe} because we need to set the
+ * final fields, and we use {@link ReflectionFactory} to be able to find constructors appropriate
+ * for serialization.
*
* @author jcompagner
*/
@@ -79,7 +79,7 @@
private static Map handlesClasses = new HashMap();
-
+
private static short classCounter = 0;
/**
@@ -142,7 +142,7 @@
private final short classId;
private final Constructor cons;
-
+
private final Method writeReplaceMethod;
private final Method readResolveMethod;
@@ -159,7 +159,7 @@
*
* @param cls
* TODO
- * @throws WicketSerializeableException
+ * @throws WicketSerializeableException
*/
private ClassStreamHandler(Class cls) throws WicketSerializeableException
{
@@ -171,10 +171,10 @@
cons = null;
writeObjectMethods = null;
readObjectMethods = null;
-
+
writeReplaceMethod = null;
readResolveMethod = null;
-
+
if (clz == boolean.class)
{
primitiveArray = new BooleanPrimitiveArray();
@@ -236,38 +236,41 @@
{
fields = new ArrayList();
primitiveArray = null;
- writeObjectMethods = new ArrayList(2);
+ writeObjectMethods = new ArrayList(2);
readObjectMethods = new ArrayList(2);
- writeReplaceMethod = getInheritableMethod( clz, "writeReplace", null, Object.class);
-
- readResolveMethod = getInheritableMethod(clz, "readResolve", null, Object.class);
- if (readResolveMethod == null)
- {
+ writeReplaceMethod = getInheritableMethod(clz, "writeReplace", null, Object.class);
+
+ readResolveMethod = getInheritableMethod(clz, "readResolve", null, Object.class);
+ if (readResolveMethod == null)
+ {
cons = getSerializableConstructor(clz);
if (cons == null)
{
- throw new WicketSerializeableException("No Serializable constructor found for " + cls);
+ throw new WicketSerializeableException(
+ "No Serializable constructor found for " + cls);
}
- }
- else
- {
+ }
+ else
+ {
cons = getSerializableConstructor(clz);
- }
+ }
Class parent = cls;
- while(parent != Object.class)
+ while (parent != Object.class)
{
- Method method = getPrivateMethod(parent, "writeObject", new Class[] { ObjectOutputStream.class }, Void.TYPE);
+ Method method = getPrivateMethod(parent, "writeObject",
+ new Class[] { ObjectOutputStream.class }, Void.TYPE);
if (method != null)
{
writeObjectMethods.add(method);
}
- method = getPrivateMethod(parent, "readObject", new Class[] { ObjectInputStream.class }, Void.TYPE);
+ method = getPrivateMethod(parent, "readObject",
+ new Class[] { ObjectInputStream.class }, Void.TYPE);
if (method != null)
{
readObjectMethods.add(method);
}
-
+
parent = parent.getSuperclass();
}
fillFields(cls);
@@ -317,8 +320,8 @@
{
Field field = fields[i];
field.setAccessible(true);
- if (!Modifier.isStatic(field.getModifiers())
- && !Modifier.isTransient(field.getModifiers()))
+ if (!Modifier.isStatic(field.getModifiers()) &&
+ !Modifier.isTransient(field.getModifiers()))
{
FieldAndIndex fai = null;
Class clz = field.getType();
@@ -375,7 +378,8 @@
* @param obj
* @throws WicketSerializeableException
*/
- public void writeFields(WicketObjectOutputStream woos, Object obj) throws WicketSerializeableException
+ public void writeFields(WicketObjectOutputStream woos, Object obj)
+ throws WicketSerializeableException
{
FieldAndIndex fai = null;
try
@@ -393,7 +397,7 @@
}
catch (Exception ex)
{
- String field = fai == null || fai.field == null? "" : fai.field.getName();
+ String field = fai == null || fai.field == null ? "" : fai.field.getName();
String msg = "Error writing field: " + field + " for object class: " + obj.getClass();
throw new WicketSerializeableException(msg, ex);
}
@@ -402,9 +406,10 @@
/**
* @param wois
- * @throws WicketSerializeableException
+ * @throws WicketSerializeableException
*/
- public void readFields(WicketObjectInputStream wois, Object object) throws WicketSerializeableException
+ public void readFields(WicketObjectInputStream wois, Object object)
+ throws WicketSerializeableException
{
FieldAndIndex fai = null;
try
@@ -422,20 +427,21 @@
}
catch (Exception ex)
{
- throw new WicketSerializeableException("Error reading field: " + fai.field.getName() + " for object class: " + object.getClass(),ex);
+ throw new WicketSerializeableException("Error reading field: " + fai.field.getName() +
+ " for object class: " + object.getClass(), ex);
}
}
-
+
public void writeArray(Object obj, WicketObjectOutputStream wois) throws IOException
{
- primitiveArray.writeArray(obj,wois);
+ primitiveArray.writeArray(obj, wois);
}
public Object readArray(WicketObjectInputStream wois) throws IOException
{
return primitiveArray.readArray(wois);
}
-
+
/**
* @param woos
* @param obj
@@ -451,7 +457,7 @@
for (int i = writeObjectMethods.size(); --i >= 0;)
{
Method method = (Method)writeObjectMethods.get(i);
-
+
try
{
method.invoke(obj, new Object[] { woos });
@@ -521,8 +527,8 @@
{
Constructor cons = initCl.getDeclaredConstructor((Class[])null);
int mods = cons.getModifiers();
- if ((mods & Modifier.PRIVATE) != 0
- || ((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 && !packageEquals(cl,
+ if ((mods & Modifier.PRIVATE) != 0 ||
+ ((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 && !packageEquals(cl,
initCl)))
{
return null;
@@ -538,9 +544,8 @@
}
/**
- * Returns non-static private method with given signature defined by given
- * class, or null if none found. Access checks are disabled on the returned
- * method (if any).
+ * Returns non-static private method with given signature defined by given class, or null if
+ * none found. Access checks are disabled on the returned method (if any).
*/
private static Method getPrivateMethod(Class cl, String name, Class[] argTypes, Class returnType)
{
@@ -558,17 +563,15 @@
return null;
}
}
-
+
/**
- * Returns non-static, non-abstract method with given signature provided it
- * is defined by or accessible (via inheritance) by the given class, or
- * null if no match found. Access checks are disabled on the returned
- * method (if any).
- */
- private static Method getInheritableMethod(Class cl, String name,
- Class[] argTypes,
- Class returnType)
- {
+ * Returns non-static, non-abstract method with given signature provided it is defined by or
+ * accessible (via inheritance) by the given class, or null if no match found. Access checks are
+ * disabled on the returned method (if any).
+ */
+ private static Method getInheritableMethod(Class cl, String name, Class[] argTypes,
+ Class returnType)
+ {
Method meth = null;
Class defCl = cl;
while (defCl != null)
@@ -639,61 +642,67 @@
this.field = field;
this.index = unsafe.objectFieldOffset(field);
}
-
- public abstract void writeField(Object object, WicketObjectOutputStream dos) throws IOException;
-
- public abstract void readField(Object object, WicketObjectInputStream dos) throws IOException, ClassNotFoundException;
+
+ public abstract void writeField(Object object, WicketObjectOutputStream dos)
+ throws IOException;
+
+ public abstract void readField(Object object, WicketObjectInputStream dos)
+ throws IOException, ClassNotFoundException;
}
-
+
private final class BooleanFieldAndIndex extends FieldAndIndex
{
BooleanFieldAndIndex(Field field)
{
super(field);
}
-
+
/**
- * @throws IOException
- * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#writeField(Object, WicketObjectOutputStream)
+ * @throws IOException
+ * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#writeField(Object,
+ * WicketObjectOutputStream)
*/
public void writeField(Object object, WicketObjectOutputStream dos) throws IOException
{
dos.writeBoolean(unsafe.getBoolean(object, index));
}
-
+
/**
- * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#readField(Object, WicketObjectInputStream)
+ * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#readField(Object,
+ * WicketObjectInputStream)
*/
public void readField(Object object, WicketObjectInputStream dos) throws IOException
{
unsafe.putBoolean(object, index, dos.readBoolean());
}
}
-
+
private final class ByteFieldAndIndex extends FieldAndIndex
{
ByteFieldAndIndex(Field field)
{
super(field);
}
-
+
/**
- * @throws IOException
- * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#writeField(Object, WicketObjectOutputStream)
+ * @throws IOException
+ * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#writeField(Object,
+ * WicketObjectOutputStream)
*/
public void writeField(Object object, WicketObjectOutputStream dos) throws IOException
{
dos.writeByte(unsafe.getByte(object, index));
}
-
+
/**
- * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#readField(Object, WicketObjectInputStream)
+ * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#readField(Object,
+ * WicketObjectInputStream)
*/
public void readField(Object object, WicketObjectInputStream dos) throws IOException
{
unsafe.putByte(object, index, dos.readByte());
}
- }
+ }
private final class ShortFieldAndIndex extends FieldAndIndex
{
@@ -701,189 +710,206 @@
{
super(field);
}
-
+
/**
- * @throws IOException
- * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#writeField(Object, WicketObjectOutputStream)
+ * @throws IOException
+ * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#writeField(Object,
+ * WicketObjectOutputStream)
*/
public void writeField(Object object, WicketObjectOutputStream dos) throws IOException
{
dos.writeShort(unsafe.getShort(object, index));
}
-
+
/**
- * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#readField(Object, WicketObjectInputStream)
+ * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#readField(Object,
+ * WicketObjectInputStream)
*/
public void readField(Object object, WicketObjectInputStream dos) throws IOException
{
unsafe.putShort(object, index, dos.readShort());
}
- }
-
+ }
+
private final class CharFieldAndIndex extends FieldAndIndex
{
CharFieldAndIndex(Field field)
{
super(field);
}
-
+
/**
- * @throws IOException
- * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#writeField(Object, WicketObjectOutputStream)
+ * @throws IOException
+ * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#writeField(Object,
+ * WicketObjectOutputStream)
*/
public void writeField(Object object, WicketObjectOutputStream dos) throws IOException
{
dos.writeChar(unsafe.getChar(object, index));
}
-
+
/**
- * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#readField(java.lang.Object, WicketObjectInputStream)
+ * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#readField(java.lang.Object,
+ * WicketObjectInputStream)
*/
public void readField(Object object, WicketObjectInputStream dos) throws IOException
{
unsafe.putChar(object, index, dos.readChar());
}
- }
-
+ }
+
private final class IntFieldAndIndex extends FieldAndIndex
{
IntFieldAndIndex(Field field)
{
super(field);
}
-
+
/**
- * @throws IOException
- * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#writeField(Object, WicketObjectOutputStream)
+ * @throws IOException
+ * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#writeField(Object,
+ * WicketObjectOutputStream)
*/
public void writeField(Object object, WicketObjectOutputStream dos) throws IOException
{
dos.writeInt(unsafe.getInt(object, index));
}
-
+
/**
- * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#readField(java.lang.Object, WicketObjectInputStream)
+ * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#readField(java.lang.Object,
+ * WicketObjectInputStream)
*/
public void readField(Object object, WicketObjectInputStream dos) throws IOException
{
unsafe.putInt(object, index, dos.readInt());
}
- }
-
+ }
+
private final class LongFieldAndIndex extends FieldAndIndex
{
LongFieldAndIndex(Field field)
{
super(field);
}
-
+
/**
- * @throws IOException
- * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#writeField(Object, WicketObjectOutputStream)
+ * @throws IOException
+ * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#writeField(Object,
+ * WicketObjectOutputStream)
*/
public void writeField(Object object, WicketObjectOutputStream dos) throws IOException
{
dos.writeLong(unsafe.getLong(object, index));
}
-
+
/**
- * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#readField(java.lang.Object, WicketObjectInputStream)
+ * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#readField(java.lang.Object,
+ * WicketObjectInputStream)
*/
public void readField(Object object, WicketObjectInputStream dos) throws IOException
{
unsafe.putLong(object, index, dos.readLong());
}
- }
-
+ }
+
private final class FloatFieldAndIndex extends FieldAndIndex
{
FloatFieldAndIndex(Field field)
{
super(field);
}
-
+
/**
- * @throws IOException
- * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#writeField(Object, WicketObjectOutputStream)
+ * @throws IOException
+ * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#writeField(Object,
+ * WicketObjectOutputStream)
*/
public void writeField(Object object, WicketObjectOutputStream dos) throws IOException
{
dos.writeFloat(unsafe.getFloat(object, index));
}
-
+
/**
- * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#readField(java.lang.Object, WicketObjectInputStream)
+ * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#readField(java.lang.Object,
+ * WicketObjectInputStream)
*/
public void readField(Object object, WicketObjectInputStream dos) throws IOException
{
unsafe.putFloat(object, index, dos.readFloat());
}
- }
-
+ }
+
private final class DoubleFieldAndIndex extends FieldAndIndex
{
DoubleFieldAndIndex(Field field)
{
super(field);
}
-
+
/**
- * @throws IOException
- * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#writeField(Object, WicketObjectOutputStream)
+ * @throws IOException
+ * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#writeField(Object,
+ * WicketObjectOutputStream)
*/
public void writeField(Object object, WicketObjectOutputStream dos) throws IOException
{
dos.writeDouble(unsafe.getDouble(object, index));
}
-
+
/**
- * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#readField(java.lang.Object, WicketObjectInputStream)
+ * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#readField(java.lang.Object,
+ * WicketObjectInputStream)
*/
public void readField(Object object, WicketObjectInputStream dos) throws IOException
{
unsafe.putDouble(object, index, dos.readDouble());
}
}
-
+
private final class ObjectFieldAndIndex extends FieldAndIndex
{
ObjectFieldAndIndex(Field field)
{
super(field);
}
-
+
/**
- * @throws IOException
- * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#writeField(Object, WicketObjectOutputStream)
+ * @throws IOException
+ * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#writeField(Object,
+ * WicketObjectOutputStream)
*/
public void writeField(Object object, WicketObjectOutputStream dos) throws IOException
{
dos.writeObject(unsafe.getObject(object, index));
}
-
+
/**
- * @throws ClassNotFoundException
- * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#readField(java.lang.Object, WicketObjectInputStream)
+ * @throws ClassNotFoundException
+ * @see org.apache.wicket.util.io.ClassStreamHandler.FieldAndIndex#readField(java.lang.Object,
+ * WicketObjectInputStream)
*/
- public void readField(Object object, WicketObjectInputStream dos) throws IOException, ClassNotFoundException
+ public void readField(Object object, WicketObjectInputStream dos) throws IOException,
+ ClassNotFoundException
{
unsafe.putObject(object, index, dos.readObject());
}
}
-
+
private abstract class PrimitiveArray
{
- public abstract void writeArray(Object object, WicketObjectOutputStream dos) throws IOException;
-
- public abstract Object readArray(WicketObjectInputStream dos) throws IOException;
+ public abstract void writeArray(Object object, WicketObjectOutputStream dos)
+ throws IOException;
+
+ public abstract Object readArray(WicketObjectInputStream dos) throws IOException;
}
-
+
private final class BooleanPrimitiveArray extends PrimitiveArray
{
/**
- * @throws IOException
- * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object, WicketObjectOutputStream)
+ * @throws IOException
+ * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object,
+ * WicketObjectOutputStream)
*/
public void writeArray(Object object, WicketObjectOutputStream dos) throws IOException
{
@@ -894,7 +920,7 @@
dos.writeBoolean(Array.getBoolean(object, i));
}
}
-
+
/**
* @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#readArray(WicketObjectInputStream)
*/
@@ -909,12 +935,13 @@
return array;
}
}
-
+
private final class BytePrimitiveArray extends PrimitiveArray
{
/**
- * @throws IOException
- * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object, WicketObjectOutputStream)
+ * @throws IOException
+ * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object,
+ * WicketObjectOutputStream)
*/
public void writeArray(Object object, WicketObjectOutputStream dos) throws IOException
{
@@ -925,7 +952,7 @@
dos.writeByte(Array.getByte(object, i));
}
}
-
+
/**
* @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#readArray(WicketObjectInputStream)
*/
@@ -939,13 +966,14 @@
}
return array;
}
- }
+ }
private final class ShortPrimitiveArray extends PrimitiveArray
{
/**
- * @throws IOException
- * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object, WicketObjectOutputStream)
+ * @throws IOException
+ * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object,
+ * WicketObjectOutputStream)
*/
public void writeArray(Object object, WicketObjectOutputStream dos) throws IOException
{
@@ -956,7 +984,7 @@
dos.writeShort(Array.getShort(object, i));
}
}
-
+
/**
* @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#readArray(WicketObjectInputStream)
*/
@@ -970,14 +998,15 @@
}
return array;
}
- }
-
+ }
+
private final class CharPrimitiveArray extends PrimitiveArray
{
-
+
/**
- * @throws IOException
- * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object, WicketObjectOutputStream)
+ * @throws IOException
+ * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object,
+ * WicketObjectOutputStream)
*/
public void writeArray(Object object, WicketObjectOutputStream dos) throws IOException
{
@@ -988,7 +1017,7 @@
dos.writeChar(Array.getChar(object, i));
}
}
-
+
/**
* @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#readArray(WicketObjectInputStream)
*/
@@ -1002,13 +1031,14 @@
}
return array;
}
- }
-
+ }
+
private final class IntPrimitiveArray extends PrimitiveArray
{
/**
- * @throws IOException
- * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object, WicketObjectOutputStream)
+ * @throws IOException
+ * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object,
+ * WicketObjectOutputStream)
*/
public void writeArray(Object object, WicketObjectOutputStream dos) throws IOException
{
@@ -1019,7 +1049,7 @@
dos.writeInt(Array.getInt(object, i));
}
}
-
+
/**
* @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#readArray(WicketObjectInputStream)
*/
@@ -1033,13 +1063,14 @@
}
return array;
}
- }
-
+ }
+
private final class LongPrimitiveArray extends PrimitiveArray
{
/**
- * @throws IOException
- * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object, WicketObjectOutputStream)
+ * @throws IOException
+ * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object,
+ * WicketObjectOutputStream)
*/
public void writeArray(Object object, WicketObjectOutputStream dos) throws IOException
{
@@ -1050,7 +1081,7 @@
dos.writeLong(Array.getLong(object, i));
}
}
-
+
/**
* @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#readArray(WicketObjectInputStream)
*/
@@ -1064,13 +1095,14 @@
}
return array;
}
- }
-
+ }
+
private final class FloatPrimitiveArray extends PrimitiveArray
{
/**
- * @throws IOException
- * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object, WicketObjectOutputStream)
+ * @throws IOException
+ * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object,
+ * WicketObjectOutputStream)
*/
public void writeArray(Object object, WicketObjectOutputStream dos) throws IOException
{
@@ -1081,7 +1113,7 @@
dos.writeFloat(Array.getFloat(object, i));
}
}
-
+
/**
* @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#readArray(WicketObjectInputStream)
*/
@@ -1095,13 +1127,14 @@
}
return array;
}
- }
-
+ }
+
private final class DoublePrimitiveArray extends PrimitiveArray
{
/**
- * @throws IOException
- * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object, WicketObjectOutputStream)
+ * @throws IOException
+ * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object,
+ * WicketObjectOutputStream)
*/
public void writeArray(Object object, WicketObjectOutputStream dos) throws IOException
{
@@ -1112,7 +1145,7 @@
dos.writeDouble(Array.getDouble(object, i));
}
}
-
+
/**
* @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#readArray(WicketObjectInputStream)
*/
@@ -1130,7 +1163,7 @@
/**
* @return
- * @throws NotSerializableException
+ * @throws NotSerializableException
*/
public Object writeReplace(Object o) throws NotSerializableException
{
@@ -1143,11 +1176,11 @@
catch (Exception ex)
{
throw new NotSerializableException(ex.getMessage());
- }
+ }
}
return null;
}
-
+
public Object readResolve(Object o) throws NotSerializableException
{
if (readResolveMethod != null)
@@ -1159,7 +1192,7 @@
catch (Exception ex)
{
throw new NotSerializableException(ex.getMessage());
- }
+ }
}
return o;
}
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/DeferredFileOutputStream.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/DeferredFileOutputStream.java?rev=584925&r1=584924&r2=584925&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/DeferredFileOutputStream.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/DeferredFileOutputStream.java Mon Oct 15 14:21:25 2007
@@ -23,16 +23,16 @@
/**
* <p>
- * An output stream which will retain data in memory until a specified threshold is
- * reached, and only then commit it to disk. If the stream is closed before the threshold
- * is reached, the data will not be written to disk at all.
+ * An output stream which will retain data in memory until a specified threshold is reached, and
+ * only then commit it to disk. If the stream is closed before the threshold is reached, the data
+ * will not be written to disk at all.
* </p>
* <p>
- * This class originated in FileUpload processing. In this use case, you do not know in
- * advance the size of the file being uploaded. If the file is small you want to store it
- * in memory (for speed), but if the file is large you want to store it to file (to avoid
- * memory issues).
+ * This class originated in FileUpload processing. In this use case, you do not know in advance the
+ * size of the file being uploaded. If the file is small you want to store it in memory (for speed),
+ * but if the file is large you want to store it to file (to avoid memory issues).
* </p>
+ *
* @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
* @version $Id$
*/
@@ -43,15 +43,14 @@
/**
- * The output stream to which data will be written at any given time. This will always
- * be one of <code>memoryOutputStream</code> or <code>diskOutputStream</code>.
+ * The output stream to which data will be written at any given time. This will always be one of
+ * <code>memoryOutputStream</code> or <code>diskOutputStream</code>.
*/
private OutputStream currentOutputStream;
/**
- * The output stream to which data will be written prior to the threshold being
- * reached.
+ * The output stream to which data will be written prior to the threshold being reached.
*/
private ByteArrayOutputStream memoryOutputStream;
@@ -66,10 +65,13 @@
/**
- * Constructs an instance of this class which will trigger an event at the specified
- * threshold, and save data to a file beyond that point.
- * @param threshold The number of bytes at which to trigger an event.
- * @param outputFile The file to which data is saved beyond the threshold.
+ * Constructs an instance of this class which will trigger an event at the specified threshold,
+ * and save data to a file beyond that point.
+ *
+ * @param threshold
+ * The number of bytes at which to trigger an event.
+ * @param outputFile
+ * The file to which data is saved beyond the threshold.
*/
public DeferredFileOutputStream(int threshold, File outputFile)
{
@@ -85,11 +87,10 @@
/**
- * Returns the data for this output stream as an array of bytes, assuming that the
- * data has been retained in memory. If the data was written to disk, this method
- * returns <code>null</code>.
- * @return The data for this output stream, or <code>null</code> if no such data is
- * available.
+ * Returns the data for this output stream as an array of bytes, assuming that the data has been
+ * retained in memory. If the data was written to disk, this method returns <code>null</code>.
+ *
+ * @return The data for this output stream, or <code>null</code> if no such data is available.
*/
public byte[] getData()
{
@@ -102,11 +103,10 @@
/**
- * Returns the data for this output stream as a <code>File</code>, assuming that
- * the data was written to disk. If the data was retained in memory, this method
- * returns <code>null</code>.
- * @return The file for this output stream, or <code>null</code> if no such file
- * exists.
+ * Returns the data for this output stream as a <code>File</code>, assuming that the data was
+ * written to disk. If the data was retained in memory, this method returns <code>null</code>.
+ *
+ * @return The file for this output stream, or <code>null</code> if no such file exists.
*/
public File getFile()
{
@@ -118,8 +118,8 @@
/**
- * Determines whether or not the data for this output stream has been retained in
- * memory.
+ * Determines whether or not the data for this output stream has been retained in memory.
+ *
* @return <code>true</code> if the data is available in memory; <code>false</code>
* otherwise.
*/
@@ -130,10 +130,12 @@
/**
- * Returns the current output stream. This may be memory based or disk based,
- * depending on the current state with respect to the threshold.
+ * Returns the current output stream. This may be memory based or disk based, depending on the
+ * current state with respect to the threshold.
+ *
* @return The underlying output stream.
- * @exception IOException if an error occurs.
+ * @exception IOException
+ * if an error occurs.
*/
protected OutputStream getStream() throws IOException
{
@@ -142,10 +144,12 @@
/**
- * Switches the underlying output stream from a memory based stream to one that is
- * backed by disk. This is the point at which we realize that too much data is being
- * written to keep in memory, so we elect to switch to disk-based storage.
- * @exception IOException if an error occurs.
+ * Switches the underlying output stream from a memory based stream to one that is backed by
+ * disk. This is the point at which we realize that too much data is being written to keep in
+ * memory, so we elect to switch to disk-based storage.
+ *
+ * @exception IOException
+ * if an error occurs.
*/
protected void thresholdReached() throws IOException
{
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/FullyBufferedReader.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/FullyBufferedReader.java?rev=584925&r1=584924&r2=584925&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/FullyBufferedReader.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/FullyBufferedReader.java Mon Oct 15 14:21:25 2007
@@ -20,16 +20,14 @@
import java.io.Reader;
/**
- * This is not a reader like e.g. FileReader. It rather reads the whole data
- * until the end from a source reader into memory and besides that it maintains
- * the current position (like a reader) it provides String like methods which
- * conveniently let you navigate (usually forward) in the stream.
+ * This is not a reader like e.g. FileReader. It rather reads the whole data until the end from a
+ * source reader into memory and besides that it maintains the current position (like a reader) it
+ * provides String like methods which conveniently let you navigate (usually forward) in the stream.
* <p>
- * Because the source data are expected to be text, the line and column numbers
- * are maintained as well for location precise error messages. But it does NOT
- * automatically update the line and column numbers. You must call
- * {@link #countLinesTo(int)}
- *
+ * Because the source data are expected to be text, the line and column numbers are maintained as
+ * well for location precise error messages. But it does NOT automatically update the line and
+ * column numbers. You must call {@link #countLinesTo(int)}
+ *
* @author Juergen Donnerstag
*/
public final class FullyBufferedReader
@@ -54,7 +52,7 @@
/**
* Read all the data from the resource into memory.
- *
+ *
* @param reader
* The source reader to load the data from
* @throws IOException
@@ -69,10 +67,9 @@
/**
* Get the characters from the position marker to toPos.
* <p>
- * If toPos < 0, than get all data from the position marker until the end.
- * If toPos less than the current position marker than return an empty
- * string ""
- *
+ * If toPos < 0, than get all data from the position marker until the end. If toPos less than
+ * the current position marker than return an empty string ""
+ *
* @param toPos
* Index of first character not included
* @return Raw markup (a string) in between these two positions.
@@ -91,9 +88,9 @@
}
/**
- * Get the characters from in between both positions including the char at
- * fromPos, excluding the char at toPos
- *
+ * Get the characters from in between both positions including the char at fromPos, excluding
+ * the char at toPos
+ *
* @param fromPos
* first index
* @param toPos
@@ -107,7 +104,7 @@
/**
* Gets the current input position
- *
+ *
* @return input position
*/
public final int getPosition()
@@ -117,7 +114,7 @@
/**
* Remember the current position in markup
- *
+ *
* @param pos
*/
public final void setPositionMarker(final int pos)
@@ -135,7 +132,7 @@
/**
* Counts lines starting where we last left off up to the index provided.
- *
+ *
* @param end
* End index
*/
@@ -160,7 +157,7 @@
/**
* Find a char starting at the current input position
- *
+ *
* @param ch
* The char to search for
* @return -1 if not found
@@ -172,7 +169,7 @@
/**
* Find a char starting at the position provided
- *
+ *
* @param ch
* The char to search for
* @param startPos
@@ -186,7 +183,7 @@
/**
* Find the string starting at the current input position
- *
+ *
* @param str
* The string to search for
* @return -1 if not found
@@ -198,7 +195,7 @@
/**
* Find the string starting at the position provided
- *
+ *
* @param str
* The string to search for
* @param startPos
@@ -211,9 +208,8 @@
}
/**
- * Position the reader at the index provided. Could be anywhere within the
- * data
- *
+ * Position the reader at the index provided. Could be anywhere within the data
+ *
* @param pos
* The new current position
*/
@@ -223,10 +219,9 @@
}
/**
- * Get the column number. Note: The column number depends on you calling
- * countLinesTo(pos). It is not necessarily the column number matching the
- * current position in the stream.
- *
+ * Get the column number. Note: The column number depends on you calling countLinesTo(pos). It
+ * is not necessarily the column number matching the current position in the stream.
+ *
* @return column number
*/
public final int getColumnNumber()
@@ -235,10 +230,9 @@
}
/**
- * Get the line number. Note: The line number depends on you calling
- * countLinesTo(pos). It is not necessarily the line number matching the
- * current position in the stream.
- *
+ * Get the line number. Note: The line number depends on you calling countLinesTo(pos). It is
+ * not necessarily the line number matching the current position in the stream.
+ *
* @return line number
*/
public final int getLineNumber()
@@ -247,9 +241,9 @@
}
/**
- * Get the number of character read from the source resource. The whole
- * content, not just until the current position.
- *
+ * Get the number of character read from the source resource. The whole content, not just until
+ * the current position.
+ *
* @return Size of the data
*/
public final int size()
@@ -259,7 +253,7 @@
/**
* Get the character at the position provided
- *
+ *
* @param pos
* The position
* @return char at position
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/HandleArrayListStack.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/HandleArrayListStack.java?rev=584925&r1=584924&r2=584925&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/HandleArrayListStack.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/HandleArrayListStack.java Mon Oct 15 14:21:25 2007
@@ -62,8 +62,8 @@
/**
* Tests if this stack is empty.
*
- * @return <code>true</code> if and only if this stack contains no items;
- * <code>false</code> otherwise.
+ * @return <code>true</code> if and only if this stack contains no items; <code>false</code>
+ * otherwise.
*/
public final boolean empty()
{
@@ -170,18 +170,16 @@
}
/**
- * Returns the 1-based position where an object is on this stack. If the
- * object <tt>o</tt> occurs as an item in this stack, this method returns
- * the distance from the top of the stack of the occurrence nearest the top
- * of the stack; the topmost item on the stack is considered to be at
- * distance <tt>1</tt>. The <tt>equals</tt> method is used to compare
- * <tt>o</tt> to the items in this stack.
+ * Returns the 1-based position where an object is on this stack. If the object <tt>o</tt>
+ * occurs as an item in this stack, this method returns the distance from the top of the stack
+ * of the occurrence nearest the top of the stack; the topmost item on the stack is considered
+ * to be at distance <tt>1</tt>. The <tt>equals</tt> method is used to compare <tt>o</tt>
+ * to the items in this stack.
*
* @param o
* the desired object.
- * @return the 1-based position from the top of the stack where the object
- * is located; the return value <code>-1</code> indicates that the
- * object is not on the stack.
+ * @return the 1-based position from the top of the stack where the object is located; the
+ * return value <code>-1</code> indicates that the object is not on the stack.
*/
public final int search(final Object o)
{
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/IOUtils.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/IOUtils.java?rev=584925&r1=584924&r2=584925&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/IOUtils.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/IOUtils.java Mon Oct 15 14:21:25 2007
@@ -34,33 +34,29 @@
* <p>
* This class provides static utility methods for input/output operations.
* <ul>
- * <li>closeQuietly - these methods close a stream ignoring nulls and
- * exceptions
+ * <li>closeQuietly - these methods close a stream ignoring nulls and exceptions
* <li>toXxx - these methods read data from a stream
* <li>write - these methods write data to a stream
* <li>copy - these methods copy all the data from one stream to another
* <li>contentEquals - these methods compare the content of two streams
* </ul>
* <p>
- * The byte-to-char methods and char-to-byte methods involve a conversion step.
- * Two methods are provided in each case, one that uses the platform default
- * encoding and the other which allows you to specify an encoding. You are
- * encouraged to always specify an encoding because relying on the platform
- * default can lead to unexpected results, for example when moving from
- * development to production.
+ * The byte-to-char methods and char-to-byte methods involve a conversion step. Two methods are
+ * provided in each case, one that uses the platform default encoding and the other which allows you
+ * to specify an encoding. You are encouraged to always specify an encoding because relying on the
+ * platform default can lead to unexpected results, for example when moving from development to
+ * production.
* <p>
- * All the methods in this class that read a stream are buffered internally.
- * This means that there is no cause to use a <code>BufferedInputStream</code>
- * or <code>BufferedReader</code>. The default buffer size of 4K has been
- * show to be efficient in tests.
+ * All the methods in this class that read a stream are buffered internally. This means that there
+ * is no cause to use a <code>BufferedInputStream</code> or <code>BufferedReader</code>. The
+ * default buffer size of 4K has been show to be efficient in tests.
* <p>
- * Wherever possible, the methods in this class do <em>not</em> flush or close
- * the stream. This is to avoid making non-portable assumptions about the
- * streams' origin and further use. Thus the caller is still responsible for
- * closing streams after use.
+ * Wherever possible, the methods in this class do <em>not</em> flush or close the stream. This is
+ * to avoid making non-portable assumptions about the streams' origin and further use. Thus the
+ * caller is still responsible for closing streams after use.
* <p>
* Origin of code: Apache Avalon (Excalibur)
- *
+ *
* @author Peter Donald
* @author Jeff Turner
* @author Matthew Hawthorne
@@ -90,9 +86,9 @@
/**
* Unconditionally close an <code>Reader</code>.
* <p>
- * Equivalent to {@link Reader#close()}, except any exceptions will be
- * ignored. This is typically used in finally blocks.
- *
+ * Equivalent to {@link Reader#close()}, except any exceptions will be ignored. This is
+ * typically used in finally blocks.
+ *
* @param input
* the Reader to close, may be null or already closed
*/
@@ -114,9 +110,9 @@
/**
* Unconditionally close a <code>Writer</code>.
* <p>
- * Equivalent to {@link Writer#close()}, except any exceptions will be
- * ignored. This is typically used in finally blocks.
- *
+ * Equivalent to {@link Writer#close()}, except any exceptions will be ignored. This is
+ * typically used in finally blocks.
+ *
* @param output
* the Writer to close, may be null or already closed
*/
@@ -138,9 +134,9 @@
/**
* Unconditionally close an <code>InputStream</code>.
* <p>
- * Equivalent to {@link InputStream#close()}, except any exceptions will be
- * ignored. This is typically used in finally blocks.
- *
+ * Equivalent to {@link InputStream#close()}, except any exceptions will be ignored. This is
+ * typically used in finally blocks.
+ *
* @param input
* the InputStream to close, may be null or already closed
*/
@@ -162,9 +158,9 @@
/**
* Unconditionally close an <code>OutputStream</code>.
* <p>
- * Equivalent to {@link OutputStream#close()}, except any exceptions will
- * be ignored. This is typically used in finally blocks.
- *
+ * Equivalent to {@link OutputStream#close()}, except any exceptions will be ignored. This is
+ * typically used in finally blocks.
+ *
* @param output
* the OutputStream to close, may be null or already closed
*/
@@ -186,12 +182,11 @@
// read toByteArray
// -----------------------------------------------------------------------
/**
- * Get the contents of an <code>InputStream</code> as a
- * <code>byte[]</code>.
+ * Get the contents of an <code>InputStream</code> as a <code>byte[]</code>.
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
- *
+ *
* @param input
* the <code>InputStream</code> to read from
* @return the requested byte array
@@ -208,12 +203,12 @@
}
/**
- * Get the contents of a <code>Reader</code> as a <code>byte[]</code>
- * using the default character encoding of the platform.
+ * Get the contents of a <code>Reader</code> as a <code>byte[]</code> using the default
+ * character encoding of the platform.
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
- *
+ *
* @param input
* the <code>Reader</code> to read from
* @return the requested byte array
@@ -230,15 +225,15 @@
}
/**
- * Get the contents of a <code>Reader</code> as a <code>byte[]</code>
- * using the specified character encoding.
+ * Get the contents of a <code>Reader</code> as a <code>byte[]</code> using the specified
+ * character encoding.
* <p>
* Character encoding names can be found at <a
* href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
- *
+ *
* @param input
* the <code>Reader</code> to read from
* @param encoding
@@ -260,12 +255,12 @@
// read char[]
// -----------------------------------------------------------------------
/**
- * Get the contents of an <code>InputStream</code> as a character array
- * using the default character encoding of the platform.
+ * Get the contents of an <code>InputStream</code> as a character array using the default
+ * character encoding of the platform.
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
- *
+ *
* @param is
* the <code>InputStream</code> to read from
* @return the requested character array
@@ -282,15 +277,15 @@
}
/**
- * Get the contents of an <code>InputStream</code> as a character array
- * using the specified character encoding.
+ * Get the contents of an <code>InputStream</code> as a character array using the specified
+ * character encoding.
* <p>
* Character encoding names can be found at <a
* href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
- *
+ *
* @param is
* the <code>InputStream</code> to read from
* @param encoding
@@ -313,7 +308,7 @@
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
- *
+ *
* @param input
* the <code>Reader</code> to read from
* @return the requested character array
@@ -332,12 +327,12 @@
// read toString
// -----------------------------------------------------------------------
/**
- * Get the contents of an <code>InputStream</code> as a String using the
- * default character encoding of the platform.
+ * Get the contents of an <code>InputStream</code> as a String using the default character
+ * encoding of the platform.
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
- *
+ *
* @param input
* the <code>InputStream</code> to read from
* @return the requested String
@@ -354,15 +349,15 @@
}
/**
- * Get the contents of an <code>InputStream</code> as a String using the
- * specified character encoding.
+ * Get the contents of an <code>InputStream</code> as a String using the specified character
+ * encoding.
* <p>
* Character encoding names can be found at <a
* href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
- *
+ *
* @param input
* the <code>InputStream</code> to read from
* @param encoding
@@ -385,7 +380,7 @@
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
- *
+ *
* @param input
* the <code>Reader</code> to read from
* @return the requested String
@@ -405,10 +400,9 @@
// -----------------------------------------------------------------------
/**
* Writes bytes from a <code>byte[]</code> to an <code>OutputStream</code>.
- *
+ *
* @param data
- * the byte array to write, do not modify during output, null
- * ignored
+ * the byte array to write, do not modify during output, null ignored
* @param output
* the <code>OutputStream</code> to write to
* @throws NullPointerException
@@ -426,15 +420,13 @@
}
/**
- * Writes bytes from a <code>byte[]</code> to chars on a
- * <code>Writer</code> using the default character encoding of the
- * platform.
+ * Writes bytes from a <code>byte[]</code> to chars on a <code>Writer</code> using the
+ * default character encoding of the platform.
* <p>
* This method uses {@link String#String(byte[])}.
- *
+ *
* @param data
- * the byte array to write, do not modify during output, null
- * ignored
+ * the byte array to write, do not modify during output, null ignored
* @param output
* the <code>Writer</code> to write to
* @throws NullPointerException
@@ -452,17 +444,16 @@
}
/**
- * Writes bytes from a <code>byte[]</code> to chars on a
- * <code>Writer</code> using the specified character encoding.
+ * Writes bytes from a <code>byte[]</code> to chars on a <code>Writer</code> using the
+ * specified character encoding.
* <p>
* Character encoding names can be found at <a
* href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#String(byte[], String)}.
- *
+ *
* @param data
- * the byte array to write, do not modify during output, null
- * ignored
+ * the byte array to write, do not modify during output, null ignored
* @param output
* the <code>Writer</code> to write to
* @param encoding
@@ -491,12 +482,11 @@
// write char[]
// -----------------------------------------------------------------------
/**
- * Writes chars from a <code>char[]</code> to a <code>Writer</code>
- * using the default character encoding of the platform.
- *
+ * Writes chars from a <code>char[]</code> to a <code>Writer</code> using the default
+ * character encoding of the platform.
+ *
* @param data
- * the char array to write, do not modify during output, null
- * ignored
+ * the char array to write, do not modify during output, null ignored
* @param output
* the <code>Writer</code> to write to
* @throws NullPointerException
@@ -514,15 +504,12 @@
}
/**
- * Writes chars from a <code>char[]</code> to bytes on an
- * <code>OutputStream</code>.
+ * Writes chars from a <code>char[]</code> to bytes on an <code>OutputStream</code>.
* <p>
- * This method uses {@link String#String(char[])} and
- * {@link String#getBytes()}.
- *
+ * This method uses {@link String#String(char[])} and {@link String#getBytes()}.
+ *
* @param data
- * the char array to write, do not modify during output, null
- * ignored
+ * the char array to write, do not modify during output, null ignored
* @param output
* the <code>OutputStream</code> to write to
* @throws NullPointerException
@@ -540,18 +527,16 @@
}
/**
- * Writes chars from a <code>char[]</code> to bytes on an
- * <code>OutputStream</code> using the specified character encoding.
+ * Writes chars from a <code>char[]</code> to bytes on an <code>OutputStream</code> using
+ * the specified character encoding.
* <p>
* Character encoding names can be found at <a
* href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
- * This method uses {@link String#String(char[])} and
- * {@link String#getBytes(String)}.
- *
+ * This method uses {@link String#String(char[])} and {@link String#getBytes(String)}.
+ *
* @param data
- * the char array to write, do not modify during output, null
- * ignored
+ * the char array to write, do not modify during output, null ignored
* @param output
* the <code>OutputStream</code> to write to
* @param encoding
@@ -581,7 +566,7 @@
// -----------------------------------------------------------------------
/**
* Writes chars from a <code>String</code> to a <code>Writer</code>.
- *
+ *
* @param data
* the <code>String</code> to write, null ignored
* @param output
@@ -601,12 +586,11 @@
}
/**
- * Writes chars from a <code>String</code> to bytes on an
- * <code>OutputStream</code> using the default character encoding of the
- * platform.
+ * Writes chars from a <code>String</code> to bytes on an <code>OutputStream</code> using
+ * the default character encoding of the platform.
* <p>
* This method uses {@link String#getBytes()}.
- *
+ *
* @param data
* the <code>String</code> to write, null ignored
* @param output
@@ -626,14 +610,14 @@
}
/**
- * Writes chars from a <code>String</code> to bytes on an
- * <code>OutputStream</code> using the specified character encoding.
+ * Writes chars from a <code>String</code> to bytes on an <code>OutputStream</code> using
+ * the specified character encoding.
* <p>
* Character encoding names can be found at <a
* href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#getBytes(String)}.
- *
+ *
* @param data
* the <code>String</code> to write, null ignored
* @param output
@@ -664,12 +648,10 @@
// write AppendingStringBuffer
// -----------------------------------------------------------------------
/**
- * Writes chars from a <code>AppendingStringBuffer</code> to a
- * <code>Writer</code>.
- *
+ * Writes chars from a <code>AppendingStringBuffer</code> to a <code>Writer</code>.
+ *
* @param data
- * the <code>AppendingStringBuffer</code> to write, null
- * ignored
+ * the <code>AppendingStringBuffer</code> to write, null ignored
* @param output
* the <code>Writer</code> to write to
* @throws NullPointerException
@@ -688,14 +670,12 @@
/**
* Writes chars from a <code>AppendingStringBuffer</code> to bytes on an
- * <code>OutputStream</code> using the default character encoding of the
- * platform.
+ * <code>OutputStream</code> using the default character encoding of the platform.
* <p>
* This method uses {@link String#getBytes()}.
- *
+ *
* @param data
- * the <code>AppendingStringBuffer</code> to write, null
- * ignored
+ * the <code>AppendingStringBuffer</code> to write, null ignored
* @param output
* the <code>OutputStream</code> to write to
* @throws NullPointerException
@@ -720,10 +700,9 @@
* href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#getBytes(String)}.
- *
+ *
* @param data
- * the <code>AppendingStringBuffer</code> to write, null
- * ignored
+ * the <code>AppendingStringBuffer</code> to write, null ignored
* @param output
* the <code>OutputStream</code> to write to
* @param encoding
@@ -753,12 +732,11 @@
// copy from InputStream
// -----------------------------------------------------------------------
/**
- * Copy bytes from an <code>InputStream</code> to an
- * <code>OutputStream</code>.
+ * Copy bytes from an <code>InputStream</code> to an <code>OutputStream</code>.
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
- *
+ *
* @param input
* the <code>InputStream</code> to read from
* @param output
@@ -784,15 +762,14 @@
}
/**
- * Copy bytes from an <code>InputStream</code> to chars on a
- * <code>Writer</code> using the default character encoding of the
- * platform.
+ * Copy bytes from an <code>InputStream</code> to chars on a <code>Writer</code> using the
+ * default character encoding of the platform.
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
* <p>
* This method uses {@link InputStreamReader}.
- *
+ *
* @param input
* the <code>InputStream</code> to read from
* @param output
@@ -810,8 +787,8 @@
}
/**
- * Copy bytes from an <code>InputStream</code> to chars on a
- * <code>Writer</code> using the specified character encoding.
+ * Copy bytes from an <code>InputStream</code> to chars on a <code>Writer</code> using the
+ * specified character encoding.
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
@@ -820,7 +797,7 @@
* href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link InputStreamReader}.
- *
+ *
* @param input
* the <code>InputStream</code> to read from
* @param output
@@ -853,7 +830,7 @@
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
- *
+ *
* @param input
* the <code>Reader</code> to read from
* @param output
@@ -879,18 +856,16 @@
}
/**
- * Copy chars from a <code>Reader</code> to bytes on an
- * <code>OutputStream</code> using the default character encoding of the
- * platform, and calling flush.
+ * Copy chars from a <code>Reader</code> to bytes on an <code>OutputStream</code> using the
+ * default character encoding of the platform, and calling flush.
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
* <p>
- * Due to the implementation of OutputStreamWriter, this method performs a
- * flush.
+ * Due to the implementation of OutputStreamWriter, this method performs a flush.
* <p>
* This method uses {@link OutputStreamWriter}.
- *
+ *
* @param input
* the <code>Reader</code> to read from
* @param output
@@ -909,9 +884,8 @@
}
/**
- * Copy chars from a <code>Reader</code> to bytes on an
- * <code>OutputStream</code> using the specified character encoding, and
- * calling flush.
+ * Copy chars from a <code>Reader</code> to bytes on an <code>OutputStream</code> using the
+ * specified character encoding, and calling flush.
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
@@ -919,11 +893,10 @@
* Character encoding names can be found at <a
* href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
- * Due to the implementation of OutputStreamWriter, this method performs a
- * flush.
+ * Due to the implementation of OutputStreamWriter, this method performs a flush.
* <p>
* This method uses {@link OutputStreamWriter}.
- *
+ *
* @param input
* the <code>Reader</code> to read from
* @param output
@@ -953,18 +926,17 @@
// content equals
// -----------------------------------------------------------------------
/**
- * Compare the contents of two Streams to determine if they are equal or
- * not.
+ * Compare the contents of two Streams to determine if they are equal or not.
* <p>
- * This method buffers the input internally using
- * <code>BufferedInputStream</code> if they are not already buffered.
- *
+ * This method buffers the input internally using <code>BufferedInputStream</code> if they are
+ * not already buffered.
+ *
* @param input1
* the first stream
* @param input2
* the second stream
- * @return true if the content of the streams are equal or they both don't
- * exist, false otherwise
+ * @return true if the content of the streams are equal or they both don't exist, false
+ * otherwise
* @throws NullPointerException
* if either input is null
* @throws IOException
@@ -997,18 +969,17 @@
}
/**
- * Compare the contents of two Readers to determine if they are equal or
- * not.
+ * Compare the contents of two Readers to determine if they are equal or not.
* <p>
- * This method buffers the input internally using
- * <code>BufferedReader</code> if they are not already buffered.
- *
+ * This method buffers the input internally using <code>BufferedReader</code> if they are not
+ * already buffered.
+ *
* @param input1
* the first reader
* @param input2
* the second reader
- * @return true if the content of the readers are equal or they both don't
- * exist, false otherwise
+ * @return true if the content of the readers are equal or they both don't exist, false
+ * otherwise
* @throws NullPointerException
* if either input is null
* @throws IOException
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/SerializableChecker.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/SerializableChecker.java?rev=584925&r1=584924&r2=584925&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/SerializableChecker.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/SerializableChecker.java Mon Oct 15 14:21:25 2007
@@ -43,23 +43,20 @@
/**
- * Utility class that analyzes objects for non-serializable nodes. Construct,
- * then call {@link #check(Object)} with the object you want to check. When a
- * non-serializable object is found, a {@link WicketNotSerializableException} is
- * thrown with a message that shows the trace up to the not-serializable object.
- * The exception is thrown for the first non-serializable instance it
- * encounters, so multiple problems will not be shown.
+ * Utility class that analyzes objects for non-serializable nodes. Construct, then call
+ * {@link #check(Object)} with the object you want to check. When a non-serializable object is
+ * found, a {@link WicketNotSerializableException} is thrown with a message that shows the trace up
+ * to the not-serializable object. The exception is thrown for the first non-serializable instance
+ * it encounters, so multiple problems will not be shown.
* <p>
- * As this class depends heavily on JDK's serialization internals using
- * introspection, analyzing may not be possible, for instance when the runtime
- * environment does not have sufficient rights to set fields accessible that
- * would otherwise be hidden. You should call
- * {@link SerializableChecker#isAvailable()} to see whether this class can
- * operate properly. If it doesn't, you should fall back to e.g. re-throwing/
- * printing the {@link NotSerializableException} you probably got before using
- * this class.
+ * As this class depends heavily on JDK's serialization internals using introspection, analyzing may
+ * not be possible, for instance when the runtime environment does not have sufficient rights to set
+ * fields accessible that would otherwise be hidden. You should call
+ * {@link SerializableChecker#isAvailable()} to see whether this class can operate properly. If it
+ * doesn't, you should fall back to e.g. re-throwing/ printing the {@link NotSerializableException}
+ * you probably got before using this class.
* </p>
- *
+ *
* @author eelcohillenius
* @author Al Maw
*/
@@ -266,13 +263,12 @@
}
/**
- * Gets whether we can execute the tests. If false, calling {@link #check(Object)}
- * will just return and you are advised to rely on the
- * {@link NotSerializableException}. Clients are advised to call this
- * method prior to calling the check method.
- *
- * @return whether security settings and underlying API etc allow for
- * accessing the serialization API using introspection
+ * Gets whether we can execute the tests. If false, calling {@link #check(Object)} will just
+ * return and you are advised to rely on the {@link NotSerializableException}. Clients are
+ * advised to call this method prior to calling the check method.
+ *
+ * @return whether security settings and underlying API etc allow for accessing the
+ * serialization API using introspection
*/
public static boolean isAvailable()
{
@@ -305,11 +301,10 @@
/**
* Construct.
- *
+ *
* @param exception
- * exception that should be set as the cause when throwing a new
- * exception
- *
+ * exception that should be set as the cause when throwing a new exception
+ *
* @throws IOException
*/
public SerializableChecker(NotSerializableException exception) throws IOException
@@ -356,9 +351,9 @@
desc = (ObjectStreamClass)LOOKUP_METHOD.invoke(null, new Object[] { cls,
Boolean.TRUE });
Class repCl;
- if (!((Boolean)HAS_WRITE_REPLACE_METHOD_METHOD.invoke(desc, null)).booleanValue()
- || (obj = INVOKE_WRITE_REPLACE_METHOD.invoke(desc, new Object[] { obj })) == null
- || (repCl = obj.getClass()) == cls)
+ if (!((Boolean)HAS_WRITE_REPLACE_METHOD_METHOD.invoke(desc, null)).booleanValue() ||
+ (obj = INVOKE_WRITE_REPLACE_METHOD.invoke(desc, new Object[] { obj })) == null ||
+ (repCl = obj.getClass()) == cls)
{
break;
}
@@ -426,8 +421,8 @@
{
throw (WicketNotSerializableException)e;
}
- log.warn("error delegating to Externalizable : " + e.getMessage() + ", path: "
- + currentPath());
+ log.warn("error delegating to Externalizable : " + e.getMessage() + ", path: " +
+ currentPath());
}
}
else
@@ -506,8 +501,8 @@
{
throw (WicketNotSerializableException)e;
}
- log.warn("error delegating to writeObject : " + e.getMessage() + ", path: "
- + currentPath());
+ log.warn("error delegating to writeObject : " + e.getMessage() + ", path: " +
+ currentPath());
}
}
else
@@ -580,9 +575,9 @@
}
for (int i = 0; i < objVals.length; i++)
{
- if (objVals[i] instanceof String || objVals[i] instanceof Number
- || objVals[i] instanceof Date || objVals[i] instanceof Boolean
- || objVals[i] instanceof Class)
+ if (objVals[i] instanceof String || objVals[i] instanceof Number ||
+ objVals[i] instanceof Date || objVals[i] instanceof Boolean ||
+ objVals[i] instanceof Class)
{
// filter out common cases
continue;
@@ -636,7 +631,7 @@
/**
* Dump with indentation.
- *
+ *
* @param type
* the type that couldn't be serialized
* @return A very pretty dump
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/Streams.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/Streams.java?rev=584925&r1=584924&r2=584925&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/Streams.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/Streams.java Mon Oct 15 14:21:25 2007
@@ -54,8 +54,8 @@
+ " key CDATA #REQUIRED>";
/**
- * Writes the input stream to the output stream. Input is done without a
- * Reader object, meaning that the input is copied in its raw form.
+ * Writes the input stream to the output stream. Input is done without a Reader object, meaning
+ * that the input is copied in its raw form.
*
* @param in
* The input stream
@@ -82,8 +82,7 @@
}
/**
- * Loads properties from an XML input stream into the provided properties
- * object.
+ * Loads properties from an XML input stream into the provided properties object.
*
* @param properties
* The object to load the properties into
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/StringBufferWriter.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/StringBufferWriter.java?rev=584925&r1=584924&r2=584925&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/StringBufferWriter.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/StringBufferWriter.java Mon Oct 15 14:21:25 2007
@@ -52,7 +52,7 @@
{
this.buffer = buffer;
}
-
+
/**
* Writers the char to the buffer
*
@@ -92,7 +92,7 @@
*/
public void write(String string, int offset, int length)
{
- buffer.append(string.substring(offset, offset+length));
+ buffer.append(string.substring(offset, offset + length));
}
/**
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/ThresholdingOutputStream.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/ThresholdingOutputStream.java?rev=584925&r1=584924&r2=584925&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/ThresholdingOutputStream.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/io/ThresholdingOutputStream.java Mon Oct 15 14:21:25 2007
@@ -21,18 +21,17 @@
/**
- * An output stream which triggers an event when a specified number of bytes of data have
- * been written to it. The event can be used, for example, to throw an exception if a
- * maximum has been reached, or to switch the underlying stream type when the threshold is
- * exceeded.
+ * An output stream which triggers an event when a specified number of bytes of data have been
+ * written to it. The event can be used, for example, to throw an exception if a maximum has been
+ * reached, or to switch the underlying stream type when the threshold is exceeded.
* <p>
- * This class overrides all <code>OutputStream</code> methods. However, these overrides
- * ultimately call the corresponding methods in the underlying output stream
- * implementation.
+ * This class overrides all <code>OutputStream</code> methods. However, these overrides ultimately
+ * call the corresponding methods in the underlying output stream implementation.
* <p>
- * NOTE: This implementation may trigger the event <em>before</em> the threshold is
- * actually reached, since it triggers when a pending write operation would cause the
- * threshold to be exceeded.
+ * NOTE: This implementation may trigger the event <em>before</em> the threshold is actually
+ * reached, since it triggers when a pending write operation would cause the threshold to be
+ * exceeded.
+ *
* @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
* @version $Id$
*/
@@ -64,9 +63,10 @@
/**
- * Constructs an instance of this class which will trigger an event at the specified
- * threshold.
- * @param threshold The number of bytes at which to trigger an event.
+ * Constructs an instance of this class which will trigger an event at the specified threshold.
+ *
+ * @param threshold
+ * The number of bytes at which to trigger an event.
*/
public ThresholdingOutputStream(int threshold)
{
@@ -79,8 +79,11 @@
/**
* Writes the specified byte to this output stream.
- * @param b The byte to be written.
- * @exception IOException if an error occurs.
+ *
+ * @param b
+ * The byte to be written.
+ * @exception IOException
+ * if an error occurs.
*/
public void write(int b) throws IOException
{
@@ -91,10 +94,12 @@
/**
- * Writes <code>b.length</code> bytes from the specified byte array to this output
- * stream.
- * @param b The array of bytes to be written.
- * @exception IOException if an error occurs.
+ * Writes <code>b.length</code> bytes from the specified byte array to this output stream.
+ *
+ * @param b
+ * The array of bytes to be written.
+ * @exception IOException
+ * if an error occurs.
*/
public void write(byte b[]) throws IOException
{
@@ -107,10 +112,15 @@
/**
* Writes <code>len</code> bytes from the specified byte array starting at offset
* <code>off</code> to this output stream.
- * @param b The byte array from which the data will be written.
- * @param off The start offset in the byte array.
- * @param len The number of bytes to write.
- * @exception IOException if an error occurs.
+ *
+ * @param b
+ * The byte array from which the data will be written.
+ * @param off
+ * The start offset in the byte array.
+ * @param len
+ * The number of bytes to write.
+ * @exception IOException
+ * if an error occurs.
*/
public void write(byte b[], int off, int len) throws IOException
{
@@ -122,7 +132,9 @@
/**
* Flushes this output stream and forces any buffered output bytes to be written out.
- * @exception IOException if an error occurs.
+ *
+ * @exception IOException
+ * if an error occurs.
*/
public void flush() throws IOException
{
@@ -131,9 +143,10 @@
/**
- * Closes this output stream and releases any system resources associated with this
- * stream.
- * @exception IOException if an error occurs.
+ * Closes this output stream and releases any system resources associated with this stream.
+ *
+ * @exception IOException
+ * if an error occurs.
*/
public void close() throws IOException
{
@@ -154,6 +167,7 @@
/**
* Returns the threshold, in bytes, at which an event will be triggered.
+ *
* @return The threshold point, in bytes.
*/
public int getThreshold()
@@ -164,6 +178,7 @@
/**
* Returns the number of bytes that have been written to this output stream.
+ *
* @return The number of bytes written.
*/
public long getByteCount()
@@ -173,8 +188,8 @@
/**
- * Determines whether or not the configured threshold has been exceeded for this
- * output stream.
+ * Determines whether or not the configured threshold has been exceeded for this output stream.
+ *
* @return <code>true</code> if the threshold has been reached; <code>false</code>
* otherwise.
*/
@@ -188,12 +203,14 @@
/**
- * Checks to see if writing the specified number of bytes would cause the configured
- * threshold to be exceeded. If so, triggers an event to allow a concrete
- * implementation to take action on this.
- * @param count The number of bytes about to be written to the underlying output
- * stream.
- * @exception IOException if an error occurs.
+ * Checks to see if writing the specified number of bytes would cause the configured threshold
+ * to be exceeded. If so, triggers an event to allow a concrete implementation to take action on
+ * this.
+ *
+ * @param count
+ * The number of bytes about to be written to the underlying output stream.
+ * @exception IOException
+ * if an error occurs.
*/
protected void checkThreshold(int count) throws IOException
{
@@ -209,19 +226,23 @@
/**
- * Returns the underlying output stream, to which the corresponding
- * <code>OutputStream</code> methods in this class will ultimately delegate.
+ * Returns the underlying output stream, to which the corresponding <code>OutputStream</code>
+ * methods in this class will ultimately delegate.
+ *
* @return The underlying output stream.
- * @exception IOException if an error occurs.
+ * @exception IOException
+ * if an error occurs.
*/
protected abstract OutputStream getStream() throws IOException;
/**
- * Indicates that the configured threshold has been reached, and that a subclass
- * should take whatever action necessary on this event. This may include changing the
- * underlying output stream.
- * @exception IOException if an error occurs.
+ * Indicates that the configured threshold has been reached, and that a subclass should take
+ * whatever action necessary on this event. This may include changing the underlying output
+ * stream.
+ *
+ * @exception IOException
+ * if an error occurs.
*/
protected abstract void thresholdReached() throws IOException;
}