< prev index next >

src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -256,14 +256,16 @@
 
     public TIFFImageWriter(ImageWriterSpi originatingProvider) {
         super(originatingProvider);
     }
 
+    @Override
     public ImageWriteParam getDefaultWriteParam() {
         return new TIFFImageWriteParam(getLocale());
     }
 
+    @Override
     public void setOutput(Object output) {
         if (output != null) {
             if (!(output instanceof ImageOutputStream)) {
                 throw new IllegalArgumentException
                     ("output not an ImageOutputStream!");

@@ -314,15 +316,17 @@
         }
 
         super.setOutput(output);
     }
 
+    @Override
     public IIOMetadata
         getDefaultStreamMetadata(ImageWriteParam param) {
         return new TIFFStreamMetadata();
     }
 
+    @Override
     public IIOMetadata
         getDefaultImageMetadata(ImageTypeSpecifier imageType,
                                 ImageWriteParam param) {
 
         List<TIFFTagSet> tagSets = new ArrayList<TIFFTagSet>(1);

@@ -340,10 +344,11 @@
         }
 
         return imageMetadata;
     }
 
+    @Override
     public IIOMetadata convertStreamMetadata(IIOMetadata inData,
                                              ImageWriteParam param) {
         // Check arguments.
         if(inData == null) {
             throw new NullPointerException("inData == null!");

@@ -368,10 +373,11 @@
         }
 
         return outData;
     }
 
+    @Override
     public IIOMetadata
         convertImageMetadata(IIOMetadata inData,
                              ImageTypeSpecifier imageType,
                              ImageWriteParam param) {
         // Check arguments.

@@ -2303,10 +2309,11 @@
             scale = null;
             scale0 = null;
         }
     }
 
+    @Override
     public void write(IIOMetadata sm,
                       IIOImage iioimage,
                       ImageWriteParam p) throws IOException {
         if (stream == null) {
             throw new IllegalStateException("output == null!");

@@ -2616,14 +2623,16 @@
 
         processImageComplete();
         currentImage++;
     }
 
+    @Override
     public boolean canWriteSequence() {
         return true;
     }
 
+    @Override
     public void prepareWriteSequence(IIOMetadata streamMetadata)
         throws IOException {
         if (getOutput() == null) {
             throw new IllegalStateException("getOutput() == null!");
         }

@@ -2642,10 +2651,11 @@
 
         // Set the sequence flag.
         this.isWritingSequence = true;
     }
 
+    @Override
     public void writeToSequence(IIOImage image, ImageWriteParam param)
         throws IOException {
         // Check sequence flag.
         if(!this.isWritingSequence) {
             throw new IllegalStateException

@@ -2654,10 +2664,11 @@
 
         // Append image.
         writeInsert(-1, image, param);
     }
 
+    @Override
     public void endWriteSequence() throws IOException {
         // Check output.
         if (getOutput() == null) {
             throw new IllegalStateException("getOutput() == null!");
         }

@@ -2676,10 +2687,11 @@
         if (streamLength != -1) {
             stream.seek(streamLength);
         }
     }
 
+    @Override
     public boolean canInsertImage(int imageIndex) throws IOException {
         if (getOutput() == null) {
             throw new IllegalStateException("getOutput() == null!");
         }
 

@@ -2762,10 +2774,11 @@
             }
             stream.seek(ifd[0]);
         }
     }
 
+    @Override
     public void writeInsert(int imageIndex,
                             IIOImage image,
                             ImageWriteParam param) throws IOException {
         int currentImageCached = currentImage;
         try {

@@ -2842,14 +2855,16 @@
 
     private boolean isEncodingEmpty() {
         return isInsertingEmpty || isWritingEmpty;
     }
 
+    @Override
     public boolean canInsertEmpty(int imageIndex) throws IOException {
         return canInsertImage(imageIndex);
     }
 
+    @Override
     public boolean canWriteEmpty() throws IOException {
         if (getOutput() == null) {
             throw new IllegalStateException("getOutput() == null!");
         }
         return true;

@@ -2892,10 +2907,11 @@
             throw new IllegalStateException
                 ("Previous call to prepareWriteEmpty() without corresponding call to endWriteEmpty()!");
         }
     }
 
+    @Override
     public void prepareInsertEmpty(int imageIndex,
                                    ImageTypeSpecifier imageType,
                                    int width,
                                    int height,
                                    IIOMetadata imageMetadata,

@@ -2913,10 +2929,11 @@
 
         insert(imageIndex, new IIOImage(emptyImage, null, imageMetadata),
                param, false);
     }
 
+    @Override
     public void prepareWriteEmpty(IIOMetadata streamMetadata,
                                   ImageTypeSpecifier imageType,
                                   int width,
                                   int height,
                                   IIOMetadata imageMetadata,

@@ -2942,10 +2959,11 @@
         if (abortRequested()) {
             resetPositions();
         }
     }
 
+    @Override
     public void endInsertEmpty() throws IOException {
         if (getOutput() == null) {
             throw new IllegalStateException("getOutput() == null!");
         }
 

@@ -2965,10 +2983,11 @@
         }
 
         this.isInsertingEmpty = false;
     }
 
+    @Override
     public void endWriteEmpty() throws IOException {
         if (getOutput() == null) {
             throw new IllegalStateException("getOutput() == null!");
         }
 

@@ -3019,10 +3038,11 @@
         stream.reset();
 
         return rootIFD;
     }
 
+    @Override
     public boolean canReplacePixels(int imageIndex) throws IOException {
         if (getOutput() == null) {
             throw new IllegalStateException("getOutput() == null!");
         }
 

@@ -3044,10 +3064,11 @@
     private Rectangle replacePixelsRegion = null;
     private boolean inReplacePixelsNest = false;
 
     private TIFFImageReader reader = null;
 
+    @Override
     public void prepareReplacePixels(int imageIndex,
                                      Rectangle region) throws IOException {
         synchronized(replacePixelsLock) {
             // Check state and parameters vis-a-vis ImageWriter specification.
             if (stream == null) {

@@ -3227,10 +3248,11 @@
                               target.width, target.height,
                               target.x, target.y,
                               sourceBands);
     }
 
+    @Override
     public void replacePixels(RenderedImage image, ImageWriteParam param)
         throws IOException {
 
         synchronized(replacePixelsLock) {
             // Check state and parameters vis-a-vis ImageWriter specification.

@@ -3566,10 +3588,11 @@
                 stream.reset();
             }
         }
     }
 
+    @Override
     public void replacePixels(Raster raster, ImageWriteParam param)
         throws IOException {
         if (raster == null) {
             throw new NullPointerException("raster == null!");
         }

@@ -3577,10 +3600,11 @@
         replacePixels(new SingleTileRenderedImage(raster,
                                                   image.getColorModel()),
                       param);
     }
 
+    @Override
     public void endReplacePixels() throws IOException {
         synchronized(replacePixelsLock) {
             if(!this.inReplacePixelsNest) {
                 throw new IllegalStateException
                     ("No previous call to prepareReplacePixels()!");

@@ -3610,10 +3634,11 @@
         stream.seek(prevStreamPosition);
         headerPosition = prevHeaderPosition;
         nextSpace = prevNextSpace;
     }
 
+    @Override
     public void reset() {
         super.reset();
 
         stream = null;
         image = null;
< prev index next >