private K deserializeKey(final byte[] serializedKey) { if (encryption == null) { return keySerializer.deserializeNativeObject(serializedKey, 0); } final byte[] decrypted = encryption .decrypt(serializedKey, OIntegerSerializer.INT_SIZE, serializedKey.length - OIntegerSerializer.INT_SIZE); return keySerializer.deserializeNativeObject(decrypted, 0); }
public T deserializeNativeObject(byte[] stream, int startPosition) { final byte typeId = stream[startPosition]; startPosition += OBinarySerializerFactory.TYPE_IDENTIFIER_SIZE; init(typeId); return (T) binarySerializer.deserializeNativeObject(stream, startPosition); }
public K getKey(int index) { int entryPosition = getIntValue(POSITIONS_ARRAY_OFFSET + index * OIntegerSerializer.INT_SIZE); if (encryption == null) { return deserializeFromDirectMemory(keySerializer, entryPosition + OLongSerializer.LONG_SIZE); } else { final int encryptedLength = getIntValue(entryPosition + OLongSerializer.LONG_SIZE); final byte[] encryptedBinaryKey = getBinaryValue(entryPosition + OLongSerializer.LONG_SIZE + OIntegerSerializer.INT_SIZE, encryptedLength); final byte[] decryptedBinaryKey = encryption.decrypt(encryptedBinaryKey); return keySerializer.deserializeNativeObject(decryptedBinaryKey, 0); } }
public K getKey(int index) { int entryPosition = getIntValue(index * OIntegerSerializer.INT_SIZE + POSITIONS_ARRAY_OFFSET); if (!isLeaf) entryPosition += 2 * OLongSerializer.LONG_SIZE; if (encryption == null) { return deserializeFromDirectMemory(keySerializer, entryPosition); } else { final int encryptedSize = getIntValue(entryPosition); entryPosition += OIntegerSerializer.INT_SIZE; final byte[] encryptedKey = getBinaryValue(entryPosition, encryptedSize); final byte[] serializedKey = encryption.decrypt(encryptedKey); return keySerializer.deserializeNativeObject(serializedKey, 0); } }
public K getKey(final int index) { int entryPosition = getIntValue(index * OIntegerSerializer.INT_SIZE + POSITIONS_ARRAY_OFFSET); if (!isLeaf) { entryPosition += 2 * OIntegerSerializer.INT_SIZE; } else { entryPosition += OIntegerSerializer.INT_SIZE; } if (encryption == null) { return deserializeFromDirectMemory(keySerializer, entryPosition); } else { final int encryptedSize = getIntValue(entryPosition); entryPosition += OIntegerSerializer.INT_SIZE; final byte[] encryptedKey = getBinaryValue(entryPosition, encryptedSize); final byte[] serializedKey = encryption.decrypt(encryptedKey); return keySerializer.deserializeNativeObject(serializedKey, 0); } }
String getKeyWithoutPrefix(int index) { int entryPosition = getIntValue(index * OIntegerSerializer.INT_SIZE + positionsArrayOffset); if (!isLeaf) { entryPosition += 2 * OIntegerSerializer.INT_SIZE; } if (encryption == null) { return deserializeFromDirectMemory(keySerializer, entryPosition); } else { final int encryptedSize = getIntValue(entryPosition); entryPosition += OIntegerSerializer.INT_SIZE; final byte[] encryptedKey = getBinaryValue(entryPosition, encryptedSize); final byte[] serializedKey = encryption.decrypt(encryptedKey); return keySerializer.deserializeNativeObject(serializedKey, 0); } }
public K getKey(final int index) { int entryPosition = getIntValue(index * OIntegerSerializer.INT_SIZE + POSITIONS_ARRAY_OFFSET); if (!isLeaf) { entryPosition += 2 * OIntegerSerializer.INT_SIZE; } if (encryption == null) { return deserializeFromDirectMemory(keySerializer, entryPosition); } else { final int encryptedSize = getIntValue(entryPosition); entryPosition += OIntegerSerializer.INT_SIZE; final byte[] encryptedKey = getBinaryValue(entryPosition, encryptedSize); final byte[] serializedKey = encryption.decrypt(encryptedKey); return keySerializer.deserializeNativeObject(serializedKey, 0); } }
@SuppressFBWarnings("EI_EXPOSE_REP2") public OPrefixBTreeBucket(OCacheEntry cacheEntry, OBinarySerializer<String> keySerializer, OBinarySerializer<V> valueSerializer, OEncryption encryption) { super(cacheEntry); this.encryption = encryption; final int commonPrefixSize; if (encryption == null) { commonPrefixSize = getObjectSizeInDirectMemory(keySerializer, BUCKET_PREFIX_OFFSET); bucketPrefix = deserializeFromDirectMemory(keySerializer, BUCKET_PREFIX_OFFSET); } else { final int encryptedSize = getIntValue(BUCKET_PREFIX_OFFSET); final byte[] encryptedKey = getBinaryValue(BUCKET_PREFIX_OFFSET + OIntegerSerializer.INT_SIZE, encryptedSize); final byte[] serializedPrefix = encryption.decrypt(encryptedKey); bucketPrefix = keySerializer.deserializeNativeObject(serializedPrefix, 0); commonPrefixSize = encryptedSize + OIntegerSerializer.INT_SIZE; } calculateOffsets(commonPrefixSize); this.isLeaf = getByteValue(isLeafOffset) > 0; this.keySerializer = keySerializer; this.valueSerializer = valueSerializer; }
public OCompositeKey deserializeNativeObject(byte[] stream, int startPosition) { final OCompositeKey compositeKey = new OCompositeKey(); startPosition += OIntegerSerializer.INT_SIZE; final int keysSize = OIntegerSerializer.INSTANCE.deserializeNative(stream, startPosition); startPosition += OIntegerSerializer.INSTANCE.getObjectSize(keysSize); final OBinarySerializerFactory factory = OBinarySerializerFactory.getInstance(); for (int i = 0; i < keysSize; i++) { final byte serializerId = stream[startPosition]; startPosition += OBinarySerializerFactory.TYPE_IDENTIFIER_SIZE; @SuppressWarnings("unchecked") OBinarySerializer<Object> binarySerializer = (OBinarySerializer<Object>) factory.getObjectSerializer(serializerId); final Object key = binarySerializer.deserializeNativeObject(stream, startPosition); compositeKey.addKey(key); startPosition += binarySerializer.getObjectSize(key); } return compositeKey; }
public Entry<K, V> getEntry(int index) { int entryPosition = getIntValue(POSITIONS_ARRAY_OFFSET + index * OIntegerSerializer.INT_SIZE); final long hashCode = getLongValue(entryPosition); entryPosition += OLongSerializer.LONG_SIZE; final K key; if (encryption == null) { key = deserializeFromDirectMemory(keySerializer, entryPosition); entryPosition += getObjectSizeInDirectMemory(keySerializer, entryPosition); } else { final int encryptedLength = getIntValue(entryPosition); entryPosition += OIntegerSerializer.INT_SIZE; final byte[] encryptedKey = getBinaryValue(entryPosition, encryptedLength); entryPosition += encryptedLength; final byte[] binaryKey = encryption.decrypt(encryptedKey); key = keySerializer.deserializeNativeObject(binaryKey, 0); } final V value = deserializeFromDirectMemory(valueSerializer, entryPosition); return new Entry<K, V>(key, value, hashCode); }
removedValue = valueSerializer.deserializeNativeObject(removeKey(atomicOperation, bucketSearchResult), 0); } else { if (getFilledUpTo(atomicOperation, nullBucketFileId) == 0) {
key = keySerializer.deserializeNativeObject(serializedKey, 0); key = keySerializer.deserializeNativeObject(serializedKey, 0);
key = keySerializer.deserializeNativeObject(serializedKey, 0); key = keySerializer.deserializeNativeObject(serializedKey, 0);
private V readValue(final OSBTreeValue<V> sbTreeValue, final OAtomicOperation atomicOperation) throws IOException { if (!sbTreeValue.isLink()) { return sbTreeValue.getValue(); } OCacheEntry cacheEntry = loadPageForRead(atomicOperation, fileId, sbTreeValue.getLink(), false); OSBTreeValuePage valuePage = new OSBTreeValuePage(cacheEntry, false); final int totalSize = valuePage.getSize(); int currentSize = 0; final byte[] value = new byte[totalSize]; while (currentSize < totalSize) { currentSize = valuePage.readBinaryContent(value, currentSize); final long nextPage = valuePage.getNextPage(); if (nextPage >= 0) { releasePageFromRead(atomicOperation, cacheEntry); cacheEntry = loadPageForRead(atomicOperation, fileId, nextPage, false); valuePage = new OSBTreeValuePage(cacheEntry, false); } } releasePageFromRead(atomicOperation, cacheEntry); return valueSerializer.deserializeNativeObject(value, 0); }
key = keySerializer.deserializeNativeObject(serializedKey, 0); key = keySerializer.deserializeNativeObject(serializedKey, 0);
oldValue = null; } else { oldValue = valueSerializer.deserializeNativeObject(oldRawValue, 0);