@Override public int read(byte[] b, int off, int len) throws IOException { if (isLoadingSeriesCanceled()) { InterruptedIOException exc = new InterruptedIOException(INTERUPTION_LABEL); exc.bytesTransferred = nread; series.setFileSize(series.getFileSize() - nread); nread = 0; throw exc; } int nr = in.read(b, off, len); if (nr > 0) { nread += nr; updateSeriesProgression(nr); } return nr; }
@Override public int read(byte[] b) throws IOException { if (isLoadingSeriesCanceled()) { InterruptedIOException exc = new InterruptedIOException(INTERUPTION_LABEL); exc.bytesTransferred = nread; series.setFileSize(series.getFileSize() - nread); nread = 0; throw exc; } int nr = in.read(b); if (nr > 0) { nread += nr; updateSeriesProgression(nr); } return nr; }
@Override public int read() throws IOException { if (isLoadingSeriesCanceled()) { InterruptedIOException exc = new InterruptedIOException(INTERUPTION_LABEL); exc.bytesTransferred = nread; series.setFileSize(series.getFileSize() - nread); nread = 0; throw exc; } int c = in.read(); if (c >= 0) { nread++; updateSeriesProgression(1); } return c; }
protected void updateSeriesProgression(long addSize) { series.setFileSize(series.getFileSize() + addSize); GuiExecutor.instance().execute(() -> { Thumbnail thumb = (Thumbnail) series.getTagValue(TagW.Thumbnail); if (thumb != null) { thumb.repaint(); } }); }
InterruptedIOException exc = new InterruptedIOException("Not a DICOM file"); //$NON-NLS-1$ exc.bytesTransferred = progress.nread; progress.series.setFileSize(progress.series.getFileSize() - progress.nread); progress.nread = 0; throw exc;
dicomSeries.setFileSize(dicomSeries.getFileSize() + medias[0].getLength()); dicomSeries.setFileSize(dicomSeries.getFileSize() + medias[0].getLength());
dicomSeries.setFileSize(dicomSeries.getFileSize() + medias[0].getLength()); dicomSeries.setFileSize(dicomSeries.getFileSize() + medias[0].getLength());