@Override
    public void close() {
        if (closed) {
            throw new DataException("Target already closed");
        }

        try {
            if (!deleted) {
                // If we get error on closing the stream we must return it to the caller
                IOException streamCloseException = null;

                // Close the stream target.
                try {
                    if (outputStream != null) {
                        outputStream.close();
                    }

                    // Close off any open kids .... closing the parent
                    // closes kids (the caller can also close the kid off if they like).
                    childMap.forEach((k, v) -> v.close());
                    childMap.clear();
                } catch (final ClosedByInterruptException e) {
                    // WE expect these exceptions if a user is trying to terminate.
                    LOGGER.debug(() -> "closeStreamTarget() - Error on closing stream " + this, e);
                    streamCloseException = e;
                } catch (final IOException e) {
                    LOGGER.error(() -> "closeStreamTarget() - Error on closing stream " + this, e);
                    streamCloseException = e;
                }

                // Only write meta for the root target.
                if (parent == null) {
                    // Update attributes and write the manifest.
                    updateAttribute(this, MetaFields.RAW_SIZE, String.valueOf(getStreamSize()));
                    updateAttribute(this, MetaFields.FILE_SIZE, String.valueOf(getTotalFileSize()));
                    writeManifest();

                    if (streamCloseException == null) {
                        // Unlock will update the meta data so set it back on the stream
                        // target so the client has the up to date copy
                        unlock(getMeta(), getAttributes());
                    } else {
                        throw new UncheckedIOException(streamCloseException);
                    }
                }
            }
        } finally {
            closed = true;
        }
    }
Creates a new file system stream target.

@return A new file system target.
stroom-data/stroom-data-store-impl-fs/src/main/java/stroom/data/store/impl/fs/FsTarget.java