类 ResizableByteArrayOutputStream

    • 构造器详细资料

      • ResizableByteArrayOutputStream

        public ResizableByteArrayOutputStream()
        Create a new ResizableByteArrayOutputStream with the default initial capacity of 256 bytes.
      • ResizableByteArrayOutputStream

        public ResizableByteArrayOutputStream​(int initialCapacity)
        Create a new ResizableByteArrayOutputStream with the specified initial capacity.
        参数:
        initialCapacity - the initial buffer size in bytes
    • 方法详细资料

      • resize

        public void resize​(int targetCapacity)
        Resize the internal buffer size to a specified capacity.
        参数:
        targetCapacity - the desired size of the buffer
        抛出:
        IllegalArgumentException - if the given capacity is smaller than the actual size of the content stored in the buffer already
        另请参阅:
        ByteArrayOutputStream.size()
      • grow

        public void grow​(int additionalCapacity)
        Grow the internal buffer size.
        参数:
        additionalCapacity - the number of bytes to add to the current buffer size
        另请参阅:
        ByteArrayOutputStream.size()
      • capacity

        public int capacity()
        Return the current size of this stream's internal buffer.