< prev index next >
src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -196,10 +196,11 @@
public PNGImageReader(ImageReaderSpi originatingProvider) {
super(originatingProvider);
}
+ @Override
public void setInput(Object input,
boolean seekForwardOnly,
boolean ignoreMetadata) {
super.setInput(input, seekForwardOnly, ignoreMetadata);
this.stream = (ImageInputStream)input; // Always works
@@ -1518,10 +1519,11 @@
inf.end();
}
}
}
+ @Override
public int getNumImages(boolean allowSearch) throws IIOException {
if (stream == null) {
throw new IllegalStateException("No input source set!");
}
if (seekForwardOnly && allowSearch) {
@@ -1529,30 +1531,33 @@
("seekForwardOnly and allowSearch can't both be true!");
}
return 1;
}
+ @Override
public int getWidth(int imageIndex) throws IIOException {
if (imageIndex != 0) {
throw new IndexOutOfBoundsException("imageIndex != 0!");
}
readHeader();
return metadata.IHDR_width;
}
+ @Override
public int getHeight(int imageIndex) throws IIOException {
if (imageIndex != 0) {
throw new IndexOutOfBoundsException("imageIndex != 0!");
}
readHeader();
return metadata.IHDR_height;
}
+ @Override
public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
throws IIOException
{
if (imageIndex != 0) {
throw new IndexOutOfBoundsException("imageIndex != 0!");
@@ -1783,10 +1788,11 @@
* at the last position of this list.
*
* After this changes we should override getRawImageType()
* to return last element of image types list.
*/
+ @Override
public ImageTypeSpecifier getRawImageType(int imageIndex)
throws IOException {
Iterator<ImageTypeSpecifier> types = getImageTypes(imageIndex);
ImageTypeSpecifier raw = null;
@@ -1794,27 +1800,31 @@
raw = types.next();
} while (types.hasNext());
return raw;
}
+ @Override
public ImageReadParam getDefaultReadParam() {
return new ImageReadParam();
}
+ @Override
public IIOMetadata getStreamMetadata()
throws IIOException {
return null;
}
+ @Override
public IIOMetadata getImageMetadata(int imageIndex) throws IIOException {
if (imageIndex != 0) {
throw new IndexOutOfBoundsException("imageIndex != 0!");
}
readMetadata();
return metadata;
}
+ @Override
public BufferedImage read(int imageIndex, ImageReadParam param)
throws IIOException {
if (imageIndex != 0) {
throw new IndexOutOfBoundsException("imageIndex != 0!");
}
@@ -1830,10 +1840,11 @@
throw new IIOException("Caught exception during read: ", e);
}
return theImage;
}
+ @Override
public void reset() {
super.reset();
resetStreamSettings();
}
< prev index next >