public static void main(String[] args){
        //请求接口路径
        String url = "http://192.168.1.5/test.html";
        String input = null;
        InputStream inputStream = null;
        BufferedReader bufferedReader = null;
        StringBuilder stringBuilder = new StringBuilder();
        try {
            inputStream = new URL(url).openStream();
            bufferedReader = new BufferedReader(new InputStreamReader(inputStream,"utf-8"));//设置编码,否则中文乱码
            while ((input = bufferedReader.readLine()) != null)
                stringBuilder.append(input);           
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            System.out.println(stringBuilder.toString());
            try {
                if (inputStream != null)
                    inputStream.close();
                if (bufferedReader != null)
                    bufferedReader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }