【问题标题】:sending binary data via POST on android在android上通过POST发送二进制数据
【发布时间】:2011-03-04 05:45:00
【问题描述】:

Android 支持有限版本的 apache 的 http 客户端 (v4)。 通常,如果我想通过 POST 使用 content type= application/octet-stream 发送二进制数据, 我执行以下操作:

HttpClient 客户端 = getHttpClient(); HttpPost method=new HttpPost("http://192.168.0.1:8080/xxx"); System.err.println("发送到服务器"+s); 如果(压缩){ 字节[]压缩=压缩(s); RequestEntity 实体 = new ByteArrayRequestEntity(压缩); 方法.setEntity(实体); } HttpResponse resp=client.execute(method);

但是 ByteArrayRequestEntity 在 android 上不受支持。我该怎么办?

【问题讨论】:

    标签: android http client


    【解决方案1】:

    我想你想要ByteArrayEntityByteArrayRequestEntity 来自 3.x

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-13
      • 2012-02-18
      • 2023-03-25
      • 2012-01-02
      • 1970-01-01
      • 1970-01-01
      • 2019-11-24
      • 1970-01-01
      相关资源
      最近更新 更多