panda.io.SizeLimitExceededException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of panda-core Show documentation
Show all versions of panda-core Show documentation
Panda Core is the core module of Panda Framework, it contains commonly used utility classes similar to apache-commons.
package panda.io;
import java.io.IOException;
import panda.lang.Numbers;
public class SizeLimitExceededException extends IOException {
private static final long serialVersionUID = 1L;
/**
* The actual size of the request.
*/
private final long actual;
/**
* The maximum limited size of the request.
*/
private final long limited;
/**
* Constructs a SizeExceededException
with the specified detail message, and
* actual and limited sizes.
*
* @param message The detail message.
* @param actual The actual request size.
* @param limited The maximum limited request size.
*/
public SizeLimitExceededException(String message, long actual, long limited) {
super(message);
this.actual = actual;
this.limited = limited;
}
/**
* Retrieves the actual size of the request.
*
* @return The actual size of the request.
*/
public long getActualSize() {
return actual;
}
/**
* Retrieves the limited size of the request.
*
* @return The limited size of the request.
*/
public long getLimitedSize() {
return limited;
}
/**
* Retrieves the actual size of the request.
*
* @return The actual size of the request.
*/
public String getDisplayActualSize() {
return Numbers.formatSize(actual);
}
/**
* Retrieves the limited size of the request.
*
* @return The limited size of the request.
*/
public String getDisplayLimitedSize() {
return Numbers.formatSize(limited);
}
}