src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java

Print this page
rev 9343 : 8033716: Fix raw and unchecked lint warnings in com.sun.imageio
Reviewed-by: darcy, prr, bae


1308         stream.writeShort(1);
1309 
1310         // Bits Per Pixel
1311         stream.writeShort(bitsPerPixel);
1312     }
1313 
1314     private void writeSize(int dword, int offset) throws IOException {
1315         stream.skipBytes(offset);
1316         stream.writeInt(dword);
1317     }
1318 
1319     public void reset() {
1320         super.reset();
1321         stream = null;
1322     }
1323 
1324     private void writeEmbedded(IIOImage image,
1325                                ImageWriteParam bmpParam) throws IOException {
1326         String format =
1327             compressionType == BI_JPEG ? "jpeg" : "png";
1328         Iterator iterator = ImageIO.getImageWritersByFormatName(format);

1329         ImageWriter writer = null;
1330         if (iterator.hasNext())
1331             writer = (ImageWriter)iterator.next();
1332         if (writer != null) {
1333             if (embedded_stream == null) {
1334                 throw new RuntimeException("No stream for writing embedded image!");
1335             }
1336 
1337             writer.addIIOWriteProgressListener(new IIOWriteProgressAdapter() {
1338                     public void imageProgress(ImageWriter source, float percentageDone) {
1339                         processImageProgress(percentageDone);
1340                     }
1341                 });
1342 
1343             writer.addIIOWriteWarningListener(new IIOWriteWarningListener() {
1344                     public void warningOccurred(ImageWriter source, int imageIndex, String warning) {
1345                         processWarningOccurred(imageIndex, warning);
1346                     }
1347                 });
1348 
1349             writer.setOutput(ImageIO.createImageOutputStream(embedded_stream));
1350             ImageWriteParam param = writer.getDefaultWriteParam();
1351             //param.setDestinationBands(bmpParam.getDestinationBands());




1308         stream.writeShort(1);
1309 
1310         // Bits Per Pixel
1311         stream.writeShort(bitsPerPixel);
1312     }
1313 
1314     private void writeSize(int dword, int offset) throws IOException {
1315         stream.skipBytes(offset);
1316         stream.writeInt(dword);
1317     }
1318 
1319     public void reset() {
1320         super.reset();
1321         stream = null;
1322     }
1323 
1324     private void writeEmbedded(IIOImage image,
1325                                ImageWriteParam bmpParam) throws IOException {
1326         String format =
1327             compressionType == BI_JPEG ? "jpeg" : "png";
1328         Iterator<ImageWriter> iterator =
1329                ImageIO.getImageWritersByFormatName(format);
1330         ImageWriter writer = null;
1331         if (iterator.hasNext())
1332             writer = iterator.next();
1333         if (writer != null) {
1334             if (embedded_stream == null) {
1335                 throw new RuntimeException("No stream for writing embedded image!");
1336             }
1337 
1338             writer.addIIOWriteProgressListener(new IIOWriteProgressAdapter() {
1339                     public void imageProgress(ImageWriter source, float percentageDone) {
1340                         processImageProgress(percentageDone);
1341                     }
1342                 });
1343 
1344             writer.addIIOWriteWarningListener(new IIOWriteWarningListener() {
1345                     public void warningOccurred(ImageWriter source, int imageIndex, String warning) {
1346                         processWarningOccurred(imageIndex, warning);
1347                     }
1348                 });
1349 
1350             writer.setOutput(ImageIO.createImageOutputStream(embedded_stream));
1351             ImageWriteParam param = writer.getDefaultWriteParam();
1352             //param.setDestinationBands(bmpParam.getDestinationBands());