The list of methods to do ByteBuffer Size are organized into topic(s).
ByteBuffer
check(ByteBuffer buffer, int size) Check if the buffer has the remaining capacity to hold the number of bytes.
if (buffer == null) {
ByteBuffer newBuffer = ByteBuffer.allocate(size);
newBuffer.mark();
return newBuffer;
if (buffer.remaining() < size) {
int position = buffer.position();
ByteBuffer newBuffer = ByteBuffer.allocate(position + size + 1);
...
void
checkBounds(BufferedImage image, int xStart, int yStart, int width, int height) check Bounds
int imgWidth = image.getWidth();
int imgHeight = image.getHeight();
if (xStart > imgWidth || width > imgWidth || (xStart + width) > imgWidth) {
throw new RuntimeException("image does not fully contain the comparison region");
if (yStart > imgHeight || height > imgHeight || (yStart + height) > imgHeight) {
throw new RuntimeException("image does not fully contain the comparison region");
void
cover(BufferedImage source, File to, Image cover, int width, int height, int sourceTop, int sourceLeft, int sourceWidth, int sourceHeight) cover
BufferedImage dest = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Image imageSource = source.getScaledInstance(sourceWidth, sourceHeight, Image.SCALE_SMOOTH);
Graphics graphics = dest.getGraphics();
graphics.setColor(new Color(225, 225, 225));
graphics.fillRect(0, 0, width, height);
graphics.drawImage(imageSource, sourceTop, sourceLeft, null);
graphics.drawImage(cover, 0, 0, null);
String mimeType = "image/jpeg";
...