src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 342,354 **** IHDR_colorType = PNGImageReader.PNG_COLOR_GRAY; } else { IHDR_colorType = PNGImageReader.PNG_COLOR_PALETTE; PLTE_present = true; PLTE_order = null; ! PLTE_red = (byte[])reds.clone(); ! PLTE_green = (byte[])greens.clone(); ! PLTE_blue = (byte[])blues.clone(); if (hasAlpha) { tRNS_present = true; tRNS_colorType = PNGImageReader.PNG_COLOR_PALETTE; --- 342,354 ---- IHDR_colorType = PNGImageReader.PNG_COLOR_GRAY; } else { IHDR_colorType = PNGImageReader.PNG_COLOR_PALETTE; PLTE_present = true; PLTE_order = null; ! PLTE_red = reds.clone(); ! PLTE_green = greens.clone(); ! PLTE_blue = blues.clone(); if (hasAlpha) { tRNS_present = true; tRNS_colorType = PNGImageReader.PNG_COLOR_PALETTE;
*** 428,438 **** if (in == null) { return null; } else { ArrayList<byte[]> list = new ArrayList<byte[]>(in.size()); for (byte[] b: in) { ! list.add((b == null) ? null : (byte[])b.clone()); } return list; } } --- 428,438 ---- if (in == null) { return null; } else { ArrayList<byte[]> list = new ArrayList<byte[]>(in.size()); for (byte[] b: in) { ! list.add((b == null) ? null : b.clone()); } return list; } }
*** 701,712 **** // tEXt if (tEXt_keyword.size() > 0) { IIOMetadataNode tEXt_parent = new IIOMetadataNode("tEXt"); for (int i = 0; i < tEXt_keyword.size(); i++) { IIOMetadataNode tEXt_node = new IIOMetadataNode("tEXtEntry"); ! tEXt_node.setAttribute("keyword" , (String)tEXt_keyword.get(i)); ! tEXt_node.setAttribute("value" , (String)tEXt_text.get(i)); tEXt_parent.appendChild(tEXt_node); } root.appendChild(tEXt_parent); --- 701,712 ---- // tEXt if (tEXt_keyword.size() > 0) { IIOMetadataNode tEXt_parent = new IIOMetadataNode("tEXt"); for (int i = 0; i < tEXt_keyword.size(); i++) { IIOMetadataNode tEXt_node = new IIOMetadataNode("tEXtEntry"); ! tEXt_node.setAttribute("keyword" , tEXt_keyword.get(i)); ! tEXt_node.setAttribute("value" , tEXt_text.get(i)); tEXt_parent.appendChild(tEXt_node); } root.appendChild(tEXt_parent);
*** 757,773 **** // zTXt if (zTXt_keyword.size() > 0) { IIOMetadataNode zTXt_parent = new IIOMetadataNode("zTXt"); for (int i = 0; i < zTXt_keyword.size(); i++) { IIOMetadataNode zTXt_node = new IIOMetadataNode("zTXtEntry"); ! zTXt_node.setAttribute("keyword", (String)zTXt_keyword.get(i)); ! int cm = ((Integer)zTXt_compressionMethod.get(i)).intValue(); zTXt_node.setAttribute("compressionMethod", zTXt_compressionMethodNames[cm]); ! zTXt_node.setAttribute("text", (String)zTXt_text.get(i)); zTXt_parent.appendChild(zTXt_node); } root.appendChild(zTXt_parent); --- 757,773 ---- // zTXt if (zTXt_keyword.size() > 0) { IIOMetadataNode zTXt_parent = new IIOMetadataNode("zTXt"); for (int i = 0; i < zTXt_keyword.size(); i++) { IIOMetadataNode zTXt_node = new IIOMetadataNode("zTXtEntry"); ! zTXt_node.setAttribute("keyword", zTXt_keyword.get(i)); ! int cm = (zTXt_compressionMethod.get(i)).intValue(); zTXt_node.setAttribute("compressionMethod", zTXt_compressionMethodNames[cm]); ! zTXt_node.setAttribute("text", zTXt_text.get(i)); zTXt_parent.appendChild(zTXt_node); } root.appendChild(zTXt_parent);
*** 779,790 **** new IIOMetadataNode("UnknownChunks"); for (int i = 0; i < unknownChunkType.size(); i++) { IIOMetadataNode unknown_node = new IIOMetadataNode("UnknownChunk"); unknown_node.setAttribute("type", ! (String)unknownChunkType.get(i)); ! unknown_node.setUserObject((byte[])unknownChunkData.get(i)); unknown_parent.appendChild(unknown_node); } root.appendChild(unknown_parent); --- 779,790 ---- new IIOMetadataNode("UnknownChunks"); for (int i = 0; i < unknownChunkType.size(); i++) { IIOMetadataNode unknown_node = new IIOMetadataNode("UnknownChunk"); unknown_node.setAttribute("type", ! unknownChunkType.get(i)); ! unknown_node.setUserObject(unknownChunkData.get(i)); unknown_parent.appendChild(unknown_node); } root.appendChild(unknown_parent);
*** 1014,1025 **** IIOMetadataNode text_node = new IIOMetadataNode("Text"); IIOMetadataNode node = null; // scratch node for (int i = 0; i < tEXt_keyword.size(); i++) { node = new IIOMetadataNode("TextEntry"); ! node.setAttribute("keyword", (String)tEXt_keyword.get(i)); ! node.setAttribute("value", (String)tEXt_text.get(i)); node.setAttribute("encoding", "ISO-8859-1"); node.setAttribute("compression", "none"); text_node.appendChild(node); } --- 1014,1025 ---- IIOMetadataNode text_node = new IIOMetadataNode("Text"); IIOMetadataNode node = null; // scratch node for (int i = 0; i < tEXt_keyword.size(); i++) { node = new IIOMetadataNode("TextEntry"); ! node.setAttribute("keyword", tEXt_keyword.get(i)); ! node.setAttribute("value", tEXt_text.get(i)); node.setAttribute("encoding", "ISO-8859-1"); node.setAttribute("compression", "none"); text_node.appendChild(node); }
*** 1039,1050 **** text_node.appendChild(node); } for (int i = 0; i < zTXt_keyword.size(); i++) { node = new IIOMetadataNode("TextEntry"); ! node.setAttribute("keyword", (String)zTXt_keyword.get(i)); ! node.setAttribute("value", (String)zTXt_text.get(i)); node.setAttribute("compression", "zip"); text_node.appendChild(node); } --- 1039,1050 ---- text_node.appendChild(node); } for (int i = 0; i < zTXt_keyword.size(); i++) { node = new IIOMetadataNode("TextEntry"); ! node.setAttribute("keyword", zTXt_keyword.get(i)); ! node.setAttribute("value", zTXt_text.get(i)); node.setAttribute("compression", "zip"); text_node.appendChild(node); }
*** 1398,1409 **** } if (!(compressedProfile instanceof byte[])) { fatal(node, "User object not a byte array!"); } ! iCCP_compressedProfile = ! (byte[])((byte[])compressedProfile).clone(); iCCP_present = true; } else if (name.equals("iTXt")) { Node iTXt_node = node.getFirstChild(); while (iTXt_node != null) { --- 1398,1408 ---- } if (!(compressedProfile instanceof byte[])) { fatal(node, "User object not a byte array!"); } ! iCCP_compressedProfile = ((byte[])compressedProfile).clone(); iCCP_present = true; } else if (name.equals("iTXt")) { Node iTXt_node = node.getFirstChild(); while (iTXt_node != null) {