InputStream inpStr = new FileInputStream("c:/Log.txt");
byte[] bytes = ContentUtils.convertToByteArray(inpStr);
System.out.println("Dati:" + bytes);
ContentFormat contentFormat = new ContentFormat("text/plain", "UTF-8");
WebServiceFactory.getContentService().write(content, Constants.PROP_CONTENT, bytes, contentFormat);
System.out.println("Caricamento eseguito");
Mi segnala questo errore eclipse:
//Creazione effettiva del nodo
UpdateResult[] result = WebServiceFactory.getRepositoryService().update(cml);
Reference content = result[0].getDestination();
//Scrittura del contenuto
ContentFormat contentFormat = new ContentFormat(this.mimeType(fileName), "UTF-8");
Content contentRef = contentService.write(content, Constants.PROP_CONTENT, readFromFile(new File(percorsoFile + fileName)), contentFormat);
System.out.println("File caricato: " + fileName);
private static byte[] readFromFile(File file) throws Exception
{
BufferedInputStream br = new BufferedInputStream(new FileInputStream(file));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int b;
while ((b = br.read()) > -1) {
baos.write(b);
}
return baos.toByteArray();
}
Archive content from product discussions in Italian.
This group is now closed and content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.