Search in sources :

Example 6 with ByteArraySizedInputStream

use of jetbrains.exodus.util.ByteArraySizedInputStream in project xodus by JetBrains.

the class PersistentEntityStoreImpl method setBlob.

public void setBlob(@NotNull final PersistentStoreTransaction txn, @NotNull final PersistentEntity entity, @NotNull final String blobName, @NotNull final InputStream stream) throws IOException {
    final ByteArraySizedInputStream copy = stream instanceof ByteArraySizedInputStream ? (ByteArraySizedInputStream) stream : blobVault.cloneStream(stream, true);
    final long blobHandle = createBlobHandle(txn, entity, blobName, copy, copy.size());
    if (!isEmptyOrInPlaceBlobHandle(blobHandle)) {
        setBlobFileLength(txn, blobHandle, copy.size());
        txn.addBlob(blobHandle, copy);
    }
}
Also used : ByteArraySizedInputStream(jetbrains.exodus.util.ByteArraySizedInputStream)

Example 7 with ByteArraySizedInputStream

use of jetbrains.exodus.util.ByteArraySizedInputStream in project xodus by JetBrains.

the class PropertyTypes method entryToPropertyValue.

public PropertyValue entryToPropertyValue(@NotNull final ByteIterable entry, @Nullable ComparableBinding binding) {
    final byte[] bytes = entry.getBytesUnsafe();
    final ComparableValueType type = getPropertyType((byte) (bytes[0] ^ 0x80));
    if (binding == null) {
        binding = type.getBinding();
    }
    final Comparable data = binding.readObject(new ByteArraySizedInputStream(bytes, 1, entry.getLength() - 1));
    return new PropertyValue(type, data);
}
Also used : ByteArraySizedInputStream(jetbrains.exodus.util.ByteArraySizedInputStream) ComparableValueType(jetbrains.exodus.bindings.ComparableValueType)

Aggregations

ByteArraySizedInputStream (jetbrains.exodus.util.ByteArraySizedInputStream)7 CompressedUnsignedLongByteIterable (jetbrains.exodus.log.CompressedUnsignedLongByteIterable)2 LightByteArrayOutputStream (jetbrains.exodus.util.LightByteArrayOutputStream)2 Nullable (org.jetbrains.annotations.Nullable)2 ComparableValueType (jetbrains.exodus.bindings.ComparableValueType)1 Pair (jetbrains.exodus.core.dataStructures.Pair)1