@Override public Object getDeserializedValue(Region r, RegionEntry re) { return EntryEventImpl.deserialize(this.value); }
@Override public Object getDeserializedWritableCopy(Region r, RegionEntry re) { return EntryEventImpl.deserialize(this.value); }
@Override public Object getDeserializedForReading() { Object v = this.value; if (v instanceof byte[]) { return EntryEventImpl.deserialize((byte[]) v); } else { return v; } }
public static Object deserialize(byte[] bytes) { return deserialize(bytes, null, null); }
private Object deserialize(Object serializedBytes) { Object deserializedObject = serializedBytes; if (serializedBytes instanceof byte[]) { byte[] serializedBytesCast = (byte[]) serializedBytes; // This is a debugging method so ignore all exceptions like // ClassNotFoundException try { deserializedObject = EntryEventImpl.deserialize(serializedBytesCast); } catch (Exception e) { } } return deserializedObject; } }
/** * Creates a new instance of <code>StoreAllCachedDeserializable</code>. * * Note that, in general, instances of this class should be obtained via * {@link CachedDeserializableFactory}. */ StoreAllCachedDeserializable(byte[] serializedValue) { if (serializedValue == null) { throw new NullPointerException( "value must not be null"); } this.value = serializedValue; this.objValue = EntryEventImpl.deserialize(this.value); }
@Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { this.value = DataSerializer.readByteArray(in); this.objValue = EntryEventImpl.deserialize(this.value); }
public static Object readSerializedValue(byte[] valueBytes, Version version, ByteArrayDataInput in, boolean forceDeserialize, InternalCache cache) { if (forceDeserialize) { // deserialize checking for product version change return EntryEventImpl.deserialize(valueBytes, version, in); } else { // TODO: upgrades: is there a case where GemFire values are internal // ones that need to be upgraded transparently; probably messages // being persisted (gateway events?) return CachedDeserializableFactory.create(valueBytes, cache); } }
static Object decodeAddressToObject(long ohAddress) { byte[] bytes = decodeUncompressedAddressToBytes(ohAddress); boolean isSerialized = (ohAddress & SERIALIZED_BIT) != 0; if (isSerialized) { return EntryEventImpl.deserialize(bytes); } else { return bytes; } }
@Override protected Object convertSerializedByteArrayToObject(byte[] valueInSerializedByteArray) { return EntryEventImpl.deserialize(valueInSerializedByteArray); }
@Override public Object convertSerializedByteArrayToObject(byte[] valueInSerializedByteArray) { return EntryEventImpl.deserialize(valueInSerializedByteArray); }
@Override public Object convertSerializedByteArrayToObject(byte[] valueInSerializedByteArray) { return EntryEventImpl.deserialize(valueInSerializedByteArray); }
/** * Get the deserialized value for this operation. Note that if the value is serialized this method * will attempt to deserialize it. If PDX read-serialized is set to true and the value was * serialized with PDX then this method will return a PdxInstance. * * @return the deserialized value for this operation * @throws SerializationException if deserialization of the value fails * @since Geode 1.0 */ public Object getDeserializedValue() throws SerializationException { byte[] blob = getSerializedValue(); if (blob != null) { return EntryEventImpl.deserialize(blob); } return this.value; }
/** * @see CachedDeserializable#getDeserializedValue(Region, RegionEntry) */ @Override public Object getDeserializedValue(Region r, RegionEntry re) { return EntryEventImpl.deserialize(getCompressor().decompress(this.value)); }
@Override public Object getDeserializedValue(Region r, RegionEntry re) { if (isSerialized()) { return EntryEventImpl.deserialize(getRawBytes()); } else { return getRawBytes(); } }
@Override public Object getDeserializedWritableCopy(Region r, RegionEntry re) { Object v = this.value; if (v instanceof byte[]) { Object result = EntryEventImpl.deserialize((byte[]) v); if (CopyHelper.isWellKnownImmutableInstance(result) && !(result instanceof PdxInstance)) { // Since it is immutable go ahead and change the form // since we can return the immutable instance each time. result = getDeserializedValue(r, re); } return result; } else { return CopyHelper.copy(v); } }
private Object deserializeKey(byte[] keyBytes, final Version version, final ByteArrayDataInput in) { if (!getParent().isOffline() || !PdxWriterImpl.isPdx(keyBytes)) { return EntryEventImpl.deserialize(keyBytes, version, in); } else { return new RawByteKey(keyBytes); } }
/** * This method determines if the value is in a compressed representation and decompresses it if it * is. * * @param context the values context. * @param value a region entry value. * * @return the decompressed form of the value parameter. */ static Object decompress(RegionEntryContext context, Object value) { if (isCompressible(context, value)) { long time = context.getCachePerfStats().startDecompression(); value = EntryEventImpl.deserialize(context.getCompressor().decompress((byte[]) value)); context.getCachePerfStats().endDecompression(time); } return value; }
boolean bridgePutIfAbsentResultHasSameValue(byte[] valueToBePut, boolean isValueToBePutObject, Object result) { if (Token.isInvalid(result) || result == null) { return valueToBePut == null; } boolean isCompressedOffHeap = getAttributes().getOffHeap() && getAttributes().getCompressor() != null; if (isValueToBePutObject) { return ValueComparisonHelper.checkEquals(EntryEventImpl.deserialize(valueToBePut), result, isCompressedOffHeap, getCache()); } return ValueComparisonHelper.checkEquals(valueToBePut, result, isCompressedOffHeap, getCache()); }
@Override public Object postProcess(Object principal, final String regionPath, final Object key, final Object value, final boolean valueIsSerialized) { if (!needPostProcess()) { return value; } if (principal == null) { principal = getSubject().getPrincipal(); } String regionName = StringUtils.stripStart(regionPath, "/"); Object newValue; // if the data is a byte array, but the data itself is supposed to be an object, we need to // deserialize it before we pass it to the callback. if (valueIsSerialized && value instanceof byte[]) { try { Object oldObj = EntryEventImpl.deserialize((byte[]) value); Object newObj = this.postProcessor.processRegionValue(principal, regionName, key, oldObj); newValue = BlobHelper.serializeToBlob(newObj); } catch (IOException | SerializationException e) { throw new GemFireIOException("Exception de/serializing entry value", e); } } else { newValue = this.postProcessor.processRegionValue(principal, regionName, key, value); } return newValue; }