Java Code Examples for com.sun.imageio.plugins.common.I18N#getString()

The following examples show how to use com.sun.imageio.plugins.common.I18N#getString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WBMPMetadata.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public Node getAsTree(String formatName) {
    if (formatName.equals(nativeMetadataFormatName)) {
        return getNativeTree();
    } else if (formatName.equals
               (IIOMetadataFormatImpl.standardMetadataFormatName)) {
        return getStandardTree();
    } else {
        throw new IllegalArgumentException(I18N.getString("WBMPMetadata0"));
    }
}
 
Example 2
Source File: BMPImageReader.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public IIOMetadata getImageMetadata(int imageIndex)
  throws IOException {
    checkIndex(imageIndex);
    if (metadata == null) {
        try {
            readHeader();
        } catch (IllegalArgumentException e) {
            throw new IIOException(I18N.getString("BMPImageReader6"), e);
        }
    }
    return metadata;
}
 
Example 3
Source File: BMPImageWriter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void setOutput(Object output) {
    super.setOutput(output); // validates output
    if (output != null) {
        if (!(output instanceof ImageOutputStream))
            throw new IllegalArgumentException(I18N.getString("BMPImageWriter0"));
        this.stream = (ImageOutputStream)output;
        stream.setByteOrder(ByteOrder.LITTLE_ENDIAN);
    } else
        this.stream = null;
}
 
Example 4
Source File: BMPImageReader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public int getWidth(int imageIndex) throws IOException {
    checkIndex(imageIndex);
    try {
        readHeader();
    } catch (IllegalArgumentException e) {
        throw new IIOException(I18N.getString("BMPImageReader6"), e);
    }
    return width;
}
 
Example 5
Source File: BMPImageReader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public IIOMetadata getImageMetadata(int imageIndex)
  throws IOException {
    checkIndex(imageIndex);
    if (metadata == null) {
        try {
            readHeader();
        } catch (IllegalArgumentException e) {
            throw new IIOException(I18N.getString("BMPImageReader6"), e);
        }
    }
    return metadata;
}
 
Example 6
Source File: BMPImageReader.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public int getHeight(int imageIndex) throws IOException {
    checkIndex(imageIndex);
    try {
        readHeader();
    } catch (IllegalArgumentException e) {
        throw new IIOException(I18N.getString("BMPImageReader6"), e);
    }
    return height;
}
 
Example 7
Source File: WBMPImageReader.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public void readHeader() throws IOException {
    if (gotHeader)
        return;

    if (iis == null) {
        throw new IllegalStateException("Input source not set!");
    }

    metadata = new WBMPMetadata();

    wbmpType = iis.readByte();   // TypeField
    byte fixHeaderField = iis.readByte();

    // check for valid wbmp image
    if (fixHeaderField != 0
        || !isValidWbmpType(wbmpType))
    {
        throw new IIOException(I18N.getString("WBMPImageReader2"));
    }

    metadata.wbmpType = wbmpType;

    // Read image width
    width = ReaderUtil.readMultiByteInteger(iis);
    metadata.width = width;

    // Read image height
    height = ReaderUtil.readMultiByteInteger(iis);
    metadata.height = height;

    gotHeader = true;
}
 
Example 8
Source File: WBMPImageReader.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/** Overrides the method defined in the superclass. */
public int getNumImages(boolean allowSearch) throws IOException {
    if (iis == null) {
        throw new IllegalStateException(I18N.getString("GetNumImages0"));
    }
    if (seekForwardOnly && allowSearch) {
        throw new IllegalStateException(I18N.getString("GetNumImages1"));
    }
    return 1;
}
 
Example 9
Source File: BMPImageReader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public boolean isRandomAccessEasy(int imageIndex) throws IOException {
    checkIndex(imageIndex);
    try {
        readHeader();
    } catch (IllegalArgumentException e) {
        throw new IIOException(I18N.getString("BMPImageReader6"), e);
    }
    return metadata.compression == BI_RGB;
}
 
Example 10
Source File: WBMPImageReader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/** Overrides the method defined in the superclass. */
public int getNumImages(boolean allowSearch) throws IOException {
    if (iis == null) {
        throw new IllegalStateException(I18N.getString("GetNumImages0"));
    }
    if (seekForwardOnly && allowSearch) {
        throw new IllegalStateException(I18N.getString("GetNumImages1"));
    }
    return 1;
}
 
Example 11
Source File: BMPImageReader.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public Iterator getImageTypes(int imageIndex)
  throws IOException {
    checkIndex(imageIndex);
    try {
        readHeader();
    } catch (IllegalArgumentException e) {
        throw new IIOException(I18N.getString("BMPImageReader6"), e);
    }
    ArrayList list = new ArrayList(1);
    list.add(new ImageTypeSpecifier(originalColorModel,
                                    originalSampleModel));
    return list.iterator();
}
 
Example 12
Source File: BMPImageReader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public Iterator getImageTypes(int imageIndex)
  throws IOException {
    checkIndex(imageIndex);
    try {
        readHeader();
    } catch (IllegalArgumentException e) {
        throw new IIOException(I18N.getString("BMPImageReader6"), e);
    }
    ArrayList list = new ArrayList(1);
    list.add(new ImageTypeSpecifier(originalColorModel,
                                    originalSampleModel));
    return list.iterator();
}
 
Example 13
Source File: WBMPImageWriter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void setOutput(Object output) {
    super.setOutput(output); // validates output
    if (output != null) {
        if (!(output instanceof ImageOutputStream))
            throw new IllegalArgumentException(I18N.getString("WBMPImageWriter"));
        this.stream = (ImageOutputStream)output;
    } else
        this.stream = null;
}
 
Example 14
Source File: BMPMetadata.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public void setFromTree(String formatName, Node root) {
    throw new IllegalStateException(I18N.getString("BMPMetadata1"));
}
 
Example 15
Source File: BMPMetadata.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public void reset() {
    throw new IllegalStateException(I18N.getString("BMPMetadata1"));
}
 
Example 16
Source File: BMPMetadata.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void mergeTree(String formatName, Node root) {
    throw new IllegalStateException(I18N.getString("BMPMetadata1"));
}
 
Example 17
Source File: BMPImageReader.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private void checkIndex(int imageIndex) {
    if (imageIndex != 0) {
        throw new IndexOutOfBoundsException(I18N.getString("BMPImageReader0"));
    }
}
 
Example 18
Source File: WBMPMetadata.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void setFromTree(String formatName, Node root) {
    throw new IllegalStateException(I18N.getString("WBMPMetadata1"));
}
 
Example 19
Source File: WBMPImageWriter.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
private void checkSampleModel(SampleModel sm) {
    int type = sm.getDataType();
    if (type < DataBuffer.TYPE_BYTE || type > DataBuffer.TYPE_INT
        || sm.getNumBands() != 1 || sm.getSampleSize(0) != 1)
        throw new IllegalArgumentException(I18N.getString("WBMPImageWriter2"));
}
 
Example 20
Source File: WBMPMetadata.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public void reset() {
    throw new IllegalStateException(I18N.getString("WBMPMetadata1"));
}