Package org.apache.jackrabbit.oak.api

Examples of org.apache.jackrabbit.oak.api.Blob


                this.data = newArrayList();
            }

            this.length = data.size() * BLOB_SIZE;
            if (!data.isEmpty()) {
                Blob last = data.get(data.size() - 1);
                this.length -= BLOB_SIZE - last.length();
            }
        }
View Full Code Here


        }

        private void flushBlob() throws IOException {
            if (blobModified) {
                int n = (int) Math.min(BLOB_SIZE, length - index * BLOB_SIZE);
                Blob b = file.createBlob(new ByteArrayInputStream(blob, 0, n));
                if (index < data.size()) {
                    data.set(index, b);
                } else {
                    checkState(index == data.size());
                    data.add(b);
View Full Code Here

            throw new RepositoryException(e);
        }
    }

    private ValueImpl createBinaryValue(InputStream value) throws IOException {
        Blob blob = blobFactory.createBlob(value);
        return new ValueImpl(BinaryPropertyState.binaryProperty("", blob), namePathMapper);
    }
View Full Code Here

        if (sourceType == targetType) {
            return value;
        }
        switch (targetType) {
        case PropertyType.BINARY:
            Blob blob = value.getValue(Type.BINARY);
            return newBinary(blob);
        case PropertyType.BOOLEAN:
            return newBoolean(value.getValue(Type.BOOLEAN));
        case PropertyType.DATE:
            return newDate(value.getValue(Type.DATE));
View Full Code Here

            throw new RepositoryException(e);
        }
    }

    private ValueImpl createBinaryValue(InputStream value) throws IOException {
        Blob blob = blobFactory.createBlob(value);
        return new ValueImpl(BinaryPropertyState.binaryProperty("", blob), namePathMapper);
    }
View Full Code Here

            throws IOException {
        NodeBuilder file = addChild(node, name, JcrConstants.NT_FILE);
        NodeBuilder content = addChild(file, JcrConstants.JCR_CONTENT,
                JcrConstants.NT_RESOURCE);
        content.setProperty(JcrConstants.JCR_MIMETYPE, "text/plain");
        Blob blob = store.createBlob(new ByteArrayInputStream("Apache Oak".getBytes()));
        content.setProperty(JcrConstants.JCR_DATA, blob);
        return file;
    }
View Full Code Here

            Iterator<Blob> blobIterator = nodeStore.getReferencedBlobsIterator();
            referencedBlobs.ensureCapacity(getBatchCount());

            int referencesFound = 0;
            while (blobIterator.hasNext()) {
                Blob blob = blobIterator.next();
                if (blob.toString().length() != 0) {
                    Iterator<String> idIter = ((GarbageCollectableBlobStore) nodeStore
                            .getBlobStore())
                            .resolveChunks(blob.toString());
                    while (idIter.hasNext()) {
                        referencedBlobs.add(idIter.next());
                    }
                }
View Full Code Here

        if (sourceType == targetType) {
            return value;
        }
        switch (targetType) {
        case PropertyType.BINARY:
            Blob blob = value.getValue(Type.BINARY);
            return newBinary(blob);
        case PropertyType.BOOLEAN:
            return newBoolean(value.getValue(Type.BOOLEAN));
        case PropertyType.DATE:
            return newDate(value.getValue(Type.DATE));
View Full Code Here

        return r.id;
    }

    @Override
    public long getLength(String blobId) throws MicroKernelException {
        Blob blob = blobs.get(blobId);
        if (blob != null) {
            return blob.length();
        } else {
            throw new MicroKernelException("Blob not found: " + blobId);
        }
    }
View Full Code Here

    }

    @Override
    public int read(String blobId, long pos, byte[] buff, int off, int length)
            throws MicroKernelException {
        Blob blob = blobs.get(blobId);
        if (blob != null) {
            try {
                InputStream stream = blob.getNewStream();
                try {
                    ByteStreams.skipFully(stream, pos);
                    return stream.read(buff, off, length);
                } finally {
                    stream.close();
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.api.Blob

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.