kinow commented on a change in pull request #38: Cleaned up PNG component.
URL: https://github.com/apache/commons-imaging/pull/38#discussion_r284485489
 
 

 ##########
 File path: 
src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
 ##########
 @@ -222,58 +261,39 @@ public void readSignature(final InputStream is) throws 
ImageReadException,
 
     }
 
-    private List<PngChunk> readChunks(final ByteSource byteSource, final 
ChunkType[] chunkTypes,
-            final boolean returnAfterFirst) throws ImageReadException, 
IOException {
-        try (InputStream is = byteSource.getInputStream()) {
-            readSignature(is);
-            return readChunks(is, chunkTypes, returnAfterFirst);
-        }
-    }
-
     @Override
     public byte[] getICCProfileBytes(final ByteSource byteSource, final 
Map<String, Object> params)
             throws ImageReadException, IOException {
-        final List<PngChunk> chunks = readChunks(byteSource, new ChunkType[] { 
ChunkType.iCCP },
-                true);
-
-        if ((chunks == null) || (chunks.isEmpty())) {
-            // throw new ImageReadException("Png: No chunks");
+        final PngChunkIccp pngChunkiCCP = (PngChunkIccp) 
ICCP_SEL.filterOnlyOne(
+                ChunkReader.newInstance(byteSource).readChunks(ICCP_SEL, 
true));
+        
 
 Review comment:
   Spaces.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to