Added documentation and fixed typos.

This commit is contained in:
Harald Kuhr 2009-11-01 17:03:06 +01:00
parent 82fdde897d
commit 18b86f8d26
2 changed files with 22 additions and 21 deletions

View File

@ -72,11 +72,10 @@ public abstract class ImageReaderBase extends ImageReader {
* the extension object is unsuitable, an * the extension object is unsuitable, an
* {@code IllegalArgumentException} should be thrown. * {@code IllegalArgumentException} should be thrown.
* *
* @param pOriginatingProvider the {@code ImageReaderSpi} that is * @param pProvider the {@code ImageReaderSpi} that is invoking this constructor, or {@code null}.
* invoking this constructor, or {@code null}.
*/ */
protected ImageReaderBase(final ImageReaderSpi pOriginatingProvider) { protected ImageReaderBase(final ImageReaderSpi pProvider) {
super(pOriginatingProvider); super(pProvider);
} }
/** /**
@ -98,7 +97,7 @@ public abstract class ImageReaderBase extends ImageReader {
* @see ImageInputStream * @see ImageInputStream
*/ */
@Override @Override
public void setInput(Object pInput, boolean pSeekForwardOnly, boolean pIgnoreMetadata) { public void setInput(final Object pInput, final boolean pSeekForwardOnly, final boolean pIgnoreMetadata) {
resetMembers(); resetMembers();
super.setInput(pInput, pSeekForwardOnly, pIgnoreMetadata); super.setInput(pInput, pSeekForwardOnly, pIgnoreMetadata);
if (pInput instanceof ImageInputStream) { if (pInput instanceof ImageInputStream) {
@ -168,8 +167,7 @@ public abstract class ImageReaderBase extends ImageReader {
* @param pIndex the image index * @param pIndex the image index
* *
* @throws java.io.IOException if an error occurs during reading * @throws java.io.IOException if an error occurs during reading
* @throws IndexOutOfBoundsException if not * @throws IndexOutOfBoundsException if not {@code minIndex <= pIndex < numImages}
* <tt>minIndex <= pIndex < numImages</tt>
*/ */
protected void checkBounds(int pIndex) throws IOException { protected void checkBounds(int pIndex) throws IOException {
assertInput(); assertInput();
@ -217,10 +215,8 @@ public abstract class ImageReaderBase extends ImageReader {
* @throws IllegalArgumentException if {@code pTypes} * @throws IllegalArgumentException if {@code pTypes}
* is {@code null} or empty, or if an object not of type * is {@code null} or empty, or if an object not of type
* {@code ImageTypeSpecifier} is retrieved from it. * {@code ImageTypeSpecifier} is retrieved from it.
* Or, if the resulting image would * Or, if the resulting image would have a width or height less than 1,
* have a width or height less than 1, * or if the product of {@code pWidth} and {@code pHeight} is greater than
* or if the product of
* {@code pWidth} and {@code pHeight} is greater than
* {@code Integer.MAX_VALUE}. * {@code Integer.MAX_VALUE}.
*/ */
public static BufferedImage getDestination(final ImageReadParam pParam, final Iterator<ImageTypeSpecifier> pTypes, public static BufferedImage getDestination(final ImageReadParam pParam, final Iterator<ImageTypeSpecifier> pTypes,

View File

@ -47,6 +47,11 @@ import java.io.IOException;
* @version $Id: ImageWriterBase.java,v 1.0 Sep 24, 2007 12:22:28 AM haraldk Exp$ * @version $Id: ImageWriterBase.java,v 1.0 Sep 24, 2007 12:22:28 AM haraldk Exp$
*/ */
public abstract class ImageWriterBase extends ImageWriter { public abstract class ImageWriterBase extends ImageWriter {
/**
* For convenience. Only set if the output is an {@code ImageInputStream}.
* @see #setOutput(Object)
*/
protected ImageOutputStream mImageOutput; protected ImageOutputStream mImageOutput;
/** /**
@ -60,8 +65,7 @@ public abstract class ImageWriterBase extends ImageWriter {
* the extension object is unsuitable, an * the extension object is unsuitable, an
* {@code IllegalArgumentException} should be thrown. * {@code IllegalArgumentException} should be thrown.
* *
* @param pProvider the {@code ImageWriterSpi} that * @param pProvider the {@code ImageWriterSpi} that is constructing this object, or {@code null}.
* is constructing this object, or {@code null}.
*/ */
protected ImageWriterBase(final ImageWriterSpi pProvider) { protected ImageWriterBase(final ImageWriterSpi pProvider) {
super(pProvider); super(pProvider);
@ -72,8 +76,9 @@ public abstract class ImageWriterBase extends ImageWriter {
} }
@Override @Override
public void setOutput(Object pOutput) { public void setOutput(final Object pOutput) {
super.setOutput(pOutput); super.setOutput(pOutput);
if (pOutput instanceof ImageOutputStream) { if (pOutput instanceof ImageOutputStream) {
mImageOutput = (ImageOutputStream) pOutput; mImageOutput = (ImageOutputStream) pOutput;
} }
@ -93,10 +98,10 @@ public abstract class ImageWriterBase extends ImageWriter {
/** /**
* Returns {@code null} * Returns {@code null}
* *
* @param pParam igonred. * @param pParam ignored.
* @return {@code null}. * @return {@code null}.
*/ */
public IIOMetadata getDefaultStreamMetadata(ImageWriteParam pParam) { public IIOMetadata getDefaultStreamMetadata(final ImageWriteParam pParam) {
return null; return null;
} }
@ -104,14 +109,14 @@ public abstract class ImageWriterBase extends ImageWriter {
* Returns {@code null} * Returns {@code null}
* *
* @param pInData ignored. * @param pInData ignored.
* @param pParam igonred. * @param pParam ignored.
* @return {@code null}. * @return {@code null}.
*/ */
public IIOMetadata convertStreamMetadata(IIOMetadata pInData, ImageWriteParam pParam) { public IIOMetadata convertStreamMetadata(final IIOMetadata pInData, final ImageWriteParam pParam) {
return null; return null;
} }
protected static Rectangle getSourceRegion(ImageWriteParam pParam, int pWidth, int pHeight) { protected static Rectangle getSourceRegion(final ImageWriteParam pParam, final int pWidth, final int pHeight) {
return IIOUtil.getSourceRegion(pParam, pWidth, pHeight); return IIOUtil.getSourceRegion(pParam, pWidth, pHeight);
} }
@ -130,7 +135,7 @@ public abstract class ImageWriterBase extends ImageWriter {
* region), or the original image, if no source region was set, or * region), or the original image, if no source region was set, or
* {@code pParam} was {@code null} * {@code pParam} was {@code null}
*/ */
protected static BufferedImage fakeAOI(BufferedImage pImage, ImageWriteParam pParam) { protected static BufferedImage fakeAOI(final BufferedImage pImage, final ImageWriteParam pParam) {
return IIOUtil.fakeAOI(pImage, getSourceRegion(pParam, pImage.getWidth(), pImage.getHeight())); return IIOUtil.fakeAOI(pImage, getSourceRegion(pParam, pImage.getWidth(), pImage.getHeight()));
} }
@ -153,7 +158,7 @@ public abstract class ImageWriterBase extends ImageWriter {
* original image, if no subsampling was specified, or * original image, if no subsampling was specified, or
* {@code pParam} was {@code null} * {@code pParam} was {@code null}
*/ */
protected static Image fakeSubsampling(Image pImage, ImageWriteParam pParam) { protected static Image fakeSubsampling(final Image pImage, final ImageWriteParam pParam) {
return IIOUtil.fakeSubsampling(pImage, pParam); return IIOUtil.fakeSubsampling(pImage, pParam);
} }
} }