[ 
https://issues.apache.org/jira/browse/IMAGING-339?focusedWorklogId=838952&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-838952
 ]

ASF GitHub Bot logged work on IMAGING-339:
------------------------------------------

                Author: ASF GitHub Bot
            Created on: 12/Jan/23 21:08
            Start Date: 12/Jan/23 21:08
    Worklog Time Spent: 10m 
      Work Description: kinow commented on code in PR #254:
URL: https://github.com/apache/commons-imaging/pull/254#discussion_r1068655185


##########
src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunk.java:
##########
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging.formats.webp.chunks;
+
+import org.apache.commons.imaging.ImageReadException;
+import org.apache.commons.imaging.common.BinaryFileParser;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.nio.ByteOrder;
+import java.nio.charset.StandardCharsets;
+
+public abstract class WebPChunk extends BinaryFileParser {
+    public static final int TYPE_VP8 = 0x20385056;
+    public static final int TYPE_VP8L = 0x4C385056;
+    public static final int TYPE_VP8X = 0x58385056;
+    public static final int TYPE_ANIM = 0x4D494E41;
+    public static final int TYPE_ANMF = 0x464D4E41;
+    public static final int TYPE_ICCP = 0x50434349;
+    public static final int TYPE_EXIF = 0x46495845;
+    public static final int TYPE_XMP = 0x20504D58;
+
+    private final int type;
+    private final int size;
+    protected final byte[] bytes;
+
+    WebPChunk(int type, int size, byte[] bytes) throws ImageReadException {
+        super(ByteOrder.LITTLE_ENDIAN);
+
+        if (size != bytes.length) {
+            throw new AssertionError("Chunk size must match bytes length");

Review Comment:
   I think it'd be important to be consistent, so users are not surprised when 
using the API. Have a look at the other parsers, @Glavo , and see what 
exceptions are being used. If you believe we must change it to another 
exception type, then we can create a follow up issue to discuss and plan how to 
do that in all other parsers :+1: 





Issue Time Tracking
-------------------

    Worklog Id:     (was: 838952)
    Time Spent: 0.5h  (was: 20m)

> Basic WebP support
> ------------------
>
>                 Key: IMAGING-339
>                 URL: https://issues.apache.org/jira/browse/IMAGING-339
>             Project: Commons Imaging
>          Issue Type: Improvement
>          Components: Format: WebP
>    Affects Versions: 1.0-alpha2
>            Reporter: Bruno P. Kinoshita
>            Assignee: Bruno P. Kinoshita
>            Priority: Minor
>             Fix For: 1.0-alpha3
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Placeholder for https://github.com/apache/commons-imaging/pull/254



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to