< prev index next >
src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2005, 2016, 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
--- 1,7 ----
/*
! * 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,269 ****
--- 256,271 ----
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,328 ****
--- 316,332 ----
}
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,349 ****
--- 344,354 ----
}
return imageMetadata;
}
+ @Override
public IIOMetadata convertStreamMetadata(IIOMetadata inData,
ImageWriteParam param) {
// Check arguments.
if(inData == null) {
throw new NullPointerException("inData == null!");
*** 368,377 ****
--- 373,383 ----
}
return outData;
}
+ @Override
public IIOMetadata
convertImageMetadata(IIOMetadata inData,
ImageTypeSpecifier imageType,
ImageWriteParam param) {
// Check arguments.
*** 2303,2312 ****
--- 2309,2319 ----
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,2629 ****
--- 2623,2638 ----
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,2651 ****
--- 2651,2661 ----
// 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,2663 ****
--- 2664,2674 ----
// Append image.
writeInsert(-1, image, param);
}
+ @Override
public void endWriteSequence() throws IOException {
// Check output.
if (getOutput() == null) {
throw new IllegalStateException("getOutput() == null!");
}
*** 2676,2685 ****
--- 2687,2697 ----
if (streamLength != -1) {
stream.seek(streamLength);
}
}
+ @Override
public boolean canInsertImage(int imageIndex) throws IOException {
if (getOutput() == null) {
throw new IllegalStateException("getOutput() == null!");
}
*** 2762,2771 ****
--- 2774,2784 ----
}
stream.seek(ifd[0]);
}
}
+ @Override
public void writeInsert(int imageIndex,
IIOImage image,
ImageWriteParam param) throws IOException {
int currentImageCached = currentImage;
try {
*** 2842,2855 ****
--- 2855,2870 ----
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,2901 ****
--- 2907,2917 ----
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,2922 ****
--- 2929,2939 ----
insert(imageIndex, new IIOImage(emptyImage, null, imageMetadata),
param, false);
}
+ @Override
public void prepareWriteEmpty(IIOMetadata streamMetadata,
ImageTypeSpecifier imageType,
int width,
int height,
IIOMetadata imageMetadata,
*** 2942,2951 ****
--- 2959,2969 ----
if (abortRequested()) {
resetPositions();
}
}
+ @Override
public void endInsertEmpty() throws IOException {
if (getOutput() == null) {
throw new IllegalStateException("getOutput() == null!");
}
*** 2965,2974 ****
--- 2983,2993 ----
}
this.isInsertingEmpty = false;
}
+ @Override
public void endWriteEmpty() throws IOException {
if (getOutput() == null) {
throw new IllegalStateException("getOutput() == null!");
}
*** 3019,3028 ****
--- 3038,3048 ----
stream.reset();
return rootIFD;
}
+ @Override
public boolean canReplacePixels(int imageIndex) throws IOException {
if (getOutput() == null) {
throw new IllegalStateException("getOutput() == null!");
}
*** 3044,3053 ****
--- 3064,3074 ----
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,3236 ****
--- 3248,3258 ----
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,3575 ****
--- 3588,3598 ----
stream.reset();
}
}
}
+ @Override
public void replacePixels(Raster raster, ImageWriteParam param)
throws IOException {
if (raster == null) {
throw new NullPointerException("raster == null!");
}
*** 3577,3586 ****
--- 3600,3610 ----
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,3619 ****
--- 3634,3644 ----
stream.seek(prevStreamPosition);
headerPosition = prevHeaderPosition;
nextSpace = prevNextSpace;
}
+ @Override
public void reset() {
super.reset();
stream = null;
image = null;
< prev index next >