1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-20 04:00:53 +00:00

Merge pull request #731 from matthew16550/simageio

Rename net.sourceforge.plantuml.security.ImageIO to SImageIO
This commit is contained in:
arnaudroques 2021-10-27 15:43:38 +02:00 committed by GitHub
commit 7141113050
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 65 additions and 65 deletions

View File

@ -7,7 +7,7 @@ import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import ext.plantuml.com.ctreber.acearth.renderer.RenderTarget; import ext.plantuml.com.ctreber.acearth.renderer.RenderTarget;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
/** /**
* <p> * <p>
@ -58,7 +58,7 @@ public class PixelCanvas implements RenderTarget {
} }
public void saveToImage(OutputStream os) throws IOException { public void saveToImage(OutputStream os) throws IOException {
ImageIO.write(fEarthImage2, "png", os); SImageIO.write(fEarthImage2, "png", os);
} }
} }

View File

@ -45,7 +45,7 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
public class ClipboardLoop { public class ClipboardLoop {
@ -88,7 +88,7 @@ public class ClipboardLoop {
} else { } else {
Log.info("Image ok " + desc.getDescription()); Log.info("Image ok " + desc.getDescription());
baos.close(); baos.close();
final BufferedImage image = ImageIO.read(baos.toByteArray()); final BufferedImage image = SImageIO.read(baos.toByteArray());
setClipboardImage(image); setClipboardImage(image);
Log.info("Image copied in clipboard"); Log.info("Image copied in clipboard");
} }

View File

@ -50,7 +50,7 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.Line; import net.sourceforge.plantuml.graphic.Line;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.ugraphic.AffineTransformType; import net.sourceforge.plantuml.ugraphic.AffineTransformType;
import net.sourceforge.plantuml.ugraphic.PixelImage; import net.sourceforge.plantuml.ugraphic.PixelImage;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -186,7 +186,7 @@ public class EmbeddedDiagram implements CharSequence {
final ByteArrayOutputStream os = new ByteArrayOutputStream(); final ByteArrayOutputStream os = new ByteArrayOutputStream();
system.exportDiagram(os, 0, new FileFormatOption(FileFormat.PNG)); system.exportDiagram(os, 0, new FileFormatOption(FileFormat.PNG));
os.close(); os.close();
return ImageIO.read(os.toByteArray()); return SImageIO.read(os.toByteArray());
} }
public HorizontalAlignment getHorizontalAlignment() { public HorizontalAlignment getHorizontalAlignment() {

View File

@ -63,7 +63,7 @@ import net.sourceforge.plantuml.ftp.FtpServer;
import net.sourceforge.plantuml.picoweb.PicoWebServer; import net.sourceforge.plantuml.picoweb.PicoWebServer;
import net.sourceforge.plantuml.png.MetadataTag; import net.sourceforge.plantuml.png.MetadataTag;
import net.sourceforge.plantuml.preproc.Stdlib; import net.sourceforge.plantuml.preproc.Stdlib;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.security.SecurityUtils; import net.sourceforge.plantuml.security.SecurityUtils;
import net.sourceforge.plantuml.sprite.SpriteGrayLevel; import net.sourceforge.plantuml.sprite.SpriteGrayLevel;
@ -299,7 +299,7 @@ public class Run {
final BufferedImage im; final BufferedImage im;
try (InputStream stream = source.openStream()) { try (InputStream stream = source.openStream()) {
im = ImageIO.read(stream); im = SImageIO.read(stream);
} }
final String name = getSpriteName(fileName); final String name = getSpriteName(fileName);
final String s = compressed ? SpriteUtils.encodeCompressed(im, name, level) final String s = compressed ? SpriteUtils.encodeCompressed(im, name, level)

View File

@ -66,7 +66,7 @@ import net.sourceforge.plantuml.graphic.GraphicStrings;
import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.mjpeg.MJPEGGenerator; import net.sourceforge.plantuml.mjpeg.MJPEGGenerator;
import net.sourceforge.plantuml.pdf.PdfConverter; import net.sourceforge.plantuml.pdf.PdfConverter;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.security.SecurityUtils; import net.sourceforge.plantuml.security.SecurityUtils;
import net.sourceforge.plantuml.style.NoStyleAvailableException; import net.sourceforge.plantuml.style.NoStyleAvailableException;
@ -269,7 +269,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
// exportDiagramTOxxBEREMOVED(baos, null, 0, new // exportDiagramTOxxBEREMOVED(baos, null, 0, new
// FileFormatOption(FileFormat.PNG, at)); // FileFormatOption(FileFormat.PNG, at));
baos.close(); baos.close();
final BufferedImage im = ImageIO.read(baos.toByteArray()); final BufferedImage im = SImageIO.read(baos.toByteArray());
m.addImage(im); m.addImage(im);
} }
m.finishAVI(); m.finishAVI();

View File

@ -50,8 +50,8 @@ import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.security.ImageIO;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.sprite.SpriteImage; import net.sourceforge.plantuml.sprite.SpriteImage;
import net.sourceforge.plantuml.sprite.SpriteSvg; import net.sourceforge.plantuml.sprite.SpriteSvg;
@ -83,7 +83,7 @@ public class CommandSpriteFile extends SingleLineCommand2<TitledDiagram> {
if (is == null) { if (is == null) {
return CommandExecutionResult.error("No such internal sprite: " + inner); return CommandExecutionResult.error("No such internal sprite: " + inner);
} }
sprite = new SpriteImage(ImageIO.read(is)); sprite = new SpriteImage(SImageIO.read(is));
} else if (src.contains("~")) { } else if (src.contains("~")) {
final int idx = src.lastIndexOf("~"); final int idx = src.lastIndexOf("~");
final SFile f = FileSystem.getInstance().getFile(src.substring(0, idx)); final SFile f = FileSystem.getInstance().getFile(src.substring(0, idx));
@ -139,7 +139,7 @@ public class CommandSpriteFile extends SingleLineCommand2<TitledDiagram> {
if (isSvg(name)) { if (isSvg(name)) {
return new SpriteSvg(FileUtils.readSvg(zis)); return new SpriteSvg(FileUtils.readSvg(zis));
} else { } else {
return new SpriteImage(ImageIO.read(zis)); return new SpriteImage(SImageIO.read(zis));
} }
} }
ze = zis.getNextEntry(); ze = zis.getNextEntry();

View File

@ -54,7 +54,7 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.ImgValign; import net.sourceforge.plantuml.graphic.ImgValign;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TileImageSvg; import net.sourceforge.plantuml.graphic.TileImageSvg;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.security.SURL; import net.sourceforge.plantuml.security.SURL;
import net.sourceforge.plantuml.security.SecurityProfile; import net.sourceforge.plantuml.security.SecurityProfile;
@ -158,7 +158,7 @@ public class AtomImg extends AbstractAtom implements Atom {
private static Atom buildRasterFromData(String source, final FontConfiguration fc, final byte[] data, double scale, private static Atom buildRasterFromData(String source, final FontConfiguration fc, final byte[] data, double scale,
Url url) throws IOException { Url url) throws IOException {
final BufferedImage read = ImageIO.read(data); final BufferedImage read = SImageIO.read(data);
if (read == null) { if (read == null) {
return AtomTextUtils.createLegacy("(Cannot decode: " + source + ")", fc); return AtomTextUtils.createLegacy("(Cannot decode: " + source + ")", fc);
} }

View File

@ -47,7 +47,7 @@ import net.sourceforge.plantuml.PlainDiagram;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.ugraphic.AffineTransformType; import net.sourceforge.plantuml.ugraphic.AffineTransformType;
import net.sourceforge.plantuml.ugraphic.PixelImage; import net.sourceforge.plantuml.ugraphic.PixelImage;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -77,7 +77,7 @@ public class PSystemDedication extends PlainDiagram {
final Object vp8Decoder = clVP8Decoder.newInstance(); final Object vp8Decoder = clVP8Decoder.newInstance();
// final VP8Decoder vp8Decoder = new VP8Decoder(); // final VP8Decoder vp8Decoder = new VP8Decoder();
final Method decodeFrame = clVP8Decoder.getMethod("decodeFrame", ImageInputStream.class); final Method decodeFrame = clVP8Decoder.getMethod("decodeFrame", ImageInputStream.class);
final ImageInputStream iis = ImageIO.createImageInputStream(is); final ImageInputStream iis = SImageIO.createImageInputStream(is);
decodeFrame.invoke(vp8Decoder, iis); decodeFrame.invoke(vp8Decoder, iis);
// vp8Decoder.decodeFrame(iis); // vp8Decoder.decodeFrame(iis);
iis.close(); iis.close();

View File

@ -51,7 +51,7 @@ import net.sourceforge.plantuml.api.ImageDataSimple;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.svek.GraphvizCrash; import net.sourceforge.plantuml.svek.GraphvizCrash;
public class PSystemDitaa extends AbstractPSystem { public class PSystemDitaa extends AbstractPSystem {
@ -141,7 +141,7 @@ public class PSystemDitaa extends AbstractPSystem {
renderingOptions.getClass()); renderingOptions.getClass());
final BufferedImage image = (BufferedImage) renderToImage.invoke(bitmapRenderer, diagram, renderingOptions); final BufferedImage image = (BufferedImage) renderToImage.invoke(bitmapRenderer, diagram, renderingOptions);
ImageIO.write(image, "png", os); SImageIO.write(image, "png", os);
final int width = image.getWidth(); final int width = image.getWidth();
final int height = image.getHeight(); final int height = image.getHeight();
return new ImageDataSimple(width, height); return new ImageDataSimple(width, height);

View File

@ -41,7 +41,7 @@ import net.sourceforge.plantuml.PlainStringsDiagram;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.graphic.GraphicPosition; import net.sourceforge.plantuml.graphic.GraphicPosition;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
public class PSystemRIP extends PlainStringsDiagram { public class PSystemRIP extends PlainStringsDiagram {
@ -58,7 +58,7 @@ public class PSystemRIP extends PlainStringsDiagram {
strings.add(" <b>Requiescat In Pace"); strings.add(" <b>Requiescat In Pace");
strings.add(" "); strings.add(" ");
image = ImageIO.read(imm); image = SImageIO.read(imm);
imagePosition = GraphicPosition.BOTTOM; imagePosition = GraphicPosition.BOTTOM;
} }

View File

@ -43,7 +43,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
public class IconLoader { public class IconLoader {
@ -89,7 +89,7 @@ public class IconLoader {
if (is == null) { if (is == null) {
return null; return null;
} }
final BufferedImage image = ImageIO.read(is); final BufferedImage image = SImageIO.read(is);
is.close(); is.close();
return image; return image;
} catch (IOException e) { } catch (IOException e) {

View File

@ -50,7 +50,7 @@ import net.sourceforge.plantuml.api.ImageDataSimple;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
public class PSystemJcckit extends AbstractPSystem { public class PSystemJcckit extends AbstractPSystem {
@ -77,7 +77,7 @@ public class PSystemJcckit extends AbstractPSystem {
plotCanvas.paint(); plotCanvas.paint();
// Writes the off-screen image into a PNG file // Writes the off-screen image into a PNG file
ImageIO.write(image, "png", os); SImageIO.write(image, "png", os);
return new ImageDataSimple(width, height); return new ImageDataSimple(width, height);
} }

View File

@ -52,7 +52,7 @@ import net.sourceforge.plantuml.api.ImageDataSimple;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.eps.EpsGraphics; import net.sourceforge.plantuml.eps.EpsGraphics;
import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.graphic.GraphicStrings;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.svek.TextBlockBackcolored;
import net.sourceforge.plantuml.ugraphic.AffineTransformType; import net.sourceforge.plantuml.ugraphic.AffineTransformType;
import net.sourceforge.plantuml.ugraphic.MutableImage; import net.sourceforge.plantuml.ugraphic.MutableImage;
@ -118,7 +118,7 @@ public class ScientificEquationSafe {
} }
try { try {
final byte[] bytes = plainPngBuilder(getRollback()).writeByteArray(); final byte[] bytes = plainPngBuilder(getRollback()).writeByteArray();
return new PixelImage(ImageIO.read(bytes), AffineTransformType.TYPE_BILINEAR); return new PixelImage(SImageIO.read(bytes), AffineTransformType.TYPE_BILINEAR);
} catch (IOException e1) { } catch (IOException e1) {
return null; return null;
} }
@ -140,7 +140,7 @@ public class ScientificEquationSafe {
Color backgroundColor) throws IOException { Color backgroundColor) throws IOException {
if (fileFormat.getFileFormat() == FileFormat.PNG) { if (fileFormat.getFileFormat() == FileFormat.PNG) {
final BufferedImage image = getImage(foregroundColor, backgroundColor).withScale(scale).getImage(); final BufferedImage image = getImage(foregroundColor, backgroundColor).withScale(scale).getImage();
ImageIO.write(image, "png", os); SImageIO.write(image, "png", os);
return new ImageDataSimple(image.getWidth(), image.getHeight()); return new ImageDataSimple(image.getWidth(), image.getHeight());
} }
if (fileFormat.getFileFormat() == FileFormat.SVG) { if (fileFormat.getFileFormat() == FileFormat.SVG) {

View File

@ -21,7 +21,7 @@ import java.nio.channels.FileChannel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
/** /**
@ -455,7 +455,7 @@ public class MJPEGGenerator {
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
Graphics2D g = bi.createGraphics(); Graphics2D g = bi.createGraphics();
g.drawImage(image, 0, 0, width, height, null); g.drawImage(image, 0, 0, width, height, null);
ImageIO.write(bi, "jpg", baos); SImageIO.write(bi, "jpg", baos);
baos.close(); baos.close();
bi = null; bi = null;
g = null; g = null;

View File

@ -45,7 +45,7 @@ import javax.imageio.stream.ImageInputStream;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
public class Metadata { public class Metadata {
@ -59,8 +59,8 @@ public class Metadata {
} }
public void readAndDisplayMetadata(SFile file) throws IOException { public void readAndDisplayMetadata(SFile file) throws IOException {
final ImageInputStream iis = ImageIO.createImageInputStream(file); final ImageInputStream iis = SImageIO.createImageInputStream(file);
final Iterator<ImageReader> readers = ImageIO.getImageReaders(iis); final Iterator<ImageReader> readers = SImageIO.getImageReaders(iis);
if (readers.hasNext()) { if (readers.hasNext()) {
// pick the first available ImageReader // pick the first available ImageReader

View File

@ -47,7 +47,7 @@ import javax.imageio.stream.ImageInputStream;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
public class MetadataTag { public class MetadataTag {
@ -71,8 +71,8 @@ public class MetadataTag {
} }
public String getData() throws IOException { public String getData() throws IOException {
final ImageInputStream iis = ImageIO.createImageInputStream(source); final ImageInputStream iis = SImageIO.createImageInputStream(source);
final Iterator<ImageReader> readers = ImageIO.getImageReaders(iis); final Iterator<ImageReader> readers = SImageIO.getImageReaders(iis);
if (readers.hasNext()) { if (readers.hasNext()) {
// pick the first available ImageReader // pick the first available ImageReader

View File

@ -40,7 +40,7 @@ import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.Log;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
public class PngIO { public class PngIO {
@ -63,7 +63,7 @@ public class PngIO {
Log.debug("File size " + file.length()); Log.debug("File size " + file.length());
if (file.length() == 0) { if (file.length() == 0) {
Log.error("File size is zero: " + file); Log.error("File size is zero: " + file);
ImageIO.write(image, "png", file); SImageIO.write(image, "png", file);
} }
} }
@ -74,7 +74,7 @@ public class PngIO {
public static void write(RenderedImage image, OutputStream os, String metadata, int dpi, String debugData) public static void write(RenderedImage image, OutputStream os, String metadata, int dpi, String debugData)
throws IOException { throws IOException {
if (metadata == null) { if (metadata == null) {
ImageIO.write(image, "png", os); SImageIO.write(image, "png", os);
} else { } else {
PngIOMetadata.writeWithMetadata(image, os, metadata, dpi, debugData); PngIOMetadata.writeWithMetadata(image, os, metadata, dpi, debugData);
} }

View File

@ -51,7 +51,7 @@ import javax.imageio.metadata.IIOMetadataNode;
import javax.imageio.stream.ImageOutputStream; import javax.imageio.stream.ImageOutputStream;
import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.Log;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
public class PngIOMetadata { public class PngIOMetadata {
@ -100,7 +100,7 @@ public class PngIOMetadata {
// http://plantuml.sourceforge.net/qa/?qa=4367/sometimes-missing-response-headers-for-broken-png-images // http://plantuml.sourceforge.net/qa/?qa=4367/sometimes-missing-response-headers-for-broken-png-images
// Code provided by Michael Griffel // Code provided by Michael Griffel
synchronized (imagewriter) { synchronized (imagewriter) {
final ImageOutputStream imageOutputStream = ImageIO.createImageOutputStream(os); final ImageOutputStream imageOutputStream = SImageIO.createImageOutputStream(os);
imagewriter.setOutput(imageOutputStream); imagewriter.setOutput(imageOutputStream);
try { try {
imagewriter.write(null /* default */, iioImage, null /* use default ImageWriteParam */); imagewriter.write(null /* default */, iioImage, null /* use default ImageWriteParam */);
@ -170,8 +170,8 @@ public class PngIOMetadata {
} }
private static ImageWriter getImageWriter() { private static ImageWriter getImageWriter() {
final Iterator<ImageWriter> iterator = ImageIO.getImageWritersBySuffix("png"); final Iterator<ImageWriter> iterator = SImageIO.getImageWritersBySuffix("png");
for (final Iterator<ImageWriter> it = ImageIO.getImageWritersBySuffix("png"); it.hasNext();) { for (final Iterator<ImageWriter> it = SImageIO.getImageWritersBySuffix("png"); it.hasNext();) {
final ImageWriter imagewriter = iterator.next(); final ImageWriter imagewriter = iterator.next();
Log.debug("PngIOMetadata countImageWriter = " + it.next()); Log.debug("PngIOMetadata countImageWriter = " + it.next());
if (imagewriter.getClass().getName().equals("com.sun.imageio.plugins.png.PNGImageWriter")) { if (imagewriter.getClass().getName().equals("com.sun.imageio.plugins.png.PNGImageWriter")) {
@ -181,7 +181,7 @@ public class PngIOMetadata {
} }
Log.debug("Using first one"); Log.debug("Using first one");
return ImageIO.getImageWritersBySuffix("png").next(); return SImageIO.getImageWritersBySuffix("png").next();
} }
} }

View File

@ -45,7 +45,7 @@ import java.util.List;
import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.Log;
import net.sourceforge.plantuml.SplitParam; import net.sourceforge.plantuml.SplitParam;
import net.sourceforge.plantuml.SuggestedFile; import net.sourceforge.plantuml.SuggestedFile;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
public class PngSplitter { public class PngSplitter {
@ -71,7 +71,7 @@ public class PngSplitter {
} }
// Thread.yield(); // Thread.yield();
final BufferedImage im = ImageIO.read(full); final BufferedImage im = SImageIO.read(full);
// Thread.yield(); // Thread.yield();
final PngSegment horizontalSegment = new PngSegment(im.getWidth(), horizontalPages); final PngSegment horizontalSegment = new PngSegment(im.getWidth(), horizontalPages);
final PngSegment verticalSegment = new PngSegment(im.getHeight(), verticalPages); final PngSegment verticalSegment = new PngSegment(im.getHeight(), verticalPages);

View File

@ -48,7 +48,7 @@ import javax.imageio.ImageWriter;
import javax.imageio.stream.ImageInputStream; import javax.imageio.stream.ImageInputStream;
import javax.imageio.stream.ImageOutputStream; import javax.imageio.stream.ImageOutputStream;
public class ImageIO { public class SImageIO {
public static ImageOutputStream createImageOutputStream(OutputStream os) throws IOException { public static ImageOutputStream createImageOutputStream(OutputStream os) throws IOException {
return javax.imageio.ImageIO.createImageOutputStream(os); return javax.imageio.ImageIO.createImageOutputStream(os);

View File

@ -45,7 +45,7 @@ import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.ugraphic.AffineTransformType; import net.sourceforge.plantuml.ugraphic.AffineTransformType;
import net.sourceforge.plantuml.ugraphic.PixelImage; import net.sourceforge.plantuml.ugraphic.PixelImage;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -87,7 +87,7 @@ public class SpriteImage implements Sprite {
return null; return null;
} }
try { try {
return new SpriteImage(ImageIO.read(is)); return new SpriteImage(SImageIO.read(is));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
return null; return null;

View File

@ -69,7 +69,7 @@ import net.sourceforge.plantuml.FileUtils;
import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.Log;
import net.sourceforge.plantuml.SignatureUtils; import net.sourceforge.plantuml.SignatureUtils;
import net.sourceforge.plantuml.code.Base64Coder; import net.sourceforge.plantuml.code.Base64Coder;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.security.SecurityUtils; import net.sourceforge.plantuml.security.SecurityUtils;
import net.sourceforge.plantuml.tikz.TikzGraphics; import net.sourceforge.plantuml.tikz.TikzGraphics;
import net.sourceforge.plantuml.ugraphic.UGroupType; import net.sourceforge.plantuml.ugraphic.UGroupType;
@ -848,7 +848,7 @@ public class SvgGraphics {
private String toBase64(BufferedImage image) throws IOException { private String toBase64(BufferedImage image) throws IOException {
final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(image, "png", baos); SImageIO.write(image, "png", baos);
final byte data[] = baos.toByteArray(); final byte data[] = baos.toByteArray();
return new String(Base64Coder.encode(data)); return new String(Base64Coder.encode(data));
} }

View File

@ -71,7 +71,7 @@ import javax.swing.WindowConstants;
import net.sourceforge.plantuml.GeneratedImage; import net.sourceforge.plantuml.GeneratedImage;
import net.sourceforge.plantuml.ImageSelection; import net.sourceforge.plantuml.ImageSelection;
import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.graphic.GraphicStrings;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.svek.TextBlockBackcolored;
import net.sourceforge.plantuml.version.PSystemVersion; import net.sourceforge.plantuml.version.PSystemVersion;
@ -314,7 +314,7 @@ class ImageWindow extends JFrame {
final File png = generatedImage.getPngFile(); final File png = generatedImage.getPngFile();
BufferedImage image = null; BufferedImage image = null;
try { try {
image = ImageIO.read(new SFile(png.getAbsolutePath())); image = SImageIO.read(new SFile(png.getAbsolutePath()));
if (sizeMode == SizeMode.ZOOM_FIT) { if (sizeMode == SizeMode.ZOOM_FIT) {
final Dimension imageDim = new Dimension(image.getWidth(), image.getHeight()); final Dimension imageDim = new Dimension(image.getWidth(), image.getHeight());
final Dimension newImgDim = ImageHelper.getScaledDimension(imageDim, final Dimension newImgDim = ImageHelper.getScaledDimension(imageDim,
@ -335,7 +335,7 @@ class ImageWindow extends JFrame {
final TextBlockBackcolored error = GraphicStrings.createForError(Arrays.asList(msg), false); final TextBlockBackcolored error = GraphicStrings.createForError(Arrays.asList(msg), false);
try { try {
final byte[] bytes = plainPngBuilder(error).writeByteArray(); final byte[] bytes = plainPngBuilder(error).writeByteArray();
image = ImageIO.read(bytes); image = SImageIO.read(bytes);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -389,7 +389,7 @@ class ImageWindow extends JFrame {
} }
try { try {
final File png = generatedImage.getPngFile(); final File png = generatedImage.getPngFile();
final Image image = ImageIO.read(png); final Image image = SImageIO.read(png);
final ImageSelection imgSel = new ImageSelection(image); final ImageSelection imgSel = new ImageSelection(image);
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(imgSel, null); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(imgSel, null);
} catch (IOException e) { } catch (IOException e) {

View File

@ -56,7 +56,7 @@ import javax.xml.transform.TransformerException;
import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.svg.LengthAdjust; import net.sourceforge.plantuml.svg.LengthAdjust;
import net.sourceforge.plantuml.svg.SvgGraphics; import net.sourceforge.plantuml.svg.SvgGraphics;
@ -183,7 +183,7 @@ public class FontChecker {
} }
}; };
final byte[] bytes = plainPngBuilder(drawable).writeByteArray(); final byte[] bytes = plainPngBuilder(drawable).writeByteArray();
return ImageIO.read(bytes); return SImageIO.read(bytes);
} }
// public BufferedImage getBufferedImageOld(char c) throws IOException { // public BufferedImage getBufferedImageOld(char c) throws IOException {

View File

@ -80,7 +80,7 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.mjpeg.MJPEGGenerator; import net.sourceforge.plantuml.mjpeg.MJPEGGenerator;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
@ -395,7 +395,7 @@ public class ImageBuilder {
final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final ByteArrayOutputStream baos = new ByteArrayOutputStream();
writeImageInternal(new FileFormatOption(FileFormat.PNG), baos, Animation.singleton(affineTransform)); writeImageInternal(new FileFormatOption(FileFormat.PNG), baos, Animation.singleton(affineTransform));
baos.close(); baos.close();
return ImageIO.read(baos.toByteArray()); return SImageIO.read(baos.toByteArray());
} }
private UGraphic createUGraphic(FileFormatOption option, final Dimension2D dim, Animation animationArg, double dx, private UGraphic createUGraphic(FileFormatOption option, final Dimension2D dim, Animation animationArg, double dx,

View File

@ -49,7 +49,7 @@ import java.util.prefs.Preferences;
import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.Log;
import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.SignatureUtils; import net.sourceforge.plantuml.SignatureUtils;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
public class LicenseInfo { public class LicenseInfo {
@ -154,7 +154,7 @@ public class LicenseInfo {
return null; return null;
} }
try { try {
final BufferedImage result = ImageIO.read(dis); final BufferedImage result = SImageIO.read(dis);
return result; return result;
} finally { } finally {
dis.close(); dis.close();

View File

@ -53,7 +53,7 @@ import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
import net.sourceforge.plantuml.dedication.PSystemDedication; import net.sourceforge.plantuml.dedication.PSystemDedication;
import net.sourceforge.plantuml.preproc.Stdlib; import net.sourceforge.plantuml.preproc.Stdlib;
import net.sourceforge.plantuml.preproc2.PreprocessorUtils; import net.sourceforge.plantuml.preproc2.PreprocessorUtils;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.security.SecurityProfile; import net.sourceforge.plantuml.security.SecurityProfile;
import net.sourceforge.plantuml.security.SecurityUtils; import net.sourceforge.plantuml.security.SecurityUtils;
@ -116,7 +116,7 @@ public class PSystemVersion extends PlainStringsDiagram {
private static BufferedImage getImage(final String name) { private static BufferedImage getImage(final String name) {
try { try {
final InputStream is = PSystemVersion.class.getResourceAsStream(name); final InputStream is = PSystemVersion.class.getResourceAsStream(name);
final BufferedImage image = ImageIO.read(is); final BufferedImage image = SImageIO.read(is);
is.close(); is.close();
return image; return image;
} catch (IOException e) { } catch (IOException e) {

View File

@ -14,7 +14,7 @@ import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.SourceStringReader; import net.sourceforge.plantuml.SourceStringReader;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.error.PSystemError; import net.sourceforge.plantuml.error.PSystemError;
import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SImageIO;
public class PlantUmlTestUtils { public class PlantUmlTestUtils {
@ -51,7 +51,7 @@ public class PlantUmlTestUtils {
} }
public BufferedImage asImage() throws IOException { public BufferedImage asImage() throws IOException {
return ImageIO.read(asByteArray(FileFormat.PNG)); return SImageIO.read(asByteArray(FileFormat.PNG));
} }
public String asString() throws IOException { public String asString() throws IOException {