Class LimitedByteArrayOutputStream

    • Field Detail

      • SOFT_MAX_ARRAY_LENGTH

        public static final int SOFT_MAX_ARRAY_LENGTH
        A soft maximum array length imposed by array growth computations. Some JVMs (such as HotSpot) have an implementation limit that will cause

        OutOfMemoryError("Requested array size exceeds VM limit")

        to be thrown if a request is made to allocate an array of some length near Integer.MAX_VALUE, even if there is sufficient heap available. The actual limit might depend on some JVM implementation-specific characteristics such as the object header size. The soft maximum value is chosen conservatively to be smaller than any JVM implementation limit that is likely to be encountered.

        See Also:
        Constant Field Values
    • Constructor Detail

      • LimitedByteArrayOutputStream

        public LimitedByteArrayOutputStream​(int initialSize,
                                            int limit)
        Constructor.
        Parameters:
        initialSize - the initial size of the byte array. Must be strictly smaller than the limit.
        limit - the selected maximum size of the underlying byte array
      • LimitedByteArrayOutputStream

        public LimitedByteArrayOutputStream​(int limit)
        Constructor.
        Parameters:
        limit - the selected maximum size of the underlying byte array. Must be strictly greater than the default byte array size.