@Override public BufferedImage readImage(InputStream in, JPEG2000CodecOptions options) throws IOException, ServiceException { J2KImageReader reader = getReader(); MemoryCacheImageInputStream mciis = new MemoryCacheImageInputStream(in); reader.setInput(mciis, false, true); J2KImageReadParam param = (J2KImageReadParam) reader.getDefaultReadParam(); if (options.resolution != null) { param.setResolution(options.resolution.intValue()); } BufferedImage image = reader.read(0, param); mciis.close(); reader.dispose(); return image; }
@Override public BufferedImage readImage(InputStream in, JPEG2000CodecOptions options) throws IOException, ServiceException { J2KImageReader reader = getReader(); MemoryCacheImageInputStream mciis = new MemoryCacheImageInputStream(in); reader.setInput(mciis, false, true); J2KImageReadParam param = (J2KImageReadParam) reader.getDefaultReadParam(); if (options.resolution != null) { param.setResolution(options.resolution.intValue()); } BufferedImage image = reader.read(0, param); mciis.close(); reader.dispose(); return image; }
@Override public BufferedImage readImage(InputStream in, JPEG2000CodecOptions options) throws IOException, ServiceException { J2KImageReader reader = getReader(); MemoryCacheImageInputStream mciis = new MemoryCacheImageInputStream(in); reader.setInput(mciis, false, true); J2KImageReadParam param = (J2KImageReadParam) reader.getDefaultReadParam(); if (options.resolution != null) { param.setResolution(options.resolution.intValue()); } BufferedImage image = reader.read(0, param); mciis.close(); reader.dispose(); return image; }
@Override public Raster readRaster(InputStream in, JPEG2000CodecOptions options) throws IOException, ServiceException { J2KImageReader reader = getReader(); MemoryCacheImageInputStream mciis = new MemoryCacheImageInputStream(in); reader.setInput(mciis, false, true); J2KImageReadParam param = (J2KImageReadParam) reader.getDefaultReadParam(); if (options.resolution != null) { param.setResolution(options.resolution.intValue()); } Raster raster = reader.readRaster(0, param); mciis.close(); reader.dispose(); return raster; }
@Override public Raster readRaster(InputStream in, JPEG2000CodecOptions options) throws IOException, ServiceException { J2KImageReader reader = getReader(); MemoryCacheImageInputStream mciis = new MemoryCacheImageInputStream(in); reader.setInput(mciis, false, true); J2KImageReadParam param = (J2KImageReadParam) reader.getDefaultReadParam(); if (options.resolution != null) { param.setResolution(options.resolution.intValue()); } Raster raster = reader.readRaster(0, param); mciis.close(); reader.dispose(); return raster; }
@Override public Raster readRaster(InputStream in, JPEG2000CodecOptions options) throws IOException, ServiceException { J2KImageReader reader = getReader(); MemoryCacheImageInputStream mciis = new MemoryCacheImageInputStream(in); reader.setInput(mciis, false, true); J2KImageReadParam param = (J2KImageReadParam) reader.getDefaultReadParam(); if (options.resolution != null) { param.setResolution(options.resolution.intValue()); } Raster raster = reader.readRaster(0, param); mciis.close(); reader.dispose(); return raster; }
public void readHeader() { if (gotHeader) return; if (readState == null) { try { iis.seek(streamPosition0); } catch(IOException e) { // XXX ignore } readState = new J2KReadState(iis, new J2KImageReadParamJava(getDefaultReadParam()), this); } hd = readState.getHeader(); gotHeader = true; this.width = hd.getImgWidth(); this.height = hd.getImgHeight(); }
public void readHeader() { if (gotHeader) return; if (readState == null) { try { iis.seek(streamPosition0); } catch(IOException e) { // XXX ignore } readState = new J2KReadState(iis, new J2KImageReadParamJava(getDefaultReadParam()), this); } hd = readState.getHeader(); gotHeader = true; this.width = hd.getImgWidth(); this.height = hd.getImgHeight(); }
public void readHeader() { if (gotHeader) return; if (readState == null) { try { iis.seek(streamPosition0); } catch(IOException e) { // XXX ignore } readState = new J2KReadState(iis, new J2KImageReadParamJava(getDefaultReadParam()), this); } hd = readState.getHeader(); gotHeader = true; this.width = hd.getImgWidth(); this.height = hd.getImgHeight(); }
public RenderedImage readAsRenderedImage(int imageIndex, ImageReadParam param) throws IOException { checkIndex(imageIndex); RenderedImage ri = null; clearAbortRequest(); processImageStarted(imageIndex); if (param == null) param = getDefaultReadParam(); param = new J2KImageReadParamJava(param); if (!ignoreMetadata) { if (imageMetadata == null) imageMetadata = new J2KMetadata(); ri = new J2KRenderedImage(iis, (J2KImageReadParamJava)param, imageMetadata, this); } else ri = new J2KRenderedImage(iis, (J2KImageReadParamJava)param, this); if (abortRequested()) processReadAborted(); else processImageComplete(); return ri; }
public RenderedImage readAsRenderedImage(int imageIndex, ImageReadParam param) throws IOException { checkIndex(imageIndex); RenderedImage ri = null; clearAbortRequest(); processImageStarted(imageIndex); if (param == null) param = getDefaultReadParam(); param = new J2KImageReadParamJava(param); if (!ignoreMetadata) { if (imageMetadata == null) imageMetadata = new J2KMetadata(); ri = new J2KRenderedImage(iis, (J2KImageReadParamJava)param, imageMetadata, this); } else ri = new J2KRenderedImage(iis, (J2KImageReadParamJava)param, this); if (abortRequested()) processReadAborted(); else processImageComplete(); return ri; }
public RenderedImage readAsRenderedImage(int imageIndex, ImageReadParam param) throws IOException { checkIndex(imageIndex); RenderedImage ri = null; clearAbortRequest(); processImageStarted(imageIndex); if (param == null) param = getDefaultReadParam(); param = new J2KImageReadParamJava(param); if (!ignoreMetadata) { if (imageMetadata == null) imageMetadata = new J2KMetadata(); ri = new J2KRenderedImage(iis, (J2KImageReadParamJava)param, imageMetadata, this); } else ri = new J2KRenderedImage(iis, (J2KImageReadParamJava)param, this); if (abortRequested()) processReadAborted(); else processImageComplete(); return ri; }
public Raster readRaster(int imageIndex, ImageReadParam param) throws IOException { checkIndex(imageIndex); processImageStarted(imageIndex); if (param == null) { param = getDefaultReadParam(); } param = new J2KImageReadParamJava(param); if (!ignoreMetadata) { imageMetadata = new J2KMetadata(); iis.seek(streamPosition0); readState = new J2KReadState(iis, (J2KImageReadParamJava)param, imageMetadata, this); } else { iis.seek(streamPosition0); readState = new J2KReadState(iis, (J2KImageReadParamJava)param, this); } Raster ras = readState.readAsRaster(); if (abortRequested()) processReadAborted(); else processImageComplete(); return ras; }
public Raster readRaster(int imageIndex, ImageReadParam param) throws IOException { checkIndex(imageIndex); processImageStarted(imageIndex); if (param == null) { param = getDefaultReadParam(); } param = new J2KImageReadParamJava(param); if (!ignoreMetadata) { imageMetadata = new J2KMetadata(); iis.seek(streamPosition0); readState = new J2KReadState(iis, (J2KImageReadParamJava)param, imageMetadata, this); } else { iis.seek(streamPosition0); readState = new J2KReadState(iis, (J2KImageReadParamJava)param, this); } Raster ras = readState.readAsRaster(); if (abortRequested()) processReadAborted(); else processImageComplete(); return ras; }
public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException { checkIndex(imageIndex); clearAbortRequest(); processImageStarted(imageIndex); if (param == null) param = getDefaultReadParam(); param = new J2KImageReadParamJava(param); if (!ignoreMetadata) { imageMetadata = new J2KMetadata(); iis.seek(streamPosition0); readState = new J2KReadState(iis, (J2KImageReadParamJava)param, imageMetadata, this); } else { iis.seek(streamPosition0); readState = new J2KReadState(iis, (J2KImageReadParamJava)param, this); } BufferedImage bi = readState.readBufferedImage(); if (abortRequested()) processReadAborted(); else processImageComplete(); return bi; }
public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException { checkIndex(imageIndex); clearAbortRequest(); processImageStarted(imageIndex); if (param == null) param = getDefaultReadParam(); param = new J2KImageReadParamJava(param); if (!ignoreMetadata) { imageMetadata = new J2KMetadata(); iis.seek(streamPosition0); readState = new J2KReadState(iis, (J2KImageReadParamJava)param, imageMetadata, this); } else { iis.seek(streamPosition0); readState = new J2KReadState(iis, (J2KImageReadParamJava)param, this); } BufferedImage bi = readState.readBufferedImage(); if (abortRequested()) processReadAborted(); else processImageComplete(); return bi; }
public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException { checkIndex(imageIndex); clearAbortRequest(); processImageStarted(imageIndex); if (param == null) param = getDefaultReadParam(); param = new J2KImageReadParamJava(param); if (!ignoreMetadata) { imageMetadata = new J2KMetadata(); iis.seek(streamPosition0); readState = new J2KReadState(iis, (J2KImageReadParamJava)param, imageMetadata, this); } else { iis.seek(streamPosition0); readState = new J2KReadState(iis, (J2KImageReadParamJava)param, this); } BufferedImage bi = readState.readBufferedImage(); if (abortRequested()) processReadAborted(); else processImageComplete(); return bi; }