Package org.apache.chemistry.opencmis.commons.impl.dataobjects

Examples of org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl


        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        serializer.serialize(baos, documentMGraph, SupportedFormat.RDF_XML);
        byte[] serializedGraph = baos.toByteArray();
        InputStream stream = new ByteArrayInputStream(baos.toByteArray());
        BigInteger length = new BigInteger(serializedGraph.length + "");
        ContentStream contentStream = new ContentStreamImpl(documentName, length, DOCUMENT_RDF_MIME_TYPE,
                stream);
        return contentStream;
    }
View Full Code Here


 
    // content
    String contentString = "CMIS Testdata "+name;
    byte[] content = contentString.getBytes();
    InputStream stream = new ByteArrayInputStream(content);
    ContentStream contentStream = new ContentStreamImpl(name, new BigInteger(content), "text/plain", stream);
 
    // create a major version
    folder.createDocument(contentProperties, contentStream, null);
    stream.close();
  }
View Full Code Here

    String repositoryId = session.getRepositoryInfo().getId();
    Holder<String> objectIdHolder = new Holder<String>(objectId);
    Boolean overwriteFlag = true;
    byte[] newContentByteArray = newContent.getBytes();
    InputStream stream = new ByteArrayInputStream(newContentByteArray);
    ContentStream contentStream = new ContentStreamImpl(name, new BigInteger(newContentByteArray), "text/plain", stream);
    ObjectService objectService = session.getBinding().getObjectService();
    objectService.setContentStream(repositoryId, objectIdHolder, overwriteFlag, null, contentStream, null);
  }
View Full Code Here

 
    // content
    String contentString = "CMIS Testdata "+name;
    byte[] content = contentString.getBytes();
    InputStream stream = new ByteArrayInputStream(content);
    ContentStream contentStream = new ContentStreamImpl(name, new BigInteger(content), "text/plain", stream);
 
    // create a major version
    folder.createDocument(contentProperties, contentStream, null);
    stream.close();
  }
View Full Code Here

    String repositoryId = session.getRepositoryInfo().getId();
    Holder<String> objectIdHolder = new Holder<String>(objectId);
    Boolean overwriteFlag = true;
    byte[] newContentByteArray = newContent.getBytes();
    InputStream stream = new ByteArrayInputStream(newContentByteArray);
    ContentStream contentStream = new ContentStreamImpl(name, new BigInteger(newContentByteArray), "text/plain", stream);
    ObjectService objectService = session.getBinding().getObjectService();
    objectService.setContentStream(repositoryId, objectIdHolder, overwriteFlag, null, contentStream, null);
  }
View Full Code Here

    properties.put(PropertyIds.NAME, fileName);

    // content
    //byte[] content = "Hello World!".getBytes();
    ByteArrayInputStream stream = new ByteArrayInputStream(file);
    ContentStream contentStream = new ContentStreamImpl(fileName, BigInteger.valueOf(file.length), "application/pdf", stream);

    // create a major version
    Document newDoc = parent.createDocument(properties, contentStream, VersioningState.MAJOR);   
   
  }
View Full Code Here

    properties.put(PropertyIds.NAME, fileName);

    // content
    //byte[] content = "Hello World!".getBytes();
    ByteArrayInputStream stream = new ByteArrayInputStream(file);
    ContentStream contentStream = new ContentStreamImpl(fileName, BigInteger.valueOf(file.length), "application/pdf", stream);

    // create a major version
    Document newDoc = parent.createDocument(properties, contentStream, VersioningState.MAJOR);   
   
  }
View Full Code Here

 
    // content
    String contentString = "CMIS Testdata "+name;
    byte[] content = contentString.getBytes();
    InputStream stream = new ByteArrayInputStream(content);
    ContentStream contentStream = new ContentStreamImpl(name, new BigInteger(content), "text/plain", stream);
 
    // create a major version
    folder.createDocument(contentProperties, contentStream, null);
    stream.close();
  }
View Full Code Here

      objectId = result.getPropertyById("cmis:objectId").getFirstValue().toString();
    }

    byte[] newContentByteArray = newContent.getBytes();
    InputStream stream = new ByteArrayInputStream(newContentByteArray);
    ContentStream contentStream = new ContentStreamImpl(name, new BigInteger(newContentByteArray), "text/plain", stream);
    Document documentToUpdate = (Document) session.getObject(objectId);
    documentToUpdate.setContentStream(contentStream, true);
  }
View Full Code Here

 
    // content
    String contentString = "CMIS Testdata "+name;
    byte[] content = contentString.getBytes();
    InputStream stream = new ByteArrayInputStream(content);
    ContentStream contentStream = new ContentStreamImpl(name, new BigInteger(content), "text/plain", stream);
 
    // create a major version
    folder.createDocument(contentProperties, contentStream, null);
    stream.close();
  }
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl

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.