public void write(int b) throws IOException { atom[atomLen++] = (byte)b; if (atomLen == 3) encodeAtom(); }
public void write(byte []data) throws IOException { encodeFromArray(data, 0, data.length); }
/** * Uses PNG encoding. */ public void encodeImage(BufferedImage buf, OutputStream os) throws IOException { Base64EncoderStream b64Encoder = new Base64EncoderStream(os); ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/png"); writer.writeImage(buf, b64Encoder); b64Encoder.close(); }
try { os.write(SVGSyntax.DATA_PROTOCOL_PNG_PREFIX.getBytes()); Base64EncoderStream encoder = new Base64EncoderStream(os); FileInputStream instream = new FileInputStream(in); byte[] buf = new byte[4096]; break; encoder.write(buf, 0, read); encoder.close();
OutputStream os = new Base64EncoderStream(pos);
/** * Uses PNG encoding. */ public void encodeImage(BufferedImage buf, OutputStream os) throws IOException { Base64EncoderStream b64Encoder = new Base64EncoderStream(os); ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/png"); writer.writeImage(buf, b64Encoder); b64Encoder.close(); }
try { os.write(SVGSyntax.DATA_PROTOCOL_PNG_PREFIX.getBytes()); Base64EncoderStream encoder = new Base64EncoderStream(os); FileInputStream instream = new FileInputStream(in); byte[] buf = new byte[4096]; break; encoder.write(buf, 0, read); encoder.close();
Base64EncoderStream b64Encoder = new Base64EncoderStream(os); try { b64Encoder.close(); } catch (IOException e) {
public void write(int b) throws IOException { atom[atomLen++] = (byte)b; if (atomLen == 3) encodeAtom(); }
public void write(byte []data) throws IOException { encodeFromArray(data, 0, data.length); }
Base64EncoderStream b64Encoder = new Base64EncoderStream(os); try { b64Encoder.close(); } catch (IOException e) {
public void write(int b) throws IOException { atom[atomLen++] = (byte)b; if (atomLen == 3) encodeAtom(); }
public void write(byte [] data, int off, int len) throws IOException { encodeFromArray(data, off, len); }
/** * Inline a referenced thumbnail. * * @param doc Document (element factory) * @param urldata URL * @param eold Existing node * @return Replacement node, or {@code null} */ protected Node inlineThumbnail(Document doc, ParsedURL urldata, Node eold) { RenderableImage img = ThumbnailRegistryEntry.handleURL(urldata); if(img == null) { LoggingUtil.warning("Image not found in registry: " + urldata.toString()); return null; } ByteArrayOutputStream os = new ByteArrayOutputStream(); try { os.write(SVGSyntax.DATA_PROTOCOL_PNG_PREFIX.getBytes()); Base64EncoderStream encoder = new Base64EncoderStream(os); ImageIO.write(img.createDefaultRendering(), "png", encoder); encoder.close(); } catch(IOException e) { LoggingUtil.exception("Exception serializing image to png", e); return null; } Element i = (Element) super.cloneNode(doc, eold); i.setAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_ATTRIBUTE, os.toString().replaceAll("\\s*[\\r\\n]+\\s*", "")); return i; }
public void close () throws IOException { if (out != null) { encodeAtom(); out.flush(); if (closeOutOnClose) out.close(); out=null; } }
public void write(byte [] data, int off, int len) throws IOException { encodeFromArray(data, off, len); }
/** * Inline a referenced thumbnail. * * @param doc Document (element factory) * @param urldata URL * @param eold Existing node * @return Replacement node, or {@code null} */ protected Node inlineThumbnail(Document doc, ParsedURL urldata, Node eold) { RenderableImage img = ThumbnailRegistryEntry.handleURL(urldata); if(img == null) { LoggingUtil.warning("Image not found in registry: " + urldata.toString()); return null; } ByteArrayOutputStream os = new ByteArrayOutputStream(); try { os.write(SVGSyntax.DATA_PROTOCOL_PNG_PREFIX.getBytes()); Base64EncoderStream encoder = new Base64EncoderStream(os); ImageIO.write(img.createDefaultRendering(), "png", encoder); encoder.close(); } catch(IOException e) { LoggingUtil.exception("Exception serializing image to png", e); return null; } Element i = (Element) super.cloneNode(doc, eold); i.setAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_ATTRIBUTE, os.toString().replaceAll("\\s*[\\r\\n]+\\s*", "")); return i; }
public void close () throws IOException { if (out != null) { encodeAtom(); out.flush(); if (closeOutOnClose) out.close(); out=null; } }
public void write(byte [] data, int off, int len) throws IOException { encodeFromArray(data, off, len); }
public void close () throws IOException { if (out != null) { encodeAtom(); out.flush(); if (closeOutOnClose) out.close(); out=null; } }