ImageOutputStream
File
RandomAccessFile
403404405406407408409410411412413414415
if (!iter.hasNext()) { iter = ImageIO.getImageWriters(spec,"PNG"); } if (iter.hasNext()) { ImageWriter writer = (ImageWriter) iter.next(); FileImageOutputStream fios = new FileImageOutputStream(new File(tmpFile)); writer.setOutput(fios); writer.write(pBufferedImage); fios.close(); writer.dispose(); } return tmpFile; }
5758596061626364656667
} public static void pegaImagemByURL(String u, File d) throws IOException { ImageWriter iw = ImageIO.getImageWritersByFormatName("jpeg").next(); iw.setOutput(new FileImageOutputStream(d)); ImageWriteParam iwParam = iw.getDefaultWriteParam(); iwParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); iwParam.setCompressionQuality(0.9f);
93949596979899100101102103104
scaledImage = image; } File f = new File(root, name); ImageOutputStream out = new FileImageOutputStream(f); format.setOutput(out); format.write(scaledImage); out.flush(); out.close(); }
39404142434445464748
@Override public ImageInputStream createInputStreamInstance(Object input, boolean useCache, File cacheDir) throws IOException { if (RandomAccessFile.class.isInstance(input)) { return new FileImageOutputStream((RandomAccessFile) input); } throw new IllegalArgumentException( "input is not an instance of java.io.RandomAccessFile"); }
383940414243444546
@Override public ImageInputStream createInputStreamInstance(Object input, boolean useCache, File cacheDir) throws IOException { if (File.class.isInstance(input)) { return new FileImageOutputStream((File) input); } throw new IllegalArgumentException("input is not an instance of java.io.File"); }
456457458459460461462463464465466
*/ public AVIOutputStream(File file, VideoFormat format) throws IOException { if (file.exists()) { file.delete(); } out = new FileImageOutputStream(file); if (format == null) { throw new IllegalArgumentException("format must not be null"); }
5051525354555657585960
public ImageOutputStream createOutputStreamInstance(Object output, boolean useCache, File cacheDir) { if (output instanceof File) { try { return new FileImageOutputStream((File)output); } catch (Exception e) { e.printStackTrace(); return null; } } else {
3334353637383940414243
public ImageOutputStream createOutputStreamInstance(Object output, boolean useCache, File cacheDir) { if (output instanceof RandomAccessFile) { try { return new FileImageOutputStream((RandomAccessFile)output); } catch (Exception e) { e.printStackTrace(); return null; } } else {
3233343536373839404142
5152535455565758596061