throw new CodecException("> 8 bit data cannot be compressed with JPEG."); throw new CodecException("Could not write JPEG data", e);
static FormatException unwrapCodecException(ome.codecs.CodecException e) { FormatException fe; if(e.getMessage() != null) { fe = new FormatException(e.getMessage()); } else { fe = new FormatException(); } if(e.getCause() != null) { fe.initCause(e.getCause()); } fe.setStackTrace(e.getStackTrace()); return fe; } }
static FormatException unwrapCodecException(ome.codecs.CodecException e) { FormatException fe; if(e.getMessage() != null) { fe = new FormatException(e.getMessage()); } else { fe = new FormatException(); } if(e.getCause() != null) { fe.initCause(e.getCause()); } fe.setStackTrace(e.getStackTrace()); return fe; } }
throw new CodecException("Output buffer is greater than 2 GB");
throw new CodecException("Options must be an instance of " + "ome.codecs.HuffmanCodecOptions."); throw new CodecException(e);
throw new CodecException(LuraWaveServiceImpl.NO_LICENSE_MSG, e); throw new CodecException(LuraWaveServiceImpl.INVALID_LICENSE_MSG, e); throw new CodecException(e); throw new CodecException(LuraWaveServiceImpl.INVALID_LICENSE_MSG, e); throw new CodecException(LuraWaveServiceImpl.INVALID_LICENSE_MSG, e); throw new CodecException("Unsupported bits per pixel: " + nbits);
@Override public byte[] decompress(byte[] data, CodecOptions options) throws CodecException { try { RandomAccessInputStream r = new RandomAccessInputStream(data); byte[] t = decompress(r, options); r.close(); return t; } catch (IOException e) { throw new CodecException(e); } }
/** * The CodecOptions parameter must be an instance of * {@link HuffmanCodecOptions}, and should have the following fields set: * {@link HuffmanCodecOptions#table table} * {@link CodecOptions#bitsPerSample bitsPerSample} * {@link CodecOptions#maxBytes maxBytes} * * @see Codec#decompress(RandomAccessInputStream, CodecOptions) */ @Override public byte[] decompress(RandomAccessInputStream in, CodecOptions options) throws CodecException, IOException { if (in == null) throw new IllegalArgumentException("No data to decompress."); if (options == null || !(options instanceof HuffmanCodecOptions)) { throw new CodecException("Options must be an instance of " + "ome.codecs.HuffmanCodecOptions."); } HuffmanCodecOptions huffman = (HuffmanCodecOptions) options; int nSamples = (huffman.maxBytes * 8) / huffman.bitsPerSample; int bytesPerSample = huffman.bitsPerSample / 8; if ((huffman.bitsPerSample % 8) != 0) bytesPerSample++; BitWriter out = new BitWriter(); for (int i=0; i<nSamples; i++) { int sample = getSample(in, options); out.write(sample, bytesPerSample * 8); } return out.toByteArray(); }
throw new CodecException("Could not decompress JPEG2000 image. Please " + "make sure that jai_imageio.jar is installed.", e); throw new CodecException("Could not decompress JPEG2000 image. Please " + "make sure that jai_imageio.jar is installed.", e);
@Deprecated public int getSample(BitBuffer bb, CodecOptions options) throws CodecException { RandomAccessInputStream s = null; try { try { s = new RandomAccessInputStream(new ByteArrayHandle(bb.getByteBuffer())); return getSample(s, options); } finally { s.close(); } } catch (IOException e) { throw new CodecException(e); } }
else throw new CodecException("Unsupported header : " + header); throw new CodecException(e);
throw new CodecException("Invalid LZW data", e);
throw new CodecException("Could not compress JPEG-2000 data.", e); throw new CodecException("Could not compress JPEG-2000 data.", e); throw new CodecException("Failed to close RandomAccessOutputStream.", e);
throw new CodecException("Options must be an instance of " + "ome.codecs.MJPBCodecOptions"); throw new CodecException(e);