DicomInputStream extends InputStream { public DicomInputStream withBulkDataURI(Path sourcePath) { return withBulkDataURIProducer(x -> x.parser.bulkDataURI(sourcePath)); } DicomInputStream(InputStream in); DicomEncoding getEncoding(); DicomInputStream withEncoding(DicomEncoding encoding); DicomInputStream withLimit(int limit); DicomInputStream withParseItems(Predicate<DicomElement> parseItemsPredicate); DicomInputStream withParseItemsLazy(int seqTag); DicomInputStream withBulkData(Predicate<DicomElement> bulkDataPredicate); DicomInputStream withBulkDataURIProducer(Function<DicomInputStream, String> bulkDataURIProducer); DicomInputStream withBulkDataURI(Path sourcePath); DicomInputStream withInputHandler(DicomInputHandler handler); DicomInputHandler getInputHandler(); DicomInputStream spoolBulkDataTo(Path path); DicomInputStream spoolBulkData(Supplier<Path> bulkDataSpoolPathSupplier); long getStreamPosition(); @Override int read(); @Override int read(byte[] b, int off, int len); @Override void close(); DicomObject readFileMetaInformation(); DicomObject getFileMetaInformation(); DicomObject readCommandSet(); DicomObject readDataSet(); boolean readDataSet(DicomObject dcmObj); StringBuilder promptFilePreambleTo(StringBuilder appendTo, int maxLength); StringBuilder promptTo(DicomElement dcmElm, StringBuilder appendTo, int maxLength); StringBuilder promptTo(DataFragment dataFragment, StringBuilder appendTo, int maxLength); void loadValueFromStream(); void writeValueTo(DicomElement dcmElm, DicomOutputStream dos); void skipBytes(int off, int length, OutputStream out); String bulkDataURI(); static boolean isBulkData(DicomElement el);  }
@Test void withBulkDataURI() throws IOException { URL srcURL = resource("waveform_overlay_pixeldata.dcm"); Path sourcePath = Paths.get(URI.create(srcURL.toString())); DicomObject data = parseWithBulkDataURI(sourcePath); DicomElement seq = data.get(Tag.WaveformSequence).orElseGet(Assertions::fail); DicomObject item = seq.getItem(0); assertNotNull(item); DicomElement waveformData = item.get(Tag.WaveformData).orElseGet(Assertions::fail); assertTrue(waveformData.bulkDataURI() .endsWith("waveform_overlay_pixeldata.dcm#offset=32&length=256")); DicomElement overlayData = data.get(Tag.OverlayData).orElseGet(Assertions::fail); assertTrue(overlayData.bulkDataURI() .endsWith("waveform_overlay_pixeldata.dcm#offset=300&length=256")); DicomElement pixelData = data.get(Tag.PixelData).orElseGet(Assertions::fail); assertTrue(pixelData.bulkDataURI() .endsWith("waveform_overlay_pixeldata.dcm#offset=568")); assertTrue(data.get(Tag.DataSetTrailingPadding).isPresent()); }