FormFieldRequestParameter.java 1.74 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  org.apache.sling.api.request.RequestParameter
 *  org.slf4j.Logger
 *  org.slf4j.LoggerFactory
 */
package com.adobe.aemds.guide.submitutils;

import com.adobe.aemds.guide.service.GuideException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import org.apache.sling.api.request.RequestParameter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class FormFieldRequestParameter
implements RequestParameter {
    private String parameterValue;
    private Logger logger = LoggerFactory.getLogger(FormFieldRequestParameter.class);

    public FormFieldRequestParameter(String parameterValue) {
        this.parameterValue = parameterValue;
    }

    public InputStream getInputStream() {
        InputStream is = null;
        return is;
    }

    public String getFileName() {
        return null;
    }

    public boolean isFormField() {
        return true;
    }

    public String getContentType() {
        return null;
    }

    public String getName() {
        return null;
    }

    public byte[] get() {
        return this.parameterValue.getBytes();
    }

    public String getString() {
        return this.parameterValue;
    }

    public String getString(String encoding) {
        String result = null;
        try {
            byte[] bytes = this.get();
            result = new String(bytes, encoding);
        }
        catch (UnsupportedEncodingException e) {
            this.logger.error("Exception in encoding : " + e.getMessage(), (Throwable)e);
            throw new GuideException(e);
        }
        return result;
    }

    public long getSize() {
        byte[] bytes = this.get();
        return bytes.length;
    }
}