Package org.apache.commons.compress
Class MemoryLimitException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
org.apache.commons.compress.CompressException
org.apache.commons.compress.MemoryLimitException
- All Implemented Interfaces:
Serializable
If a stream checks for estimated memory allocation, and the estimate goes above the memory limit, this is thrown. This can also be thrown if a stream tries
to allocate a byte array that is larger than the allowable limit.
- Since:
- 1.14
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intprivate final longA long instead of int to account for overflow for corrupt files.private static final long -
Constructor Summary
ConstructorsConstructorDescriptionMemoryLimitException(long memoryNeededKiB, int memoryLimitKiB) Constructs a new instance.MemoryLimitException(long memoryNeededKiB, int memoryLimitKiB, Exception cause) Deprecated.MemoryLimitException(long memoryNeededKiB, int memoryLimitKiB, Throwable cause) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringbuildMessage(long memoryNeededInKb, int memoryLimitInKb) intGets the memory limit in kibibytes (KiB).longGets the memory needed in kibibytes (KiB).Methods inherited from class org.apache.commons.compress.CompressException
requireNonNullMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
memoryNeededKiB
private final long memoryNeededKiBA long instead of int to account for overflow for corrupt files. -
memoryLimitKiB
private final int memoryLimitKiB
-
-
Constructor Details
-
MemoryLimitException
public MemoryLimitException(long memoryNeededKiB, int memoryLimitKiB) Constructs a new instance.- Parameters:
memoryNeededKiB- The memory needed in kibibytes (KiB).memoryLimitKiB- The memory limit in kibibytes (KiB).
-
MemoryLimitException
Deprecated.Constructs a new instance.- Parameters:
memoryNeededKiB- The memory needed in kibibytes (KiB).memoryLimitKiB- The memory limit in kibibytes (KiB).cause- The cause (which is saved for later retrieval by theThrowable.getCause()method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
-
MemoryLimitException
Constructs a new instance.- Parameters:
memoryNeededKiB- The memory needed in kibibytes (KiB).memoryLimitKiB- The memory limit in kibibytes (KiB).cause- The cause (which is saved for later retrieval by theThrowable.getCause()method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
-
-
Method Details
-
buildMessage
-
getMemoryLimitInKb
public int getMemoryLimitInKb()Gets the memory limit in kibibytes (KiB).- Returns:
- the memory limit in kibibytes (KiB).
-
getMemoryNeededInKb
public long getMemoryNeededInKb()Gets the memory needed in kibibytes (KiB).- Returns:
- the memory needed in kibibytes (KiB).
-
MemoryLimitException(long, int, Throwable).