And finally, narya gets the imports/overrides/regen love.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5241 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Dave Hoover
2008-07-18 23:20:17 +00:00
parent e41dda3018
commit 6b1d65553f
129 changed files with 383 additions and 304 deletions
+39 -38
View File
@@ -85,14 +85,14 @@ public class BasicStreamers
/** Streams {@link Boolean} instances. */
public static class BooleanStreamer extends BasicStreamer
{
// documentation inherited
@Override
public Object createObject (ObjectInputStream in)
throws IOException
{
return Boolean.valueOf(in.readBoolean());
}
// documentation inherited
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
@@ -103,14 +103,14 @@ public class BasicStreamers
/** Streams {@link Byte} instances. */
public static class ByteStreamer extends BasicStreamer
{
// documentation inherited
@Override
public Object createObject (ObjectInputStream in)
throws IOException
{
return Byte.valueOf(in.readByte());
}
// documentation inherited
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
@@ -121,14 +121,14 @@ public class BasicStreamers
/** Streams {@link Short} instances. */
public static class ShortStreamer extends BasicStreamer
{
// documentation inherited
@Override
public Object createObject (ObjectInputStream in)
throws IOException
{
return Short.valueOf(in.readShort());
}
// documentation inherited
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
@@ -139,13 +139,13 @@ public class BasicStreamers
/** Streams {@link Character} instances. */
public static class CharacterStreamer extends BasicStreamer
{
// documentation inherited
@Override
public Object createObject (ObjectInputStream in)throws IOException
{
return Character.valueOf(in.readChar());
}
// documentation inherited
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
@@ -156,14 +156,14 @@ public class BasicStreamers
/** Streams {@link Integer} instances. */
public static class IntegerStreamer extends BasicStreamer
{
// documentation inherited
@Override
public Object createObject (ObjectInputStream in)
throws IOException
{
return Integer.valueOf(in.readInt());
}
// documentation inherited
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
@@ -174,14 +174,14 @@ public class BasicStreamers
/** Streams {@link Long} instances. */
public static class LongStreamer extends BasicStreamer
{
// documentation inherited
@Override
public Object createObject (ObjectInputStream in)
throws IOException
{
return Long.valueOf(in.readLong());
}
// documentation inherited
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
@@ -192,14 +192,14 @@ public class BasicStreamers
/** Streams {@link Float} instances. */
public static class FloatStreamer extends BasicStreamer
{
// documentation inherited
@Override
public Object createObject (ObjectInputStream in)
throws IOException
{
return Float.valueOf(in.readFloat());
}
// documentation inherited
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
@@ -210,14 +210,14 @@ public class BasicStreamers
/** Streams {@link Double} instances. */
public static class DoubleStreamer extends BasicStreamer
{
// documentation inherited
@Override
public Object createObject (ObjectInputStream in)
throws IOException
{
return Double.valueOf(in.readDouble());
}
// documentation inherited
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
@@ -228,14 +228,14 @@ public class BasicStreamers
/** Streams {@link String} instances. */
public static class StringStreamer extends BasicStreamer
{
// documentation inherited
@Override
public Object createObject (ObjectInputStream in)
throws IOException
{
return in.readUTF();
}
// documentation inherited
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
@@ -246,14 +246,14 @@ public class BasicStreamers
/** Streams arrays of booleans. */
public static class BooleanArrayStreamer extends BasicStreamer
{
// documentation inherited
@Override
public Object createObject (ObjectInputStream in)
throws IOException
{
return readBooleanArray(in);
}
// documentation inherited
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
@@ -264,14 +264,14 @@ public class BasicStreamers
/** Streams arrays of bytes. */
public static class ByteArrayStreamer extends BasicStreamer
{
// documentation inherited
@Override
public Object createObject (ObjectInputStream in)
throws IOException
{
return readByteArray(in);
}
// documentation inherited
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
@@ -282,14 +282,14 @@ public class BasicStreamers
/** Streams arrays of shorts. */
public static class ShortArrayStreamer extends BasicStreamer
{
// documentation inherited
@Override
public Object createObject (ObjectInputStream in)
throws IOException
{
return readShortArray(in);
}
// documentation inherited
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
@@ -300,14 +300,14 @@ public class BasicStreamers
/** Streams arrays of chars. */
public static class CharArrayStreamer extends BasicStreamer
{
// documentation inherited
@Override
public Object createObject (ObjectInputStream in)
throws IOException
{
return readCharArray(in);
}
// documentation inherited
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
@@ -318,14 +318,14 @@ public class BasicStreamers
/** Streams arrays of ints. */
public static class IntArrayStreamer extends BasicStreamer
{
// documentation inherited
@Override
public Object createObject (ObjectInputStream in)
throws IOException
{
return readIntArray(in);
}
// documentation inherited
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
@@ -336,14 +336,14 @@ public class BasicStreamers
/** Streams arrays of longs. */
public static class LongArrayStreamer extends BasicStreamer
{
// documentation inherited
@Override
public Object createObject (ObjectInputStream in)
throws IOException
{
return readLongArray(in);
}
// documentation inherited
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
@@ -354,14 +354,14 @@ public class BasicStreamers
/** Streams arrays of floats. */
public static class FloatArrayStreamer extends BasicStreamer
{
// documentation inherited
@Override
public Object createObject (ObjectInputStream in)
throws IOException
{
return readFloatArray(in);
}
// documentation inherited
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
@@ -372,14 +372,14 @@ public class BasicStreamers
/** Streams arrays of doubles. */
public static class DoubleArrayStreamer extends BasicStreamer
{
// documentation inherited
@Override
public Object createObject (ObjectInputStream in)
throws IOException
{
return readDoubleArray(in);
}
// documentation inherited
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
@@ -390,14 +390,14 @@ public class BasicStreamers
/** Streams arrays of Object instances. */
public static class ObjectArrayStreamer extends BasicStreamer
{
// documentation inherited
@Override
public Object createObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
return readObjectArray(in);
}
// documentation inherited
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
@@ -408,14 +408,14 @@ public class BasicStreamers
/** Streams {@link List} instances. */
public static class ListStreamer extends BasicStreamer
{
// documentation inherited
@Override
public Object createObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
return readList(in);
}
// documentation inherited
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
@@ -426,6 +426,7 @@ public class BasicStreamers
/** Streams {@link String} instances. */
public static class BasicStreamer extends Streamer
{
@Override
public void readObject (Object object, ObjectInputStream in, boolean useReader)
throws IOException, ClassNotFoundException
{
@@ -38,6 +38,7 @@ class ClassMapping
this.streamer = streamer;
}
@Override
public String toString ()
{
return "[code=" + code + ", class=" + sclass.getName() + "]";
@@ -141,7 +141,7 @@ public abstract class FieldMarshaller
_streamer = streamer;
}
// documentation inherited
@Override
public void readField (Field field, Object target, ObjectInputStream in)
throws Exception
{
@@ -154,7 +154,7 @@ public abstract class FieldMarshaller
}
}
// documentation inherited
@Override
public void writeField (Field field, Object source, ObjectOutputStream out)
throws Exception
{
@@ -167,6 +167,7 @@ public abstract class FieldMarshaller
}
}
@Override
public String toString ()
{
return "StreamerMarshaller:" + _streamer.toString();
@@ -187,14 +188,14 @@ public abstract class FieldMarshaller
_writer = writer;
}
// documentation inherited
@Override
public void readField (Field field, Object target, ObjectInputStream in)
throws Exception
{
_reader.invoke(target, in);
}
// documentation inherited
@Override
public void writeField (Field field, Object source, ObjectOutputStream out)
throws Exception
{
@@ -215,10 +216,12 @@ public abstract class FieldMarshaller
// create a generic marshaller for streamable instances
FieldMarshaller gmarsh = new FieldMarshaller() {
@Override
public void readField (Field field, Object target, ObjectInputStream in)
throws Exception {
field.set(target, in.readObject());
}
@Override
public void writeField (Field field, Object source, ObjectOutputStream out)
throws Exception {
out.writeObject(field.get(source));
@@ -234,90 +237,108 @@ public abstract class FieldMarshaller
// create marshallers for the primitive types
_marshallers.put(Boolean.TYPE, new FieldMarshaller() {
@Override
public void readField (Field field, Object target, ObjectInputStream in)
throws Exception {
field.setBoolean(target, in.readBoolean());
}
@Override
public void writeField (Field field, Object source, ObjectOutputStream out)
throws Exception {
out.writeBoolean(field.getBoolean(source));
}
});
_marshallers.put(Byte.TYPE, new FieldMarshaller() {
@Override
public void readField (Field field, Object target, ObjectInputStream in)
throws Exception {
field.setByte(target, in.readByte());
}
@Override
public void writeField (Field field, Object source, ObjectOutputStream out)
throws Exception {
out.writeByte(field.getByte(source));
}
});
_marshallers.put(Character.TYPE, new FieldMarshaller() {
@Override
public void readField (Field field, Object target, ObjectInputStream in)
throws Exception {
field.setChar(target, in.readChar());
}
@Override
public void writeField (Field field, Object source, ObjectOutputStream out)
throws Exception {
out.writeChar(field.getChar(source));
}
});
_marshallers.put(Short.TYPE, new FieldMarshaller() {
@Override
public void readField (Field field, Object target, ObjectInputStream in)
throws Exception {
field.setShort(target, in.readShort());
}
@Override
public void writeField (Field field, Object source, ObjectOutputStream out)
throws Exception {
out.writeShort(field.getShort(source));
}
});
_marshallers.put(Integer.TYPE, new FieldMarshaller() {
@Override
public void readField (Field field, Object target, ObjectInputStream in)
throws Exception {
field.setInt(target, in.readInt());
}
@Override
public void writeField (Field field, Object source, ObjectOutputStream out)
throws Exception {
out.writeInt(field.getInt(source));
}
});
_marshallers.put(Long.TYPE, new FieldMarshaller() {
@Override
public void readField (Field field, Object target, ObjectInputStream in)
throws Exception {
field.setLong(target, in.readLong());
}
@Override
public void writeField (Field field, Object source, ObjectOutputStream out)
throws Exception {
out.writeLong(field.getLong(source));
}
});
_marshallers.put(Float.TYPE, new FieldMarshaller() {
@Override
public void readField (Field field, Object target, ObjectInputStream in)
throws Exception {
field.setFloat(target, in.readFloat());
}
@Override
public void writeField (Field field, Object source, ObjectOutputStream out)
throws Exception {
out.writeFloat(field.getFloat(source));
}
});
_marshallers.put(Double.TYPE, new FieldMarshaller() {
@Override
public void readField (Field field, Object target, ObjectInputStream in)
throws Exception {
field.setDouble(target, in.readDouble());
}
@Override
public void writeField (Field field, Object source, ObjectOutputStream out)
throws Exception {
out.writeDouble(field.getDouble(source));
}
});
_marshallers.put(Date.class, new FieldMarshaller() {
@Override
public void readField (Field field, Object target, ObjectInputStream in)
throws Exception {
field.set(target, new Date(in.readLong()));
}
@Override
public void writeField (Field field, Object source, ObjectOutputStream out)
throws Exception {
out.writeLong(((Date)field.get(source)).getTime());
@@ -193,6 +193,7 @@ public class FramedInputStream extends InputStream
* @return the next byte of data, or <code>-1</code> if the end of the
* stream has been reached.
*/
@Override
public int read ()
{
return (_buffer.remaining() > 0) ? (_buffer.get() & 0xFF) : -1;
@@ -221,6 +222,7 @@ public class FramedInputStream extends InputStream
* <code>-1</code> if there is no more data because the end of the
* stream has been reached.
*/
@Override
public int read (byte[] b, int off, int len)
{
// if they want no bytes, we give them no bytes; this is
@@ -252,6 +254,7 @@ public class FramedInputStream extends InputStream
*
* @return the actual number of bytes skipped.
*/
@Override
public long skip (long n)
{
throw new UnsupportedOperationException();
@@ -264,6 +267,7 @@ public class FramedInputStream extends InputStream
* @return the number of bytes remaining to be read from the buffered
* frame.
*/
@Override
public int available ()
{
return _buffer.remaining();
@@ -273,6 +277,7 @@ public class FramedInputStream extends InputStream
* Always returns false as framed input streams do not support
* marking.
*/
@Override
public boolean markSupported ()
{
return false;
@@ -281,6 +286,7 @@ public class FramedInputStream extends InputStream
/**
* Does nothing, as marking is not supported.
*/
@Override
public void mark (int readAheadLimit)
{
// not supported; do nothing
@@ -289,6 +295,7 @@ public class FramedInputStream extends InputStream
/**
* Resets the buffer to the beginning of the buffered frames.
*/
@Override
public void reset ()
{
// position our buffer at the beginning of the frame data
@@ -230,9 +230,7 @@ public class ObjectInputStream extends DataInputStream
_streamer.readObject(_current, this, false);
}
/**
* Generates a string representation of this instance.
*/
@Override
public String toString ()
{
return "[hash=" + hashCode() + ", mappings=" + _classmap.size() +
@@ -31,9 +31,7 @@ import com.threerings.util.ActionScript;
*/
public class SimpleStreamableObject implements Streamable
{
/**
* Generates a string representation of this instance.
*/
@Override
public String toString ()
{
StringBuilder buf = new StringBuilder("[");
+1 -3
View File
@@ -391,9 +391,7 @@ public class Streamer
}
}
/**
* Generates a string representation of this instance.
*/
@Override
public String toString ()
{
return (_target == null) ? getClass().getName() :
@@ -33,9 +33,7 @@ import com.threerings.util.TrackedObject;
public class TrackedStreamableObject extends TrackedObject
implements Streamable
{
/**
* Generates a string representation of this instance.
*/
@Override
public String toString ()
{
StringBuilder buf = new StringBuilder("[");