Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.UnsupportedEncodingException;

public class Main {
    private static byte[] getTextParameters(String fieldName, String fieldValue, String charset)
            throws UnsupportedEncodingException {
        StringBuilder sb = new StringBuilder();
        sb.append("Content-Disposition:form-data;name=\"");
        sb.append(fieldName);
        sb.append("\"Content-Type:text/plain\r\n\r\n");
        sb.append(fieldValue);
        return sb.toString().getBytes(charset);
    }
}