/** * Allocates a 1-dimensional byte array matching the product of the given * sizes. * * @param sizes list of sizes from which to allocate the array * @return a byte array of the appropriate size * @throws IllegalArgumentException if the total size exceeds 2GB, which is * the maximum size of an array in Java; or if any size argument is * zero or negative */ public static byte[] allocate(int... sizes) throws IllegalArgumentException { if (sizes == null) return null; if (sizes.length == 0) return new byte[0]; int total = safeMultiply32(sizes); return new byte[total]; }
/** * Allocates a 1-dimensional byte array matching the product of the given * sizes. * * @param sizes list of sizes from which to allocate the array * @return a byte array of the appropriate size * @throws IllegalArgumentException if the total size exceeds 2GB, which is * the maximum size of an array in Java; or if any size argument is * zero or negative */ public static byte[] allocate(int... sizes) throws IllegalArgumentException { if (sizes == null) return null; if (sizes.length == 0) return new byte[0]; int total = safeMultiply32(sizes); return new byte[total]; }
@Override public int getOptimalTileHeight() { FormatTools.assertId(currentId, true, 1); try { int height = (int) ifds.get(0).getTileLength(); if (height <= 0) { height = getSizeY(); } // Some TIFF files only store a single tile, even if the image is // very, very large. In those cases, we don't want to open the whole // tile if we can avoid it. if (DataTools.safeMultiply32(height, getOptimalTileWidth()) > 10 * 1024 * 1024) { return super.getOptimalTileHeight(); } if (height > 1) { return height; } } catch (FormatException e) { LOGGER.debug("Could not retrieve tile height", e); } return super.getOptimalTileHeight(); }
@Override public int getOptimalTileHeight() { FormatTools.assertId(currentId, true, 1); try { int height = (int) ifds.get(0).getTileLength(); if (height <= 0) { height = getSizeY(); } // Some TIFF files only store a single tile, even if the image is // very, very large. In those cases, we don't want to open the whole // tile if we can avoid it. if (DataTools.safeMultiply32(height, getOptimalTileWidth()) > 10 * 1024 * 1024) { return super.getOptimalTileHeight(); } if (height > 1) { return height; } } catch (FormatException e) { LOGGER.debug("Could not retrieve tile height", e); } return super.getOptimalTileHeight(); }
planeSize = DataTools.safeMultiply32(reader.getSizeX(), reader.getSizeY(), reader.getEffectiveSizeC(), reader.getRGBChannelCount(),
expected = DataTools.safeMultiply32(x, y, c, bytes);
planeSize = DataTools.safeMultiply32(resolutionReader.getSizeX(), resolutionReader.getSizeY(), resolutionReader.getRGBChannelCount(),
boolean validSizes = true; try { DataTools.safeMultiply32(getSizeX(), getSizeY());
boolean validSizes = true; try { DataTools.safeMultiply32(getSizeX(), getSizeY());
planeSize = DataTools.safeMultiply32(reader.getSizeX(), reader.getSizeY(), reader.getEffectiveSizeC(), reader.getRGBChannelCount(),
if (DataTools.safeMultiply32(c.tileHeight, c.tileWidth) > 10 * 1024 * 1024) { int bpp = FormatTools.getBytesPerPixel(c.pixelType);
if (DataTools.safeMultiply32(c.tileHeight, c.tileWidth) > 10 * 1024 * 1024) { int bpp = FormatTools.getBytesPerPixel(c.pixelType);