YunkuJavaSDK/src/main/java/com/yunkuent/sdk/MsMultiPartFormData.java
public void addFilePart(String fieldName, InputStream inputStream, String fileName)
            throws IOException {
        writer.append("--" + boundary).append(LINE_FEED);
        writer.append(
                "Content-Disposition: form-data; name=\"" + fieldName
                        + "\"; filename=\"" + fileName + "\"")
                .append(LINE_FEED);
        writer.append(
                "Content-Type: "
                        + URLConnection.guessContentTypeFromName(fileName))
                .append(LINE_FEED);
        writer.append("Content-Transfer-Encoding: binary").append(LINE_FEED);
        writer.append(LINE_FEED);
        writer.flush();

//        FileInputStream inputStream = new FileInputStream(uploadFile);
        byte[] buffer = new byte[4096];
        int bytesRead = -1;
        while ((bytesRead = inputStream.read(buffer)) != -1) {
            outputStream.write(buffer, 0, bytesRead);
        }
        outputStream.flush();
        inputStream.close();

//        writer.append(LINE_FEED);
//        writer.flush();
    }
/**
     * Adds a upload file section to the request
     *
     * @param fieldName name attribute in "input"
     * @throws java.io.IOException
     */
Adds a upload file section to the request
@param fieldName name attribute in "input"
@throws java.io.IOException
Adds a upload file section to the request @param fieldName name attribute in " input " @throws java . io . IOException
public void addFilePart(String fieldName, InputStream inputStream, String fileName)
            throws IOException {
        writer.append("--" + boundary).append(LINE_FEED);
        writer.append(
                "Content-Disposition: form-data; name=\"" + fieldName
                        + "\"; filename=\"" + fileName + "\"")
                .append(LINE_FEED);
        writer.append(
                "Content-Type: "
                        + URLConnection.guessContentTypeFromName(fileName))
                .append(LINE_FEED);
        writer.append("Content-Transfer-Encoding: binary").append(LINE_FEED);
        writer.append(LINE_FEED);
        writer.flush();
        byte[] buffer = new byte[4096];
        int bytesRead = -1;
        while ((bytesRead = inputStream.read(buffer)) != -1) {
            outputStream.write(buffer, 0, bytesRead);
        }
        outputStream.flush();
        inputStream.close();
    }
public void addFilePart ( String fieldName , InputStream inputStream , String fileName ) throws IOException { writer . append ( "--" + boundary ) . append ( LINE_FEED ) ; writer . append ( "Content-Disposition: form-data; name=\"" + fieldName + "\"; filename=\"" + fileName + "\"" ) . append ( LINE_FEED ) ; writer . append ( "Content-Type: " + URLConnection . guessContentTypeFromName ( fileName ) ) . append ( LINE_FEED ) ; writer . append ( "Content-Transfer-Encoding: binary" ) . append ( LINE_FEED ) ; writer . append ( LINE_FEED ) ; writer . flush ( ) ; byte [ ] buffer = new byte [ 4096 ] ; int bytesRead = - 1 ; while ( ( bytesRead = inputStream . read ( buffer ) ) != - 1 ) { outputStream . write ( buffer , 0 , bytesRead ) ; } outputStream . flush ( ) ; inputStream . close ( ) ; }
Adds a upload file section to the request
 @param fieldName name attribute in "input"
 @throws java.io.IOException
Adds a upload file section to the request @param fieldName name attribute in " input " @throws java . io . IOException
//        FileInputStream inputStream = new FileInputStream(uploadFile); //        writer.append(LINE_FEED); //        writer.flush();