org.jboss.cache.marshall
Class CacheMarshaller210

java.lang.Object
  extended by org.jboss.cache.marshall.AbstractMarshaller
      extended by org.jboss.cache.marshall.CacheMarshaller200
          extended by org.jboss.cache.marshall.CacheMarshaller210
All Implemented Interfaces:
Marshaller, org.jgroups.blocks.RpcDispatcher.Marshaller, org.jgroups.blocks.RpcDispatcher.Marshaller2
Direct Known Subclasses:
CacheMarshaller300

public class CacheMarshaller210
extends CacheMarshaller200

An evolution of CacheMarshaller200, created to fix JBCACHE-1211.

To prevent ints taking too much space, they are written as variable-length ints. Details here on VInts.

Since:
2.1.0
Author:
Manik Surtani
See Also:
VInt, VLong

Field Summary
 
Fields inherited from class org.jboss.cache.marshall.CacheMarshaller200
commandsFactory, IRE, MAGICNUMBER_ARRAY, MAGICNUMBER_ARRAY_LIST, MAGICNUMBER_BOOLEAN, MAGICNUMBER_BYTE, MAGICNUMBER_CHAR, MAGICNUMBER_DEFAULT_DATA_VERSION, MAGICNUMBER_DOUBLE, MAGICNUMBER_EXTENDED_RESPONSE, MAGICNUMBER_FASTCOPY_HASHMAP, MAGICNUMBER_FLOAT, MAGICNUMBER_FQN, MAGICNUMBER_GRAVITATERESULT, MAGICNUMBER_GTX, MAGICNUMBER_HASH_MAP, MAGICNUMBER_HASH_SET, MAGICNUMBER_IMMUTABLE_MAPCOPY, MAGICNUMBER_INTEGER, MAGICNUMBER_IPADDRESS, MAGICNUMBER_LINKED_LIST, MAGICNUMBER_LONG, MAGICNUMBER_MARSHALLEDVALUE, MAGICNUMBER_METHODCALL, MAGICNUMBER_NODEDATA, MAGICNUMBER_NODEDATA_EXCEPTION_MARKER, MAGICNUMBER_NODEDATA_MARKER, MAGICNUMBER_NULL, MAGICNUMBER_OBJECT, MAGICNUMBER_REF, MAGICNUMBER_REQUEST_IGNORED_RESPONSE, MAGICNUMBER_SERIALIZABLE, MAGICNUMBER_SHORT, MAGICNUMBER_STRING, MAGICNUMBER_TREE_MAP, MAGICNUMBER_TREE_SET, MAGICNUMBER_TXLOG_ENTRY
 
Fields inherited from class org.jboss.cache.marshall.AbstractMarshaller
configuration, defaultClassLoader, defaultInactive, log, regionManager, trace, useRefs, useRegionBasedMarshalling
 
Constructor Summary
CacheMarshaller210()
           
 
Method Summary
protected  int readReference(ObjectInputStream in)
          This version of readReference is written to solve JBCACHE-1211, where references are encoded as ints rather than shorts.
protected  int readUnsignedInt(ObjectInputStream in)
          Reads an int stored in variable-length format.
protected  long readUnsignedLong(ObjectInputStream in)
          Reads an int stored in variable-length format.
protected  void writeReference(ObjectOutputStream out, int reference)
          This version of writeReference is written to solve JBCACHE-1211, where references are encoded as ints rather than shorts.
protected  void writeUnsignedInt(ObjectOutputStream out, int i)
          Writes an int in a variable-length format.
protected  void writeUnsignedLong(ObjectOutputStream out, long i)
          Writes an int in a variable-length format.
 
Methods inherited from class org.jboss.cache.marshall.CacheMarshaller200
injectCommandsFactory, marshallDefaultDataVersion, marshallFqn, marshallObject, marshallString, objectFromObjectStream, objectFromObjectStreamRegionBased, objectToObjectStream, objectToObjectStream, regionalizedMethodCallFromObjectStream, unmarshallArray, unmarshallDefaultDataVersion, unmarshallFqn, unmarshallObject, unmarshallObject, unmarshallString
 
Methods inherited from class org.jboss.cache.marshall.AbstractMarshaller
extractFqn, init, initLogger, objectFromByteBuffer, objectFromByteBuffer, objectFromStream, objectToBuffer, objectToByteBuffer, regionalizedMethodCallFromByteBuffer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheMarshaller210

public CacheMarshaller210()
Method Detail

writeReference

protected void writeReference(ObjectOutputStream out,
                              int reference)
                       throws IOException
This version of writeReference is written to solve JBCACHE-1211, where references are encoded as ints rather than shorts.

Overrides:
writeReference in class CacheMarshaller200
Parameters:
out - stream to write to
reference - reference to write
Throws:
IOException - propagated from OOS
See Also:
JBCACHE-1211

readReference

protected int readReference(ObjectInputStream in)
                     throws IOException
This version of readReference is written to solve JBCACHE-1211, where references are encoded as ints rather than shorts.

Overrides:
readReference in class CacheMarshaller200
Parameters:
in - stream to read from
Returns:
reference
Throws:
IOException - propagated from OUS
See Also:
JBCACHE-1211

readUnsignedInt

protected int readUnsignedInt(ObjectInputStream in)
                       throws IOException
Reads an int stored in variable-length format. Reads between one and five bytes. Smaller values take fewer bytes. Negative numbers are not supported.

Overrides:
readUnsignedInt in class CacheMarshaller200
Throws:
IOException

writeUnsignedInt

protected void writeUnsignedInt(ObjectOutputStream out,
                                int i)
                         throws IOException
Writes an int in a variable-length format. Writes between one and five bytes. Smaller values take fewer bytes. Negative numbers are not supported.

Overrides:
writeUnsignedInt in class CacheMarshaller200
Parameters:
i - int to write
Throws:
IOException

readUnsignedLong

protected long readUnsignedLong(ObjectInputStream in)
                         throws IOException
Reads an int stored in variable-length format. Reads between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.

Overrides:
readUnsignedLong in class CacheMarshaller200
Throws:
IOException

writeUnsignedLong

protected void writeUnsignedLong(ObjectOutputStream out,
                                 long i)
                          throws IOException
Writes an int in a variable-length format. Writes between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.

Overrides:
writeUnsignedLong in class CacheMarshaller200
Parameters:
i - int to write
Throws:
IOException


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.