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

            try {
                if (!deleted) {
                    // Close the stream target.
                    try {
                        if (outputStream != null) {
                            outputStream.close();
                        }
                    } catch (final IOException e) {
                        throw new DataException(e.getMessage());
                    }

                    final long streamId = meta.getId();

                    // Get the data map to add the stream output to.
                    final Map<String, byte[]> dataTypeMap = fileData.computeIfAbsent(streamId, k -> new HashMap<>());
                    final Map<String, ByteArrayOutputStream> typeMap = openOutputStream.get(streamId);

                    if (typeMap != null) {
                        // Add data from this stream to the data type map.
                        final ByteArrayOutputStream ba = typeMap.remove(streamTypeName);
                        if (ba != null && ba.toByteArray() != null) {
                            dataTypeMap.put(streamTypeName, ba.toByteArray());
                        } else {
                            dataTypeMap.put(streamTypeName, new byte[0]);
                        }

                        // Clean up the open output streams if there are no more open types
                        // for this stream.
                        if (typeMap.size() == 0) {
                            openOutputStream.remove(streamId);
                        }
                    } else {
                        dataTypeMap.put(streamTypeName, new byte[0]);
                    }

                    // Close child streams.
                    for (final String childType : childMap.keySet()) {
                        getChild(childType).close();
                    }

                    // Only unlock the meta if this is the root.
                    if (parent == null) {
                        // Set the status of the stream to be unlocked.
                        metaService.updateStatus(meta, Status.LOCKED, Status.UNLOCKED);
                    }
                }
            } finally {
                closed = true;
            }
        }
<p>
Open a existing stream source.
</p>

@param streamId  The stream id to open a stream source for.
@param anyStatus Used to specify if this method will return stream sources that
                 are logically deleted or locked. If false only unlocked stream
                 sources will be returned, null otherwise.
@return The loaded stream source if it exists (has not been physically
deleted) else null. Also returns null if one exists but is
logically deleted or locked unless <code>anyStatus</code> is
true.
@throws DataException Could be thrown if no volume
stroom-data/stroom-data-store-mock/src/main/java/stroom/data/store/mock/MockStore.java