// create the file
try {
newFile.createNewFile();
} catch (IOException e) {
throw new CmisStorageException("Could not create file: " + e.getMessage());
}
// write content, if available
if ((contentStream != null) && (contentStream.getStream() != null)) {
try {
OutputStream out = new BufferedOutputStream(new FileOutputStream(newFile), BUFFER_SIZE);
InputStream in = new BufferedInputStream(contentStream.getStream(), BUFFER_SIZE);
byte[] buffer = new byte[BUFFER_SIZE];
int b;
while ((b = in.read(buffer)) > -1) {
out.write(buffer, 0, b);
}
out.flush();
out.close();
in.close();
} catch (Exception e) {
throw new CmisStorageException("Could not write content: " + e.getMessage(), e);
}
}
// write properties
writePropertiesFile(newFile, props);