private IcnsElement readIcnsElement(final InputStream is, final int remainingSize) throws IOException {
        // Icon type (4 bytes)
        final int type = read4Bytes("Type", is, "Not a valid ICNS file", getByteOrder());
        // Length of data (4 bytes), in bytes, including this header
        final int elementSize = read4Bytes("ElementSize", is, "Not a valid ICNS file", getByteOrder());
        if (elementSize > remainingSize) {
            throw new IOException(String.format("Corrupted ICNS file: element size %d is greater than " + "remaining size %d", elementSize, remainingSize));
        }
        final byte[] data = readBytes("Data", is, elementSize - 8, "Not a valid ICNS file");

        return new IcnsElement(type, elementSize, data);
    }
Constructs a new instance with the big-endian byte order.
src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java