Class CompressedMarshObjectConvertor
java.lang.Object
com.j_spaces.kernel.pool.Resource
com.gigaspaces.internal.io.CompressedMarshObjectConvertor
- All Implemented Interfaces:
IMarshObjectConvertor, MarshObjectConvertorResource, IMemoryAwareResource, IResource
public class CompressedMarshObjectConvertor
extends Resource
implements MarshObjectConvertorResource
Notice! this implementation is not Thread safe and should be use in conjunction with
ResourcePool only.- Since:
- 4.1
- Author:
- Guy Korland
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class -
Constructor Summary
ConstructorsConstructorDescriptionCompressedMarshObjectConvertor(int level) CompressedMarshObjectConvertor(int level, IMemoryAwareResourcePool resourcePool) CompressedMarshObjectConvertor(int level, IMemoryAwareResourcePool resourcePool, ObjectInputStreamFactory objectInputStreamFactory, boolean idempotent) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Cleans the resource of its contents so it can be returned to the pool.fromBinary(byte[] data) protected ObjectInputStreamprotected ObjectOutputStreamlongprotected byte[]byte[]Methods inherited from class Resource
acquire, isAcquired, isFromPool, release, setAcquired, setFromPoolMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IResource
acquire, isAcquired, isFromPool, release, setAcquired, setFromPool
-
Constructor Details
-
CompressedMarshObjectConvertor
public CompressedMarshObjectConvertor(int level) - Parameters:
level- the compression level (0-9), The default setting is DEFAULT_COMPRESSION.- Throws:
IllegalArgumentException- if the compression level is invalid
-
CompressedMarshObjectConvertor
-
CompressedMarshObjectConvertor
public CompressedMarshObjectConvertor(int level, IMemoryAwareResourcePool resourcePool, ObjectInputStreamFactory objectInputStreamFactory, boolean idempotent)
-
-
Method Details
-
serializeToByteArray
- Throws:
IOException
-
toBinary
- Specified by:
toBinaryin interfaceIMarshObjectConvertor- Throws:
IOException
-
fromBinary
- Specified by:
fromBinaryin interfaceIMarshObjectConvertor- Throws:
IOExceptionClassNotFoundException
-
getObjectOutputStream
- Throws:
IOException
-
getObjectInputStream
- Throws:
IOException
-
clear
public void clear()Description copied from interface:IResourceCleans the resource of its contents so it can be returned to the pool.You may use the
IResource.isFromPool()indication to decide of a special action before returning a resource to the pool, or discard any actions on resources not returning to the pool. -
getFactory
-
getUsedMemory
public long getUsedMemory()- Specified by:
getUsedMemoryin interfaceIMemoryAwareResource
-