@Override
    public OutputStream getOutputStream() {
        if (outputStream == null) {
            try {
                // Get the file.
                file = getFile();

                // Make sure the parent path exists.
                if (!FileSystemUtil.mkdirs(volumePath, file.getParent())) {
                    // Unable to create path
                    throw new DataException("Unable to create directory for file " + file);
                }

                // If the file already exists then delete it.
                if (Files.exists(file)) {
                    LOGGER.warn(() -> "About to overwrite file: " + FileUtil.getCanonicalPath(file));
                    if (!FileSystemUtil.deleteAnyPath(file)) {
                        LOGGER.error(() -> "getOutputStream() - Unable to delete existing files for new stream target");
                        throw new DataException("Unable to delete existing files for new stream target " + file);
                    }
                }

                outputStream = fileSystemStreamPathHelper.getOutputStream(streamType, file);
            } catch (final IOException ioEx) {
                LOGGER.error(() -> "getOutputStream() - " + ioEx.getMessage());
                // No reason to get a IO on opening the out stream .... fail in
                // a heap
                throw new DataException(ioEx);
            }
        }
        return outputStream;
    }
Gets the output stream for this stream target.
stroom-data/stroom-data-store-impl-fs/src/main/java/stroom/data/store/impl/fs/FsTarget.java