onContentSet (Namespace nameSpace, Namespace contentNamespace, long callbackId) { if (contentNamespace.getName().size() == namespace_.getName().size() + 2 && contentNamespace.getName()[-2].equals(fileMarker_)) { var version = contentNamespace.getName()[-1]; if (version.isVersion()) { // Got the file marker for the version such as // <namespace>/%C1.FS.file/<version>. Fetch the segmented content. var segmentedContent = new SegmentedContent(namespace_[version]); segmentedContent.start(); } } else if (contentNamespace.getName().size() == namespace_.getName().size() + 1 && contentNamespace.getName()[-1].isVersion()) { // We got the assembled content from the SegmentedContent handler. if (onVersionContentSet_ != null) { onVersionContentSet_(this, contentNamespace, (Blob)contentNamespace.getContent()); } } }
transformContentMetaInfo(Data data, OnContentTransformed onContentTransformed) { var contentMetaInfo = new ContentMetaInfo(); // TODO: Report errors decoding. contentMetaInfo.wireDecode(data.getContent()); onContentTransformed(data, contentMetaInfo); if (contentMetaInfo.getHasSegments()) { // Start fetching segments. // TODO: Allow the caller to pass the SegmentStream in the constructor. SegmentedContent segmentedContent = new SegmentedContent(namespace_); segmentedContent.start(); } }