Package org.apache.chemistry.opencmis.inmemory.storedobj.impl

Examples of org.apache.chemistry.opencmis.inmemory.storedobj.impl.ContentStreamDataImpl


        }
        return null;
    }
   
    private ContentStream createContent(String text) {
        ContentStreamDataImpl content = new ContentStreamDataImpl(-1);
        content.setFileName("data.txt");
        content.setMimeType("text/plain");

        try {
            content.setContent(new ByteArrayInputStream(text.getBytes()));
        } catch (IOException e) {
            throw new RuntimeException("Failed to fill content stream with data", e);
        }
        return content;
    }
View Full Code Here


    }

    @Test
    public void testCreateDocumentWithContentNoFileNameNoMimeType() {
        log.info("starting testCreateDocumentWithContent() ...");
        ContentStreamDataImpl contentStream = null;
        List<String> policies = null;
        Acl addACEs = null;
        Acl removeACEs = null;
        ExtensionsData extension = null;

        Properties props = createDocumentProperties(DOCUMENT_ID, DOCUMENT_TYPE_ID);

        contentStream = (ContentStreamDataImpl) createContent();
        contentStream.setFileName(null);
        contentStream.setMimeType(null);

        String id = null;
        try {
            id = fObjSvc.createDocument(fRepositoryId, props, fRootFolderId, contentStream, VersioningState.NONE, policies,
                    addACEs, removeACEs, extension);
View Full Code Here

       
        private boolean findText(String nodeText) {
            Content cont;
            String pattern = StringUtil.unescape(nodeText, null);
            if (so instanceof Content && (cont=(Content)so).hasContent()) {
                ContentStreamDataImpl cdi = (ContentStreamDataImpl) cont.getContent(0, -1);
                byte[] ba = cdi.getBytes();
                String text = new String(ba);
                int match = text.indexOf(pattern);
                return match >= 0;
            }
            return false;
View Full Code Here

    protected ContentStream createContent(int sizeInKB) {
        return createContent(sizeInKB, 0);
    }

    protected ContentStream createContent(int sizeInKB, long maxSizeInKB) {
        ContentStreamDataImpl content = new ContentStreamDataImpl(maxSizeInKB);
        content.setFileName("data.txt");
        content.setMimeType("text/plain");
        int len = sizeInKB * 1024;
        byte[] b = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x0c, 0x0a,
                0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x0c, 0x0a }; // 32
        int noBlocks = len / b.length;

        ByteArrayOutputStream ba = new ByteArrayOutputStream(len);
        try {
            for (int i = 0; i < noBlocks; i++) {
                ba.write(b);
            }
            content.setContent(new ByteArrayInputStream(ba.toByteArray()));
        } catch (IOException e) {
            throw new RuntimeException("Failed to fill content stream with data", e);
        }
        return content;
    }
View Full Code Here

        }
        return content;
    }

    protected ContentStream createContent(char ch) {
        ContentStreamDataImpl content = new ContentStreamDataImpl(0);
        content.setFileName("data.txt");
        content.setMimeType("text/plain");
        int len = 32 * 1024;
        byte[] b = new byte[32];
        for (int i = 0; i < 32; i++) {
            b[i] = (byte) Character.getNumericValue(ch);
        }
        ByteArrayOutputStream ba = new ByteArrayOutputStream(len);
        try {
            for (int i = 0; i < 1024; i++) {
                ba.write(b);
            }
            content.setContent(new ByteArrayInputStream(ba.toByteArray()));
        } catch (IOException e) {
            throw new RuntimeException("Failed to fill content stream with data", e);
        }
        return content;
    }
View Full Code Here

    protected ContentStream createContent(int sizeInKB) {
        return createContent(sizeInKB, 0);
    }

    protected ContentStream createContent(int sizeInKB, long maxSizeInKB) {
        ContentStreamDataImpl content = new ContentStreamDataImpl(maxSizeInKB);
        content.setFileName("data.txt");
        content.setMimeType("text/plain");
        int len = sizeInKB * 1024;
        byte[] b = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x0c, 0x0a,
                0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x0c, 0x0a }; // 32
        int noBlocks = len / b.length;

        ByteArrayOutputStream ba = new ByteArrayOutputStream(len);
        try {
            for (int i = 0; i < noBlocks; i++) {
                ba.write(b);
            }
            content.setContent(new ByteArrayInputStream(ba.toByteArray()));
        } catch (IOException e) {
            throw new RuntimeException("Failed to fill content stream with data", e);
        }
        return content;
    }
View Full Code Here

        }
        return content;
    }

    protected ContentStream createContent(char ch) {
        ContentStreamDataImpl content = new ContentStreamDataImpl(0);
        content.setFileName("data.txt");
        content.setMimeType("text/plain");
        int len = 32 * 1024;
        byte[] b = new byte[32];
        for (int i = 0; i < 32; i++) {
            b[i] = (byte) Character.getNumericValue(ch);
        }
        ByteArrayOutputStream ba = new ByteArrayOutputStream(len);
        try {
            for (int i = 0; i < 1024; i++) {
                ba.write(b);
            }
            content.setContent(new ByteArrayInputStream(ba.toByteArray()));
        } catch (IOException e) {
            throw new RuntimeException("Failed to fill content stream with data", e);
        }
        return content;
    }
View Full Code Here

    }

    @Test
    public void testCreateDocumentWithContentNoFileNameNoMimeType() {
        log.info("starting testCreateDocumentWithContent() ...");
        ContentStreamDataImpl contentStream = null;
        List<String> policies = null;
        Acl addACEs = null;
        Acl removeACEs = null;
        ExtensionsData extension = null;

        Properties props = createDocumentProperties(DOCUMENT_ID, DOCUMENT_TYPE_ID);

        contentStream = (ContentStreamDataImpl) createContent();
        contentStream.setFileName(null);
        contentStream.setMimeType(null);

        String id = null;
        try {
            id = fObjSvc.createDocument(fRepositoryId, props, fRootFolderId, contentStream, VersioningState.NONE, policies,
                    addACEs, removeACEs, extension);
View Full Code Here

       
        private boolean findText(String nodeText) {
            Content cont;
            String pattern = StringUtil.unescape(nodeText, null);
            if (so instanceof Content && (cont=(Content)so).hasContent()) {
                ContentStreamDataImpl cdi = (ContentStreamDataImpl) cont.getContent(0, -1);
                byte[] ba = cdi.getBytes();
                String text = new String(ba);
                int match = text.indexOf(pattern);
                return match >= 0;
            }
            return false;
View Full Code Here

       
        private boolean findText(String nodeText) {
            Content cont;
            String pattern = StringUtil.unescape(nodeText, null);
            if (so instanceof Content && (cont=(Content)so).hasContent()) {
                ContentStreamDataImpl cdi = (ContentStreamDataImpl) cont.getContent(0, -1);
                byte[] ba = cdi.getBytes();
                String text = new String(ba);
                int match = text.indexOf(pattern);
                return match >= 0;
            }
            return false;
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.inmemory.storedobj.impl.ContentStreamDataImpl

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.