• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ByteArrayPool类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.android.volley.toolbox.ByteArrayPool的典型用法代码示例。如果您正苦于以下问题:Java ByteArrayPool类的具体用法?Java ByteArrayPool怎么用?Java ByteArrayPool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ByteArrayPool类属于com.android.volley.toolbox包,在下文中一共展示了ByteArrayPool类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: entityToBytes

import com.android.volley.toolbox.ByteArrayPool; //导入依赖的package包/类
/** Reads the contents of HttpEntity into a byte[]. */
public static byte[] entityToBytes(InputStream inputStream, long contentLength, int bufferSize) throws IOException, ServerError {
    ByteArrayPool bytePool = new ByteArrayPool(bufferSize);
    PoolingByteArrayOutputStream bytes = new PoolingByteArrayOutputStream(bytePool, (int)contentLength);
    byte[] buffer = null;
    try {
        if (inputStream == null) {
            throw new ServerError();
        }
        buffer = bytePool.getBuf(1024);
        int count;
        while ((count = inputStream.read(buffer)) != -1) {
            bytes.write(buffer, 0, count);
        }
        return bytes.toByteArray();
    } finally {
        try {
            // Close the InputStream and release the resources by "consuming the content".
            inputStream.close();
        } catch (IOException e) {
            // This can happen if there was an exception above that left the entity in
            // an invalid state.
            VolleyLog.v("Error occured when calling consumingContent");
        }
        bytePool.returnBuf(buffer);
        bytes.close();
    }
}
 
开发者ID:HujiangTechnology,项目名称:RestVolley,代码行数:29,代码来源:StreamBasedNetwork.java


示例2: CastWebServer

import com.android.volley.toolbox.ByteArrayPool; //导入依赖的package包/类
public CastWebServer(Context context, String host, int port) {
    super(host, port);
    mContext = context;
    // get the lock
    mWifiLock = ((WifiManager) mContext.getSystemService(Context.WIFI_SERVICE)).createWifiLock(WifiManager.WIFI_MODE_FULL, "CastServer");
    mWifiLock.setReferenceCounted(false);
    // arbitrary size might increase as needed;
    mEtagCache = new LruCache<>(20);
    mBytePool = new ByteArrayPool(2*1024*1024);
}
 
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:11,代码来源:CastWebServer.java


示例3: QMusicNetwork

import com.android.volley.toolbox.ByteArrayPool; //导入依赖的package包/类
/**
 * @param httpStack
 *            HTTP stack to be used
 */
public QMusicNetwork(HttpStack httpStack) {
	// If a pool isn't passed in, then build a small default pool that will
	// give us a lot of
	// benefit and not use too much memory.
	this(httpStack, new ByteArrayPool(DEFAULT_POOL_SIZE));
}
 
开发者ID:qianweicheng,项目名称:Qmusic,代码行数:11,代码来源:QMusicNetwork.java


示例4: BaseNetwork

import com.android.volley.toolbox.ByteArrayPool; //导入依赖的package包/类
/**
 * @param httpStack HTTP stack to be used
 */
public BaseNetwork(HttpStack httpStack) {
    // If a pool isn't passed in, then build a small default pool that will give us a lot of
    // benefit and not use too much memory.
    this(httpStack, new ByteArrayPool(DEFAULT_POOL_SIZE));
}
 
开发者ID:HanyeeWang,项目名称:GeekZone,代码行数:9,代码来源:BaseNetwork.java


示例5: DrBasicNetwork

import com.android.volley.toolbox.ByteArrayPool; //导入依赖的package包/类
/**
 * @param httpStack HTTP stack to be used
 */
public DrBasicNetwork(HttpStack httpStack) {
  // If a pool isn't passed in, then build a small default pool that will give us a lot of
  // benefit and not use too much memory.
  this(httpStack, new ByteArrayPool(DEFAULT_POOL_SIZE));
}
 
开发者ID:nordfalk,项目名称:EsperantoRadio,代码行数:9,代码来源:DrBasicNetwork.java


示例6: SBaseNetWork

import com.android.volley.toolbox.ByteArrayPool; //导入依赖的package包/类
public SBaseNetWork(HttpStack httpStack, ByteArrayPool pool) {
    super(httpStack, pool);
}
 
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:4,代码来源:SBaseNetWork.java


示例7: RVNetwork

import com.android.volley.toolbox.ByteArrayPool; //导入依赖的package包/类
/**
 * @param httpStack HTTP stack to be used
 */
public RVNetwork(HttpStack httpStack) {
    // If a pool isn't passed in, then build a small default pool that will give us a lot of
    // benefit and not use too much memory.
    this(httpStack, new ByteArrayPool(DEFAULT_POOL_SIZE));
}
 
开发者ID:HujiangTechnology,项目名称:RestVolley,代码行数:9,代码来源:RVNetwork.java


示例8: createNetwork

