Class ImageTooLargeException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.image.exception.ImageException
cloud.opencode.base.image.exception.ImageValidationException
cloud.opencode.base.image.exception.ImageTooLargeException
- All Implemented Interfaces:
Serializable
Image Too Large Exception
图片过大异常
Exception thrown when image dimensions or file size exceed limits.
当图片尺寸或文件大小超出限制时抛出的异常。
Features | 主要功能:
- Exception for images exceeding size limits - 图片超出大小限制的异常
- Carries ImageErrorCode for programmatic error handling - 携带 ImageErrorCode 用于编程式错误处理
Usage Examples | 使用示例:
// Catch specific exception
try {
OpenImage.read(path);
} catch (ImageTooLargeException e) {
System.err.println(e.getMessage());
}
Security | 安全性:
- Thread-safe: Yes (immutable exception) - 线程安全: 是(不可变异常)
- Null-safe: No (message must not be null) - 空值安全: 否(消息不能为 null)
- Since:
- JDK 25, opencode-base-image V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionImageTooLargeException(int width, int height, int maxWidth, int maxHeight) Create an image too large exception for dimensions 创建尺寸过大的图片异常ImageTooLargeException(long fileSize, long maxFileSize) Create an image too large exception for file size 创建文件过大的图片异常ImageTooLargeException(String message) Create an image too large exception with message 创建带消息的图片过大异常 -
Method Summary
Modifier and TypeMethodDescriptionlongGet actual file size 获取实际文件大小intGet actual height 获取实际高度longGet maximum file size 获取最大文件大小intGet maximum height 获取最大高度intGet maximum width 获取最大宽度intgetWidth()Get actual width 获取实际宽度Methods inherited from class ImageException
getErrorCodeMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ImageTooLargeException
public ImageTooLargeException(int width, int height, int maxWidth, int maxHeight) Create an image too large exception for dimensions 创建尺寸过大的图片异常- Parameters:
width- actual width | 实际宽度height- actual height | 实际高度maxWidth- maximum width | 最大宽度maxHeight- maximum height | 最大高度
-
ImageTooLargeException
public ImageTooLargeException(long fileSize, long maxFileSize) Create an image too large exception for file size 创建文件过大的图片异常- Parameters:
fileSize- actual file size | 实际文件大小maxFileSize- maximum file size | 最大文件大小
-
ImageTooLargeException
Create an image too large exception with message 创建带消息的图片过大异常- Parameters:
message- the error message | 错误消息
-
-
Method Details
-
getWidth
public int getWidth()Get actual width 获取实际宽度- Returns:
- the width | 宽度
-
getHeight
public int getHeight()Get actual height 获取实际高度- Returns:
- the height | 高度
-
getMaxWidth
public int getMaxWidth()Get maximum width 获取最大宽度- Returns:
- the max width | 最大宽度
-
getMaxHeight
public int getMaxHeight()Get maximum height 获取最大高度- Returns:
- the max height | 最大高度
-
getFileSize
public long getFileSize()Get actual file size 获取实际文件大小- Returns:
- the file size | 文件大小
-
getMaxFileSize
public long getMaxFileSize()Get maximum file size 获取最大文件大小- Returns:
- the max file size | 最大文件大小
-