Package javax.imageio.stream

Examples of javax.imageio.stream.FileCacheImageOutputStream


      OutputStream outStream =
    Channels.newOutputStream((WritableByteChannel)output);

      if(useCache) {
    try {
        stream = new FileCacheImageOutputStream(outStream,
                  cacheDir);
    } catch(IOException e) {
        // Cache file could not be created.
    }
      }
View Full Code Here


    iwp.setProgressionType("layer");
    //Following is must to generate j2k JPEG 2000 stream
    iwp.setWriteCodeStreamOnly(true);
   
    iwp.setNumDecompositionLevels(5);
    FileCacheImageOutputStream fileImageOutputStream = new FileCacheImageOutputStream(baos, null);
    writer.setOutput(fileImageOutputStream);

    //TODO changed
//    writer.write(null, new IIOImage(bitmap, null, null), iwp);
//    IIOMetadata metadata = writer.getDefaultImageMetadata(new ImageTypeSpecifier(bitmap), iwp);
    J2KMetadata metadata = new J2KMetadata(bitmap.getColorModel(),
        bitmap.getSampleModel(), bitmap.getWidth(), bitmap.getHeight(), iwp, writer);
    writer.write(metadata, new IIOImage(bitmap, null, null), iwp);
//    writer.write(bitmap);
   
    fileImageOutputStream.flush();
    fileImageOutputStream.close();
//    ImageIO.write((BitmapBufferedImageImpl)bitmap, "jpg2000", baos);
    byte[] bytes = baos.toByteArray();
    baos.close();
    return bytes;
  }
View Full Code Here

TOP

Related Classes of javax.imageio.stream.FileCacheImageOutputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.