发送多组件请求（例如包含文件的表单）

@throws IOException
19148
private void sendMultipart() throws IOException {
		setMultipart();// 设置表单类型为Multipart

		final OutputStream out = this.httpConnection.getOutputStream();
		try {
			writeFileForm(out);
			writeForm(out);
			formEnd(out);
		} catch (IOException e) {
			throw e;
		} finally {
			IoUtil.close(out);
		}
	}
1265577
public void write(File file) throws IOException {
        try (InputStream inputStream = getInputStream()) {
            IoUtils.copy(inputStream, file);
        }
    }
1083702
public static String loadString(String file) throws IOException {
		StringBuilder sb = new StringBuilder();
		UnicodeReader reader = new UnicodeReader(new FileInputStream(file), "utf8");
		int n;	
		char[] cs = new char[256];
		while ((n = reader.read(cs)) != -1) {		
			sb.append(Arrays.copyOfRange(cs, 0, n));			
		}
		return sb.toString();
	}
614099
public static String readTextFile(File file) throws IOException
    {
        //create reader to file (with default encoding)
        InputStream inputStream=new FileInputStream(file);
        Reader reader=IOHelper.createReader(inputStream,null);

        //read text
        String text=IOHelper.readTextStream(reader);
        
        return text;
    }
1227555
private InputStream openFile() throws IOException {
    Path file = Paths.get(filePath);
    if (Files.exists(file)) {
      return Files.newInputStream(file);
    }
    InputStream input = getClass().getResourceAsStream(filePath);
    checkArgument(input != null, "Could not find file: " + filePath);
    return input;
  }
667872
protected void readFileId() throws IOException {
    byte[] b = new byte[HEADER.length];
    in.readFully(b);

    if (!Arrays.equals(b, HEADER)) {
      throw new IOException(
          "file_id_string does not match. got: " + new String(b, Charsets.ISO_8859_1));
    }
  }
958301
static String getFile( String name )
        throws FileNotFoundException, IOException
    {
        StringBuilder sb = new StringBuilder();
        try ( BufferedReader bin = new BufferedReader( new FileReader( name ) ) ) {
            String line;
            while ( (line=bin.readLine()) != null )
                sb.append( line ).append( "\n" );
        }
        return sb.toString();
    }
995694
public void save() throws IOException {
        JFileChooser fc = FileChooser.getInstance();
        fc.setFileFilter(FileChooser.SimpleFileFilter.getWritableImageFIlter());
        fc.setAcceptAllFileFilterUsed(false);
        fc.setSelectedFiles(new File[0]);
        int returnVal = fc.showSaveDialog(this);

        if (returnVal == JFileChooser.APPROVE_OPTION) {
            File file = fc.getSelectedFile();
            save(file);
        }        
    }
1191908
private void openInputFile(final String inputFileName) throws IOException
	{
		myInputFile = new File(inputFileName);
		myInputStream = new FileInputStream(myInputFile);
		myStreamReader = new InputStreamReader(myInputStream, getInputEncodingCode());
		myBufferedReader = new BufferedReader(myStreamReader);
		myLineReader = new LineNumberReader(myBufferedReader);
	}
1063063
private void init(InputStream in) throws java.io.IOException {
        if (in.available() > 2000000) {
        	throw new IOException("Font too big");
        }
        this.file = IOUtils.toByteArray(in);
        this.fsize = this.file.length;
        if (fsize > 2000000) {
        	throw new IOException("Font too big");
        }
        this.current = 0;
    }
465625
private void readFile()
            throws IOException
    {
        BufferedReader reader = null;

        try {
            reader = new BufferedReader( new InputStreamReader( new FileInputStream( file ), PcsUtils.UTF8 ) );

            LOGGER.debug( "Reading credentials file {}", file );

            String line;
            int index = 1;

            while ( ( line = reader.readLine() ) != null ) {
                line = line.trim();

                if ( line.startsWith( "#" ) || line.length() == 0 ) {
                    continue;
                }

                String[] userCredentialsArray = line.split( "=", 2 );

                if ( userCredentialsArray.length != 2 ) {
                    throw new IllegalArgumentException( "Not parsable line #" + index );
                }

                // Key
                final String key = userCredentialsArray[0].trim();
                final Credentials value = Credentials.createFromJson( userCredentialsArray[1].trim() );

                credentialsMap.put( key, value );

                index++;
            }

        } finally {
            PcsUtils.closeQuietly( reader );
        }
    }
828394
@SuppressWarnings("DefaultCharset")
    public static String readFileOrThrow(File file) throws IOException {
        try (Reader reader = new FileReader(file)) {
            char[] buf = new char[8192];
            int len;
            StringBuilder s = new StringBuilder();
            while ((len = reader.read(buf)) >= 0) {
                s.append(buf, 0, len);
            }
            return s.toString();
        }
    }
1053682
public static byte[] read(File file) throws IOException {
        FileInputStream is = new FileInputStream(file);
        try {
            return bytes(is);
        } finally {
            closeQuietly(is);
        }
    }
1071242
public boolean read() throws IOException
    {
        valid = false;
        File file = new File(filename);
        FileReader reader = new FileReader(file);
        if(file.exists())
        {
            // Load the file contents
            contents = getContents(reader, "\n");
            if(contents != null)
                valid = true;
            else
                logger.severe("Unable to read file contents: "+file.getAbsolutePath());
        }
        else
        {
            logger.severe("File does not exist: "+file.getAbsolutePath());
        }

        try
        {
            if(reader != null)
                reader.close();
        }
        catch(IOException e)
        {
        }

        return valid;
    }
843106
public static String readFromFileIntoString(File file) throws IOException {
        FileInputStream inputStream = new FileInputStream(file);
        BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
        StringBuilder text = new StringBuilder();

        String line;
        while( (line = reader.readLine()) != null) {
            text.append(line).append("\n");
        }
        inputStream.close();

        return text.toString();
    }
656188
public static void copy(File from, File to) throws IOException {
        if (from.isDirectory())
            copyDir(from, to);
        else
            copyFile(from, to);
    }
1014564
public int read() throws IOException {
        int c = super.read();
        if( c == -1 && filenames.hasNext() ) {
            cueStream();
            return read();
        }
        return c;
    }