Modified: directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/LongArrayMarshaller.java URL: http://svn.apache.org/viewvc/directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/LongArrayMarshaller.java?rev=1405125&r1=1405124&r2=1405125&view=diff ============================================================================== --- directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/LongArrayMarshaller.java (original) +++ directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/LongArrayMarshaller.java Fri Nov 2 19:46:14 2012 @@ -18,11 +18,11 @@ */ package org.apache.directmemory.lightning.internal.marshaller; -import java.io.DataInput; -import java.io.DataOutput; import java.io.IOException; import org.apache.directmemory.lightning.SerializationContext; +import org.apache.directmemory.lightning.Source; +import org.apache.directmemory.lightning.Target; import org.apache.directmemory.lightning.base.AbstractMarshaller; import org.apache.directmemory.lightning.metadata.PropertyDescriptor; @@ -37,12 +37,12 @@ public class LongArrayMarshaller } @Override - public void marshall( Object value, PropertyDescriptor propertyDescriptor, DataOutput dataOutput, + public void marshall( Object value, PropertyDescriptor propertyDescriptor, Target target, SerializationContext serializationContext ) throws IOException { - if ( !writePossibleNull( value, dataOutput ) ) + if ( !writePossibleNull( value, target ) ) { return; } @@ -50,43 +50,43 @@ public class LongArrayMarshaller if ( long[].class == propertyDescriptor.getType() ) { long[] array = (long[]) value; - dataOutput.writeInt( array.length ); + target.writeInt( array.length ); for ( long arrayValue : array ) { - dataOutput.writeLong( arrayValue ); + target.writeLong( arrayValue ); } } else { Long[] array = (Long[]) value; - dataOutput.writeInt( array.length ); + target.writeInt( array.length ); for ( long arrayValue : array ) { - dataOutput.writeLong( arrayValue ); + target.writeLong( arrayValue ); } } } @Override @SuppressWarnings( "unchecked" ) - public <V> V unmarshall( PropertyDescriptor propertyDescriptor, DataInput dataInput, + public <V> V unmarshall( PropertyDescriptor propertyDescriptor, Source source, SerializationContext serializationContext ) throws IOException { - if ( isNull( dataInput ) ) + if ( isNull( source ) ) { return null; } - int size = dataInput.readInt(); + int size = source.readInt(); if ( long[].class == propertyDescriptor.getType() ) { long[] array = new long[size]; for ( int i = 0; i < size; i++ ) { - array[i] = dataInput.readLong(); + array[i] = source.readLong(); } return (V) array; @@ -96,7 +96,7 @@ public class LongArrayMarshaller Long[] array = new Long[size]; for ( int i = 0; i < size; i++ ) { - array[i] = dataInput.readLong(); + array[i] = source.readLong(); } return (V) array;
Modified: directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/LongMarshaller.java URL: http://svn.apache.org/viewvc/directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/LongMarshaller.java?rev=1405125&r1=1405124&r2=1405125&view=diff ============================================================================== --- directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/LongMarshaller.java (original) +++ directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/LongMarshaller.java Fri Nov 2 19:46:14 2012 @@ -18,11 +18,11 @@ */ package org.apache.directmemory.lightning.internal.marshaller; -import java.io.DataInput; -import java.io.DataOutput; import java.io.IOException; import org.apache.directmemory.lightning.SerializationContext; +import org.apache.directmemory.lightning.Source; +import org.apache.directmemory.lightning.Target; import org.apache.directmemory.lightning.base.AbstractMarshaller; import org.apache.directmemory.lightning.metadata.PropertyDescriptor; @@ -37,36 +37,36 @@ public class LongMarshaller } @Override - public void marshall( Object value, PropertyDescriptor propertyDescriptor, DataOutput dataOutput, + public void marshall( Object value, PropertyDescriptor propertyDescriptor, Target target, SerializationContext serializationContext ) throws IOException { if ( Long.class == propertyDescriptor.getType() ) { - if ( !writePossibleNull( value, dataOutput ) ) + if ( !writePossibleNull( value, target ) ) { return; } } - dataOutput.writeLong( (Long) value ); + target.writeLong( (Long) value ); } @Override @SuppressWarnings( "unchecked" ) - public <V> V unmarshall( PropertyDescriptor propertyDescriptor, DataInput dataInput, + public <V> V unmarshall( PropertyDescriptor propertyDescriptor, Source source, SerializationContext serializationContext ) throws IOException { if ( Long.class == propertyDescriptor.getType() ) { - if ( isNull( dataInput ) ) + if ( isNull( source ) ) { return null; } } - return (V) Long.valueOf( dataInput.readLong() ); + return (V) Long.valueOf( source.readLong() ); } } Modified: directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/MapMarshaller.java URL: http://svn.apache.org/viewvc/directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/MapMarshaller.java?rev=1405125&r1=1405124&r2=1405125&view=diff ============================================================================== --- directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/MapMarshaller.java (original) +++ directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/MapMarshaller.java Fri Nov 2 19:46:14 2012 @@ -18,8 +18,6 @@ */ package org.apache.directmemory.lightning.internal.marshaller; -import java.io.DataInput; -import java.io.DataOutput; import java.io.IOException; import java.lang.reflect.Type; import java.util.Arrays; @@ -29,6 +27,8 @@ import java.util.Map.Entry; import org.apache.directmemory.lightning.Marshaller; import org.apache.directmemory.lightning.SerializationContext; +import org.apache.directmemory.lightning.Source; +import org.apache.directmemory.lightning.Target; import org.apache.directmemory.lightning.TypeBindableMarshaller; import org.apache.directmemory.lightning.base.AbstractMarshaller; import org.apache.directmemory.lightning.exceptions.SerializerExecutionException; @@ -68,15 +68,15 @@ public class MapMarshaller } @Override - public void marshall( Object value, PropertyDescriptor propertyDescriptor, DataOutput dataOutput, + public void marshall( Object value, PropertyDescriptor propertyDescriptor, Target target, SerializationContext serializationContext ) throws IOException { - if ( writePossibleNull( value, dataOutput ) ) + if ( writePossibleNull( value, target ) ) { Map<?, ?> map = (Map<?, ?>) value; - dataOutput.writeInt( map.size() ); + target.writeInt( map.size() ); Marshaller keyMarshaller = null; ClassDefinition keyClassDefinition = null; @@ -129,16 +129,16 @@ public class MapMarshaller } } - if ( writePossibleNull( entry.getKey(), dataOutput ) ) + if ( writePossibleNull( entry.getKey(), target ) ) { - dataOutput.writeLong( keyClassDefinition.getId() ); - keyMarshaller.marshall( entry.getKey(), keyPd, dataOutput, serializationContext ); + target.writeLong( keyClassDefinition.getId() ); + keyMarshaller.marshall( entry.getKey(), keyPd, target, serializationContext ); } - if ( writePossibleNull( entry.getValue(), dataOutput ) ) + if ( writePossibleNull( entry.getValue(), target ) ) { - dataOutput.writeLong( valueClassDefinition.getId() ); - valueMarshaller.marshall( entry.getValue(), valuePd, dataOutput, serializationContext ); + target.writeLong( valueClassDefinition.getId() ); + valueMarshaller.marshall( entry.getValue(), valuePd, target, serializationContext ); } } } @@ -146,25 +146,25 @@ public class MapMarshaller @Override @SuppressWarnings( { "rawtypes", "unchecked" } ) - public <V> V unmarshall( PropertyDescriptor propertyDescriptor, DataInput dataInput, + public <V> V unmarshall( PropertyDescriptor propertyDescriptor, Source source, SerializationContext serializationContext ) throws IOException { - if ( isNull( dataInput ) ) + if ( isNull( source ) ) { return null; } - int size = dataInput.readInt(); + int size = source.readInt(); Map map = new LinkedHashMap( size ); if ( size > 0 ) { for ( int i = 0; i < size; i++ ) { Object key = null; - if ( !isNull( dataInput ) ) + if ( !isNull( source ) ) { - long keyClassId = dataInput.readLong(); + long keyClassId = source.readLong(); ClassDefinition keyClassDefinition = serializationContext.getClassDefinitionContainer().getClassDefinitionById( keyClassId ); @@ -182,13 +182,13 @@ public class MapMarshaller PropertyDescriptor pd = new CheatPropertyDescriptor( propertyDescriptor.getPropertyName() + "Key", keyClassDefinition.getType(), keyMarshaller ); - key = keyMarshaller.unmarshall( pd, dataInput, serializationContext ); + key = keyMarshaller.unmarshall( pd, source, serializationContext ); } Object value = null; - if ( !isNull( dataInput ) ) + if ( !isNull( source ) ) { - long valueClassId = dataInput.readLong(); + long valueClassId = source.readLong(); ClassDefinition valueClassDefinition = serializationContext.getClassDefinitionContainer().getClassDefinitionById( valueClassId ); @@ -206,7 +206,7 @@ public class MapMarshaller PropertyDescriptor pd = new CheatPropertyDescriptor( propertyDescriptor.getPropertyName() + "Value", valueClassDefinition.getType(), valueMarshaller ); - value = valueMarshaller.unmarshall( pd, dataInput, serializationContext ); + value = valueMarshaller.unmarshall( pd, source, serializationContext ); } map.put( key, value ); Modified: directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/SerializableMarshaller.java URL: http://svn.apache.org/viewvc/directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/SerializableMarshaller.java?rev=1405125&r1=1405124&r2=1405125&view=diff ============================================================================== --- directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/SerializableMarshaller.java (original) +++ directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/SerializableMarshaller.java Fri Nov 2 19:46:14 2012 @@ -18,16 +18,16 @@ */ package org.apache.directmemory.lightning.internal.marshaller; -import java.io.DataInput; -import java.io.DataOutput; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.io.InputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; -import java.io.OutputStream; import java.io.Serializable; import org.apache.directmemory.lightning.SerializationContext; +import org.apache.directmemory.lightning.Source; +import org.apache.directmemory.lightning.Target; import org.apache.directmemory.lightning.base.AbstractObjectMarshaller; import org.apache.directmemory.lightning.metadata.PropertyDescriptor; @@ -42,25 +42,33 @@ public class SerializableMarshaller } @Override - public void marshall( Object value, PropertyDescriptor propertyDescriptor, DataOutput dataOutput, + public void marshall( Object value, PropertyDescriptor propertyDescriptor, Target target, SerializationContext serializationContext ) throws IOException { - ObjectOutputStream stream = new ObjectOutputStream( (OutputStream) dataOutput ); - stream.writeObject( value ); + ByteArrayOutputStream stream = new ByteArrayOutputStream( 1024 ); + ObjectOutputStream oos = new ObjectOutputStream( stream ); + oos.writeObject( value ); + byte[] data = stream.toByteArray(); + target.writeInt( data.length ); + target.writeBytes( data ); } @Override @SuppressWarnings( "unchecked" ) - public <V> V unmarshall( V value, PropertyDescriptor propertyDescriptor, DataInput dataInput, + public <V> V unmarshall( V value, PropertyDescriptor propertyDescriptor, Source source, SerializationContext serializationContext ) throws IOException { - ObjectInputStream stream = new ObjectInputStream( (InputStream) dataInput ); try { - return (V) stream.readObject(); + int length = source.readInt(); + byte[] data = new byte[length]; + source.readBytes( data ); + ByteArrayInputStream stream = new ByteArrayInputStream( data ); + ObjectInputStream ois = new ObjectInputStream( stream ); + return (V) ois.readObject(); } catch ( ClassNotFoundException e ) { Modified: directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/SetMarshaller.java URL: http://svn.apache.org/viewvc/directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/SetMarshaller.java?rev=1405125&r1=1405124&r2=1405125&view=diff ============================================================================== --- directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/SetMarshaller.java (original) +++ directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/SetMarshaller.java Fri Nov 2 19:46:14 2012 @@ -18,8 +18,6 @@ */ package org.apache.directmemory.lightning.internal.marshaller; -import java.io.DataInput; -import java.io.DataOutput; import java.io.IOException; import java.lang.reflect.Type; import java.util.Arrays; @@ -28,6 +26,8 @@ import java.util.Set; import org.apache.directmemory.lightning.Marshaller; import org.apache.directmemory.lightning.SerializationContext; +import org.apache.directmemory.lightning.Source; +import org.apache.directmemory.lightning.Target; import org.apache.directmemory.lightning.TypeBindableMarshaller; import org.apache.directmemory.lightning.base.AbstractMarshaller; import org.apache.directmemory.lightning.exceptions.SerializerExecutionException; @@ -62,15 +62,15 @@ public class SetMarshaller } @Override - public void marshall( Object value, PropertyDescriptor propertyDescriptor, DataOutput dataOutput, + public void marshall( Object value, PropertyDescriptor propertyDescriptor, Target target, SerializationContext serializationContext ) throws IOException { - if ( writePossibleNull( value, dataOutput ) ) + if ( writePossibleNull( value, target ) ) { Set<?> set = (Set<?>) value; - dataOutput.writeInt( set.size() ); + target.writeInt( set.size() ); Marshaller marshaller = null; ClassDefinition classDefinition = null; @@ -87,7 +87,7 @@ public class SetMarshaller for ( Object entry : set ) { - if ( writePossibleNull( entry, dataOutput ) ) + if ( writePossibleNull( entry, target ) ) { if ( setType == null ) { @@ -99,8 +99,8 @@ public class SetMarshaller entry.getClass(), marshaller ); } - dataOutput.writeLong( classDefinition.getId() ); - marshaller.marshall( entry, pd, dataOutput, serializationContext ); + target.writeLong( classDefinition.getId() ); + marshaller.marshall( entry, pd, target, serializationContext ); } } } @@ -108,28 +108,28 @@ public class SetMarshaller @Override @SuppressWarnings( { "rawtypes", "unchecked" } ) - public <V> V unmarshall( PropertyDescriptor propertyDescriptor, DataInput dataInput, + public <V> V unmarshall( PropertyDescriptor propertyDescriptor, Source source, SerializationContext serializationContext ) throws IOException { - if ( isNull( dataInput ) ) + if ( isNull( source ) ) { return null; } - int size = dataInput.readInt(); + int size = source.readInt(); Set set = new HashSet( size ); if ( size > 0 ) { for ( int i = 0; i < size; i++ ) { - if ( isNull( dataInput ) ) + if ( isNull( source ) ) { set.add( null ); } else { - long classId = dataInput.readLong(); + long classId = source.readLong(); ClassDefinition classDefinition = serializationContext.getClassDefinitionContainer().getClassDefinitionById( classId ); @@ -147,7 +147,7 @@ public class SetMarshaller PropertyDescriptor pd = new CheatPropertyDescriptor( propertyDescriptor.getPropertyName() + "Set", classDefinition.getType(), marshaller ); - set.add( marshaller.unmarshall( pd, dataInput, serializationContext ) ); + set.add( marshaller.unmarshall( pd, source, serializationContext ) ); } } } Modified: directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/ShortArrayMarshaller.java URL: http://svn.apache.org/viewvc/directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/ShortArrayMarshaller.java?rev=1405125&r1=1405124&r2=1405125&view=diff ============================================================================== --- directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/ShortArrayMarshaller.java (original) +++ directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/ShortArrayMarshaller.java Fri Nov 2 19:46:14 2012 @@ -18,11 +18,11 @@ */ package org.apache.directmemory.lightning.internal.marshaller; -import java.io.DataInput; -import java.io.DataOutput; import java.io.IOException; import org.apache.directmemory.lightning.SerializationContext; +import org.apache.directmemory.lightning.Source; +import org.apache.directmemory.lightning.Target; import org.apache.directmemory.lightning.base.AbstractMarshaller; import org.apache.directmemory.lightning.metadata.PropertyDescriptor; @@ -37,12 +37,12 @@ public class ShortArrayMarshaller } @Override - public void marshall( Object value, PropertyDescriptor propertyDescriptor, DataOutput dataOutput, + public void marshall( Object value, PropertyDescriptor propertyDescriptor, Target target, SerializationContext serializationContext ) throws IOException { - if ( !writePossibleNull( value, dataOutput ) ) + if ( !writePossibleNull( value, target ) ) { return; } @@ -50,43 +50,43 @@ public class ShortArrayMarshaller if ( short[].class == propertyDescriptor.getType() ) { short[] array = (short[]) value; - dataOutput.writeInt( array.length ); + target.writeInt( array.length ); for ( short arrayValue : array ) { - dataOutput.writeShort( arrayValue ); + target.writeShort( arrayValue ); } } else { Short[] array = (Short[]) value; - dataOutput.writeInt( array.length ); + target.writeInt( array.length ); for ( short arrayValue : array ) { - dataOutput.writeShort( arrayValue ); + target.writeShort( arrayValue ); } } } @Override @SuppressWarnings( "unchecked" ) - public <V> V unmarshall( PropertyDescriptor propertyDescriptor, DataInput dataInput, + public <V> V unmarshall( PropertyDescriptor propertyDescriptor, Source source, SerializationContext serializationContext ) throws IOException { - if ( isNull( dataInput ) ) + if ( isNull( source ) ) { return null; } - int size = dataInput.readInt(); + int size = source.readInt(); if ( short[].class == propertyDescriptor.getType() ) { short[] array = new short[size]; for ( int i = 0; i < size; i++ ) { - array[i] = dataInput.readShort(); + array[i] = source.readShort(); } return (V) array; @@ -96,7 +96,7 @@ public class ShortArrayMarshaller Short[] array = new Short[size]; for ( int i = 0; i < size; i++ ) { - array[i] = dataInput.readShort(); + array[i] = source.readShort(); } return (V) array; Modified: directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/ShortMarshaller.java URL: http://svn.apache.org/viewvc/directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/ShortMarshaller.java?rev=1405125&r1=1405124&r2=1405125&view=diff ============================================================================== --- directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/ShortMarshaller.java (original) +++ directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/ShortMarshaller.java Fri Nov 2 19:46:14 2012 @@ -18,11 +18,11 @@ */ package org.apache.directmemory.lightning.internal.marshaller; -import java.io.DataInput; -import java.io.DataOutput; import java.io.IOException; import org.apache.directmemory.lightning.SerializationContext; +import org.apache.directmemory.lightning.Source; +import org.apache.directmemory.lightning.Target; import org.apache.directmemory.lightning.base.AbstractMarshaller; import org.apache.directmemory.lightning.metadata.PropertyDescriptor; @@ -37,36 +37,36 @@ public class ShortMarshaller } @Override - public void marshall( Object value, PropertyDescriptor propertyDescriptor, DataOutput dataOutput, + public void marshall( Object value, PropertyDescriptor propertyDescriptor, Target target, SerializationContext serializationContext ) throws IOException { if ( Short.class == propertyDescriptor.getType() ) { - if ( !writePossibleNull( value, dataOutput ) ) + if ( !writePossibleNull( value, target ) ) { return; } } - dataOutput.writeShort( (Short) value ); + target.writeShort( (Short) value ); } @Override @SuppressWarnings( "unchecked" ) - public <V> V unmarshall( PropertyDescriptor propertyDescriptor, DataInput dataInput, + public <V> V unmarshall( PropertyDescriptor propertyDescriptor, Source source, SerializationContext serializationContext ) throws IOException { if ( Short.class == propertyDescriptor.getType() ) { - if ( isNull( dataInput ) ) + if ( isNull( source ) ) { return null; } } - return (V) Short.valueOf( dataInput.readShort() ); + return (V) Short.valueOf( source.readShort() ); } } Modified: directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/StreamedMarshaller.java URL: http://svn.apache.org/viewvc/directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/StreamedMarshaller.java?rev=1405125&r1=1405124&r2=1405125&view=diff ============================================================================== --- directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/StreamedMarshaller.java (original) +++ directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/StreamedMarshaller.java Fri Nov 2 19:46:14 2012 @@ -18,12 +18,12 @@ */ package org.apache.directmemory.lightning.internal.marshaller; -import java.io.DataInput; -import java.io.DataOutput; import java.io.IOException; import org.apache.directmemory.lightning.SerializationContext; +import org.apache.directmemory.lightning.Source; import org.apache.directmemory.lightning.Streamed; +import org.apache.directmemory.lightning.Target; import org.apache.directmemory.lightning.base.AbstractObjectMarshaller; import org.apache.directmemory.lightning.metadata.PropertyDescriptor; @@ -38,20 +38,20 @@ public class StreamedMarshaller } @Override - public void marshall( Object value, PropertyDescriptor propertyDescriptor, DataOutput dataOutput, + public void marshall( Object value, PropertyDescriptor propertyDescriptor, Target target, SerializationContext serializationContext ) throws IOException { - ( (Streamed) value ).writeTo( dataOutput ); + ( (Streamed) value ).writeTo( target ); } @Override - public <V> V unmarshall( V value, PropertyDescriptor propertyDescriptor, DataInput dataInput, + public <V> V unmarshall( V value, PropertyDescriptor propertyDescriptor, Source source, SerializationContext serializationContext ) throws IOException { - ( (Streamed) value ).readFrom( dataInput ); + ( (Streamed) value ).readFrom( source ); return value; } } Modified: directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/StringMarshaller.java URL: http://svn.apache.org/viewvc/directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/StringMarshaller.java?rev=1405125&r1=1405124&r2=1405125&view=diff ============================================================================== --- directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/StringMarshaller.java (original) +++ directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/StringMarshaller.java Fri Nov 2 19:46:14 2012 @@ -18,11 +18,11 @@ */ package org.apache.directmemory.lightning.internal.marshaller; -import java.io.DataInput; -import java.io.DataOutput; import java.io.IOException; import org.apache.directmemory.lightning.SerializationContext; +import org.apache.directmemory.lightning.Source; +import org.apache.directmemory.lightning.Target; import org.apache.directmemory.lightning.base.AbstractMarshaller; import org.apache.directmemory.lightning.metadata.PropertyDescriptor; @@ -37,30 +37,30 @@ public class StringMarshaller } @Override - public void marshall( Object value, PropertyDescriptor propertyDescriptor, DataOutput dataOutput, + public void marshall( Object value, PropertyDescriptor propertyDescriptor, Target target, SerializationContext serializationContext ) throws IOException { - if ( !writePossibleNull( value, dataOutput ) ) + if ( !writePossibleNull( value, target ) ) { return; } - dataOutput.writeUTF( (String) value ); + target.writeString( (String) value ); } @Override @SuppressWarnings( "unchecked" ) - public <V> V unmarshall( PropertyDescriptor propertyDescriptor, DataInput dataInput, + public <V> V unmarshall( PropertyDescriptor propertyDescriptor, Source source, SerializationContext serializationContext ) throws IOException { - if ( isNull( dataInput ) ) + if ( isNull( source ) ) { return null; } - return (V) dataInput.readUTF(); + return (V) source.readString(); } } Modified: directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/io/ByteBufferSource.java URL: http://svn.apache.org/viewvc/directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/io/ByteBufferSource.java?rev=1405125&r1=1405124&r2=1405125&view=diff ============================================================================== --- directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/io/ByteBufferSource.java (original) +++ directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/io/ByteBufferSource.java Fri Nov 2 19:46:14 2012 @@ -30,6 +30,13 @@ public class ByteBufferSource } @Override + public boolean readBoolean() + throws IOException + { + return readByte() == 1 ? true : false; + } + + @Override public int readBytes( byte[] bytes ) throws IOException { Modified: directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/io/ByteBufferTarget.java URL: http://svn.apache.org/viewvc/directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/io/ByteBufferTarget.java?rev=1405125&r1=1405124&r2=1405125&view=diff ============================================================================== --- directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/io/ByteBufferTarget.java (original) +++ directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/io/ByteBufferTarget.java Fri Nov 2 19:46:14 2012 @@ -30,6 +30,13 @@ public class ByteBufferTarget } @Override + public void writeBoolean( boolean value ) + throws IOException + { + writeByte( (byte) ( value ? 1 : 0 ) ); + } + + @Override public void writeBytes( byte[] bytes ) throws IOException { Modified: directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/io/InputStreamSource.java URL: http://svn.apache.org/viewvc/directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/io/InputStreamSource.java?rev=1405125&r1=1405124&r2=1405125&view=diff ============================================================================== --- directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/io/InputStreamSource.java (original) +++ directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/io/InputStreamSource.java Fri Nov 2 19:46:14 2012 @@ -64,6 +64,13 @@ public class InputStreamSource } @Override + public boolean readBoolean() + throws IOException + { + return readByte() == 1 ? true : false; + } + + @Override public int readBytes( byte[] bytes ) throws IOException { @@ -88,7 +95,7 @@ public class InputStreamSource public short readUnsignedByte() throws IOException { - return (short) ( readByte() & 0xFF ); + return (short) ( readByte() & 0xFF ); } @Override Modified: directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/io/OutputStreamTarget.java URL: http://svn.apache.org/viewvc/directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/io/OutputStreamTarget.java?rev=1405125&r1=1405124&r2=1405125&view=diff ============================================================================== --- directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/io/OutputStreamTarget.java (original) +++ directmemory/lightning/trunk/lightning-core/src/main/java/org/apache/directmemory/lightning/io/OutputStreamTarget.java Fri Nov 2 19:46:14 2012 @@ -41,6 +41,13 @@ public class OutputStreamTarget } @Override + public void writeBoolean( boolean value ) + throws IOException + { + writeByte( (byte) ( value ? 1 : 0 ) ); + } + + @Override public void writeBytes( byte[] bytes ) throws IOException {
