Package org.apache.jackrabbit.oak.commons.mk

Examples of org.apache.jackrabbit.oak.commons.mk.MicroKernelInputStream


            }
           
            OutputStream out = response.getOutputStream();
            if (pos == 0L && length == -1) {
                /* return the complete binary */
                InputStream in = new MicroKernelInputStream(mk, blobId);
                IOUtils.copy(in, out);
            } else {
                /* return some range */
                byte[] buff = new byte[length];
                int count = mk.read(blobId, pos, buff, 0, length);
View Full Code Here


        assertEquals(mk.getLength(id), size);

        // verify data
        InputStream in1 = new TestInputStream(size);
        InputStream in2 = new BufferedInputStream(
                new MicroKernelInputStream(mk, id), bufferSize);
        try {
            while (true) {
                int x = in1.read();
                int y = in2.read();
                if (x == -1 || y == -1) {
View Full Code Here

    }

    @Nonnull
    @Override
    public InputStream getNewStream() {
        return new MicroKernelInputStream(kernel, binaryID);
    }
View Full Code Here

            }
        }
    }

    private void doTestRead(byte[] expectedData, int expectedLen, String id) throws IOException {
        InputStream in = new MicroKernelInputStream(mk, id);
        Random r = new Random(1);
        ByteArrayOutputStream buff = new ByteArrayOutputStream();
        int minLen = 0;
        if (expectedLen > 1000000) {
            minLen = 4000;
        }
        while (true) {
            int op = r.nextInt(3);
            if (op == 0) {
                int x = in.read();
                if (x < 0) {
                    break;
                }
                buff.write(x);
            } else if (op == 1) {
                byte[] x = new byte[minLen + r.nextInt(5000)];
                int l = in.read(x);
                if (l < 0) {
                    break;
                }
                buff.write(x, 0, l);
            } else {
                int offset = r.nextInt(10);
                int len = minLen + r.nextInt(1000);
                byte[] x = new byte[offset + len];
                int l = in.read(x, offset, len);
                if (l < 0) {
                    break;
                }
                buff.write(x, offset, l);
            }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.commons.mk.MicroKernelInputStream

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.