12-13-2012 05:45 AM
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:12-17-2012 06:20 AM
//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();
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.