类 CodecOutputByteArray

java.lang.Object
com.baidu.bjf.remoting.protobuf.code.CodecOutputByteArray

public class CodecOutputByteArray extends Object
Get byte array from codec and object. Avoid create a lot of CodedOutputStream object. Borrow obj from this thread and recycle in this thread too. It not a real object pool. Just thread scope cache.
作者:
qiunet 2022/8/12 14:23
  • 方法详细资料

    • get

      public static CodecOutputByteArray get()
      get CodecOutputByteArrayGetter from ThreadLocal
      返回:
      CodecOutputByteArrayGetter instance
    • threadScopeSize

      public static int threadScopeSize()
      get thread scope size
      返回:
    • clear

      public static void clear()
      clear stack
    • getCodedOutputStream

      public com.google.protobuf.CodedOutputStream getCodedOutputStream()
      get CodedOutputStream instance
      返回:
    • getData

      public byte[] getData() throws IOException
      get byte array data
      返回:
      byte array
      抛出:
      IOException
    • getData

      public static <T> byte[] getData(Codec<T> codec, T obj) throws IOException
      get byte array from codec and object
      类型参数:
      T -
      参数:
      codec - codec
      obj - obj
      返回:
      byte array
      抛出:
      IOException