import com.android.volley.toolbox.ByteArrayPool; //导入依赖的package包/类
private Network createNetwork()
{
  if (Utils.isBackgroundDataEnabled(this))
  {
    FinskyExperiments localFinskyExperiments = getExperiments();
    boolean bool = localFinskyExperiments.isEnabled(12603642L);
    int i;
    if ((localFinskyExperiments.isEnabled(12602748L)) || (localFinskyExperiments.isEnabled(12604235L)) || (localFinskyExperiments.isEnabled(12604236L))) {
      i = 1;
    }
    OkHttpClient localOkHttpClient;
    while ((GooglePlayServicesUtil.isSidewinderDevice(this)) || (((bool) || (i != 0)) && (((Boolean)G.enableOkHttp.get()).booleanValue())))
    {
      Protocol[] arrayOfProtocol = new Protocol[1];
      arrayOfProtocol[0] = Protocol.HTTP_1_1;
      ArrayList localArrayList = Lists.newArrayList(arrayOfProtocol);
      if (!bool) {
        localArrayList.add(Protocol.SPDY_3);
      }
      localOkHttpClient = new OkHttpClient();
      List localList = Util.immutableList(localArrayList);
      if (!localList.contains(Protocol.HTTP_1_1))
      {
        throw new IllegalArgumentException("protocols doesn't contain http/1.1: " + localList);
        i = 0;
      }
      else
      {
        if (localList.contains(Protocol.HTTP_1_0)) {
          throw new IllegalArgumentException("protocols must not contain http/1.0: " + localList);
        }
        if (localList.contains(null)) {
          throw new IllegalArgumentException("protocols must not contain null");
        }
        localOkHttpClient.protocols = Util.immutableList(localList);
        localOkHttpClient.followRedirects = false;
      }
    }
    for (Object localObject = new GoogleOkHttpStack(this, localOkHttpClient, new GoogleUrlRewriter(this), null, ((Boolean)G.enableSensitiveLogging.get()).booleanValue());; localObject = new GoogleHttpClientStack(this, ((Boolean)G.enableSensitiveLogging.get()).booleanValue())) {
      return new BasicNetwork((HttpStack)localObject, new ByteArrayPool(1024 * ((Integer)G.volleyBufferPoolSizeKb.get()).intValue()));
    }
  }
  return new DenyAllNetwork();
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:45,代码来源:FinskyApp.java


示例9: VolleyDiskCacheWrapper

import com.android.volley.toolbox.ByteArrayPool; //导入依赖的package包/类
public VolleyDiskCacheWrapper(DiskCache diskCache) {
    this.diskCache = diskCache;
    this.byteArrayPool = new ByteArrayPool(BYTE_POOL_SIZE);
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:5,代码来源:VolleyDiskCacheWrapper.java


示例10: OkNetwork

import com.android.volley.toolbox.ByteArrayPool; //导入依赖的package包/类
/**
 * @param httpStack HTTP stack to be used
 */
public OkNetwork(OkStack httpStack) {
    // If a pool isn't passed in, then build a small default pool that will give us a lot of
    // benefit and not use too much memory.
    this(httpStack, new ByteArrayPool(DEFAULT_POOL_SIZE));
}
 
开发者ID:googolmo,项目名称:OkVolley,代码行数:9,代码来源:OkNetwork.java


示例11: BasicNetworkOOM

import com.android.volley.toolbox.ByteArrayPool; //导入依赖的package包/类
public BasicNetworkOOM(HttpStack httpStack, ByteArrayPool pool) {
    super(httpStack, pool);
}
 
开发者ID:Qanvast,项目名称:cannon,代码行数:4,代码来源:BasicNetworkOOM.java


示例12: setByteArrayPool

import com.android.volley.toolbox.ByteArrayPool; //导入依赖的package包/类
public void setByteArrayPool(ByteArrayPool byteArrayPool) {
    this.byteArrayPool = byteArrayPool;
}
 
开发者ID:patrick-doyle,项目名称:CrossBow,代码行数:4,代码来源:FileRequest.java


示例13: JacksonNetwork

import com.android.volley.toolbox.ByteArrayPool; //导入依赖的package包/类
/**
 * @param httpStack The HTTP stack that requests are performed with.
 * @param poolSize The size of the pool buffer used for cached requests. NOTE: caching
 *                 requests will have a significant adverse affect on parsing speed!
 */
public JacksonNetwork(HttpStack httpStack, int poolSize) {
	mHttpStack = httpStack;
	mPool = new ByteArrayPool(poolSize);
}
 
开发者ID:spothero,项目名称:volley-jackson-extension,代码行数:10,代码来源:JacksonNetwork.java



注:本文中的com.android.volley.toolbox.ByteArrayPool类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BlockFaceShape类代码示例发布时间:2022-05-21
下一篇:
Java PsiModifier类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap