模块 wjybxx.base

接口 ByteArrayPool

所有超级接口:
ObjectPool<byte[]>, Supplier<byte[]>

public interface ByteArrayPool extends ObjectPool<byte[]>
Java不是真泛型,不能直接定义ArrayPool, 不过对于IO操作而言,绝大多数情况下使用字节数组的池就可以。
作者:
wjybxx date - 2024/1/3
  • 方法概要

    修饰符和类型
    方法
    说明
    byte[]
    rent(int minimumLength)
    注意:返回的字节数组可能大于期望的数组长度
    void
    returnOne(byte[] buffer)
    归还数组到池,默认情况下不清理数据
    void
    returnOne(byte[] buffer, boolean clear)
    归还数组到池

    从接口继承的方法 cn.wjybxx.base.pool.ObjectPool

    clear, get, rent, returnAll
  • 方法详细资料

    • rent

      byte[] rent(int minimumLength)
      注意:返回的字节数组可能大于期望的数组长度
      参数:
      minimumLength - 期望的最小数组长度
      返回:
      池化的字节数组
    • returnOne

      void returnOne(byte[] buffer)
      归还数组到池,默认情况下不清理数据
      指定者:
      returnOne 在接口中 ObjectPool<byte[]>
      参数:
      buffer - 要回收的对象
    • returnOne

      void returnOne(byte[] buffer, boolean clear)
      归还数组到池
      参数:
      buffer - 租借的对象
      clear - 是否清理数组