class BasicFileStorage {

    public String writeFile(String containerName, String objectName, InputStream inputStream, long size)
        throws IOException {
        ensureContainerExists(containerName);

        String storageId = LocalFileUtils.createStorageId(objectName);
        Path filePath = getFilePath(containerName, storageId);

        try (ExtendedFileOutputStream outputStream = new ExtendedFileOutputStream(filePath, true)) {

            ExactSizeInputStream exactSizeInputStream = new ExactSizeInputStream(inputStream, size);

            IOUtils.copy(exactSizeInputStream, outputStream);

            return storageId;
        } catch (IOException ex) {
            deleteFile(containerName, storageId);
            throw ex;
        } finally {
            IOUtils.closeQuietly(inputStream);
        }
    }

    public  BasicFileStorage(String basePath);

}