-
-
Save pryorda/14a18e9ecbd302af73903cd4e37c1e0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ubuntu@dsapi-0:/mnt/fsstore/LOGO/3b/38e/092/374/b44/7cb$ ls | |
3b38e092-374b-447c-b208-f807be406bd4 | |
ubuntu@dsapi-0:/mnt/fsstore/LOGO/3b/38e/092/374/b44/7cb$ ls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static int writeData(File storageRoot, Entity entity, String uuid, InputStream inputStream) throws IOException { | |
Preconditions.checkNotNull(inputStream); | |
File file = getDataFile(storageRoot, entity, uuid); | |
file.getParentFile().mkdirs(); | |
FileOutputStream fos = null; | |
try { | |
logger.debug("Writing data to {}", file.getAbsolutePath()); | |
fos = new FileOutputStream(file); | |
byte[] inputStreamBytes = IOUtils.toByteArray(inputStream); | |
fos.write( inputStreamBytes, 0, inputStreamBytes.length ); | |
return inputStreamBytes.length / 1024 ; | |
} finally { | |
IOUtils.closeQuietly(fos); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment