@Test void spoolBulkData() throws IOException { Path spoolPath = Files.createTempFile(null,".blk"); DicomObject data = parseSpoolBulkData(spoolPath); DicomElement seg = data.get(Tag.WaveformSequence).orElseGet(Assertions::fail); DicomObject item = seg.getItem(0); assertNotNull(item); DicomElement waveformData = item.get(Tag.WaveformData).orElseGet(Assertions::fail); assertTrue(waveformData.bulkDataURI() .endsWith(".blk#length=256")); DicomElement overlayData = data.get(Tag.OverlayData).orElseGet(Assertions::fail); assertTrue(overlayData.bulkDataURI() .endsWith(".blk#offset=256&length=256")); DicomElement pixelData = data.get(Tag.PixelData).orElseGet(Assertions::fail); assertTrue(pixelData.bulkDataURI() .endsWith(".blk#offset=512")); assertTrue(data.get(Tag.DataSetTrailingPadding).isPresent()); assertEquals(792, Files.size(spoolPath)); Files.deleteIfExists(spoolPath); }
public DicomInputStream spoolBulkData(Supplier<Path> bulkDataSpoolPathSupplier) { parser.setBulkDataSpoolPathSupplier(bulkDataSpoolPathSupplier); parser.setBulkDataURIProducer(DicomInputStream::bulkDataSpoolPathURI); return this; }
DicomInputStream extends InputStream { public DicomInputStream spoolBulkData(Supplier<Path> bulkDataSpoolPathSupplier) { parser.setBulkDataSpoolPathSupplier(bulkDataSpoolPathSupplier); parser.setBulkDataURIProducer(DicomInputStream::bulkDataSpoolPathURI); return this; } }
DicomInputStream extends InputStream { public DicomInputStream spoolBulkData(Supplier<Path> bulkDataSpoolPathSupplier) { parser.setBulkDataSpoolPathSupplier(bulkDataSpoolPathSupplier); parser.setBulkDataURIProducer(DicomInputStream::bulkDataSpoolPathURI); return this; } DicomInputStream(InputStream in); }
DicomInputStream extends InputStream { public DicomInputStream spoolBulkData(Supplier<Path> bulkDataSpoolPathSupplier) { parser.setBulkDataSpoolPathSupplier(bulkDataSpoolPathSupplier); parser.setBulkDataURIProducer(DicomInputStream::bulkDataSpoolPathURI); return this; } 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); }
DicomInputStream extends InputStream { public DicomInputStream spoolBulkData(Supplier<Path> bulkDataSpoolPathSupplier) { parser.setBulkDataSpoolPathSupplier(bulkDataSpoolPathSupplier); parser.setBulkDataURIProducer(DicomInputStream::bulkDataSpoolPathURI); return this; } 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);  }