This commit is contained in:
prrace 2026-01-29 15:29:55 -08:00
parent b936635cbf
commit ebde5c8a78
2 changed files with 7 additions and 9 deletions

View File

@ -239,7 +239,7 @@ public class MultiPixelPackedSampleModel extends SampleModel
* Since {@code MultiPixelPackedSampleModel} has only one band,
* this method ignores the {@code band} parameter and returns
* the sample size of the single band.
* @param band the specified band (ignored).
* @param band the specified band (ignored)
* @return the number of bits per sample for the specified band.
*/
public int getSampleSize(int band) {

View File

@ -43,8 +43,8 @@ public class GetSampleSizeTest {
{
ComponentSampleModel csm =
new ComponentSampleModel(DataBuffer.TYPE_BYTE,
width, height, 1, width, bandOffsets);
new ComponentSampleModel(DataBuffer.TYPE_BYTE,
width, height, 1, width, bandOffsets);
int numBands = csm.getNumBands();
System.out.println("CSM numBands = " + numBands);
if (numBands != 2) {
@ -55,8 +55,7 @@ public class GetSampleSizeTest {
{
MultiPixelPackedSampleModel mppsm =
new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE,
width, height, 4);
new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE, width, height, 4);
int numBands = mppsm.getNumBands();
System.out.println("MPPSM numBands = " + numBands);
if (numBands != 1) {
@ -67,13 +66,12 @@ public class GetSampleSizeTest {
{
SinglePixelPackedSampleModel sppsm =
new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE,
width, height, bitMask);
int numBands = sppsm.getNumBands();
new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, width, height, bitMask);
int numBands = sppsm.getNumBands();
System.out.println("SPPSM numBands = " + numBands);
if (numBands != 4) {
throw new RuntimeException("Unexpected numBands");
}
}
try {
System.out.println("SPPSM sample size = " + sppsm.getSampleSize(numBands));
throw new RuntimeException("No expected AIOBE");