As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
contentUrl=store://2009/10/13/10/41/fb64d4a3-f652-4a45-9e3e-42cefbb585bf.bin|mimetype=text/plain|size=0|encoding=utf-8|locale=en_US_
private static void makeFile(MigrateDocument doc) throws Exception { //start session AuthenticationDetails details = startSession(getUser(), getPass()); //get contentService ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService(); //create reference to document with the uuid encapsulated in my MigrateDocument Reference ref = new Reference(getStore(), doc.getUuid(), null); //read the content Content[] readResult = contentService.read(new Predicate(new Reference[]{ref}, getStore(), null), Constants.PROP_CONTENT); for (Content content : readResult) { String[] splittedUrl = content.getUrl().split("/"); if(splittedUrl[splittedUrl.length-1].equals(doc.getName())){ //this if-clause makes sure it's the right thing to download BUT be sure to have replaced all whitespace in the filename by a '+' or the equals will return false! InputStream in = ContentUtils.getContentAsInputStream(content); BufferedInputStream bis = new BufferedInputStream(in); //find location to place the downloaded file String path = getPhysicalPaths().get(doc.getParent().getUuid()); //write FileOutputStream fos = new FileOutputStream(path + doc.getName()); BufferedOutputStream bos = new BufferedOutputStream(fos, 1024); byte data[] = new byte[1024]; int count; while((count = bis.read(data, 0, 1024)) != -1){ bos.write(data, 0, count); } bos.close(); bis.close(); } } //end session endSession(details);