private PsdImageContents readImageContents(final InputStream is) throws ImagingException, IOException {
        final PsdHeaderInfo header = readHeader(is);

        final int colorModeDataLength = BinaryFunctions.read4Bytes("ColorModeDataLength", is, "Not a Valid PSD File", getByteOrder());
        BinaryFunctions.skipBytes(is, colorModeDataLength);
        // is.skip(ColorModeDataLength);
        // byte[] ColorModeData = readByteArray("ColorModeData",
        // ColorModeDataLength, is, "Not a Valid PSD File");

        final int imageResourcesLength = BinaryFunctions.read4Bytes("ImageResourcesLength", is, "Not a Valid PSD File", getByteOrder());
        BinaryFunctions.skipBytes(is, imageResourcesLength);
        // long skipped = is.skip(ImageResourcesLength);
        // byte[] ImageResources = readByteArray("ImageResources",
        // ImageResourcesLength, is, "Not a Valid PSD File");

        final int layerAndMaskDataLength = BinaryFunctions.read4Bytes("LayerAndMaskDataLength", is, "Not a Valid PSD File", getByteOrder());
        BinaryFunctions.skipBytes(is, layerAndMaskDataLength);
        // is.skip(LayerAndMaskDataLength);
        // byte[] LayerAndMaskData = readByteArray("LayerAndMaskData",
        // LayerAndMaskDataLength, is, "Not a Valid PSD File");

        final int compression = BinaryFunctions.read2Bytes("Compression", is, "Not a Valid PSD File", getByteOrder());

        // skip_bytes(is, LayerAndMaskDataLength);
        // byte[] ImageData = readByteArray("ImageData", LayerAndMaskDataLength,
        // is, "Not a Valid PSD File");

        // System.out.println("Compression: " + Compression);

        return new PsdImageContents(header, colorModeDataLength,
                // ColorModeData,
                imageResourcesLength,
                // ImageResources,
                layerAndMaskDataLength,
                // LayerAndMaskData,
                compression);
    }
Extracts embedded XML metadata as XML string.

@param byteSource File containing image data.
@param params     Map of optional parameters, defined in ImagingConstants.
@return Xmp Xml as String, if present. Otherwise, returns null.
src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java