/**
 * $URL: $
 * DAAND
 * Copyright (C) 2004 - 2013, INSIDE Secure BV.  All rights reserved.
 */
package com.insidesecure.drm.android.reference.customdata.inline;

import java.util.regex.*;

import com.insidesecure.drm.android.reference.customdata.CustomDataProvider;

public class InlineCustomDataProvider implements CustomDataProvider
{
    private static final String TAG = "InlineCustomDataProvider";

    private static final Pattern INLINE_CUSTOM_DATA_VALUE_PATTERN = Pattern.compile("<CustomDataParameters><Value>(.*)</Value></CustomDataParameters>");

    public String getCustomData(String parametersString) throws Exception
    {
        final Matcher matcher = INLINE_CUSTOM_DATA_VALUE_PATTERN.matcher(parametersString);
        if (matcher.matches())
        {
            return matcher.group(1);
        }
        return null;
    }

}
