当前位置: 首页>>代码示例>>Java>>正文


Java IIOException类代码示例

本文整理汇总了Java中javax.imageio.IIOException的典型用法代码示例。如果您正苦于以下问题:Java IIOException类的具体用法?Java IIOException怎么用?Java IIOException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IIOException类属于javax.imageio包,在下文中一共展示了IIOException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doMove

import javax.imageio.IIOException; //导入依赖的package包/类
@Override
public void doMove(VCSFileProxy from, VCSFileProxy to) throws IOException {
    if(!startAcceptingEvents) {
        return;
    }
    System.out.println(" intercepted doMove from " + from + " to " + to );
    events.add(DO_MOVE + " from " + from + " " + to);
    
    // invoke rename
    from.toFile().renameTo(to.toFile());
    
    // now wait if afterDelete doesn't happen before we leave doMove();
    long t = System.currentTimeMillis();
    while(afterDelete == null) {
        try {
            Thread.sleep(200);
        } catch (InterruptedException ex) {
            throw new IIOException("doMove from " + from + " to " + to , ex);
        }
        if(System.currentTimeMillis() - t > TIMEOUT) {
            events.add(TIMEDOUT + " from " + from + " " + to);
            return;
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:AfterDeleteAfterMoveEndsTest.java

示例2: writeCommentExtension

import javax.imageio.IIOException; //导入依赖的package包/类
private void writeCommentExtension(GIFWritableImageMetadata im)
  throws IOException {
    if (im.comments != null) {
        try {
            Iterator<byte[]> iter = im.comments.iterator();
            while (iter.hasNext()) {
                stream.write(0x21);
                stream.write(0xfe);
                writeBlocks(iter.next());
                stream.write(0x00);
            }
        } catch (IOException e) {
            throw new IIOException("I/O error writing Comment Extension!", e);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:GIFImageWriter.java

示例3: readData

import javax.imageio.IIOException; //导入依赖的package包/类
/**
 * Fills the data array from the stream, starting with
 * the buffer and then reading directly from the stream
 * if necessary.  The buffer is left in an appropriate
 * state.  If the end of the stream is encountered, an
 * <code>IIOException</code> is thrown with the
 * message "Image Format Error".
 */
void readData(byte [] data) throws IOException {
    int count = data.length;
    // First see what's left in the buffer.
    if (bufAvail >= count) {  // It's enough
        System.arraycopy(buf, bufPtr, data, 0, count);
        bufAvail -= count;
        bufPtr += count;
        return;
    }
    int offset = 0;
    if (bufAvail > 0) {  // Some there, but not enough
        System.arraycopy(buf, bufPtr, data, 0, bufAvail);
        offset = bufAvail;
        count -= bufAvail;
        bufAvail = 0;
        bufPtr = 0;
    }
    // Now read the rest directly from the stream
    if (iis.read(data, offset, count) != count) {
        throw new IIOException ("Image format Error");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:JPEGBuffer.java

示例4: skipData

import javax.imageio.IIOException; //导入依赖的package包/类
/**
 * Skips <code>count</code> bytes, leaving the buffer
 * in an appropriate state.  If the end of the stream is
 * encountered, an <code>IIOException</code> is thrown with the
 * message "Image Format Error".
 */
void skipData(int count) throws IOException {
    // First see what's left in the buffer.
    if (bufAvail >= count) {  // It's enough
        bufAvail -= count;
        bufPtr += count;
        return;
    }
    if (bufAvail > 0) {  // Some there, but not enough
        count -= bufAvail;
        bufAvail = 0;
        bufPtr = 0;
    }
    // Now read the rest directly from the stream
    if (iis.skipBytes(count) != count) {
        throw new IIOException ("Image format Error");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:JPEGBuffer.java

示例5: MarkerSegment

import javax.imageio.IIOException; //导入依赖的package包/类
/**
 * Constructor for creating <code>MarkerSegment</code>s by reading
 * from an <code>ImageInputStream</code>.
 */
MarkerSegment(JPEGBuffer buffer) throws IOException {

    buffer.loadBuf(3);  // tag plus length
    tag = buffer.buf[buffer.bufPtr++] & 0xff;
    length = (buffer.buf[buffer.bufPtr++] & 0xff) << 8;
    length |= buffer.buf[buffer.bufPtr++] & 0xff;
    length -= 2;  // JPEG length includes itself, we don't

    if (length < 0) {
        throw new IIOException("Invalid segment length: " + length);
    }
    buffer.bufAvail -= 3;
    // Now that we know the true length, ensure that we've got it,
    // or at least a bufferful if length is too big.
    buffer.loadBuf(length);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:MarkerSegment.java

示例6: reset

import javax.imageio.IIOException; //导入依赖的package包/类
/**
 * Resets the current stream byte and bit positions from the stack
 * of marked positions.
 *
 * <p> An <code>IOException</code> will be thrown if the previous
 * marked position lies in the discarded portion of the stream.
 *
 * @exception IOException if an I/O error occurs.
 */
public void reset() throws IOException {
    if (markByteStack.empty()) {
        return;
    }

    long pos = ((Long)markByteStack.pop()).longValue();
    if (pos < flushedPos) {
        throw new IIOException
            ("Previous marked position has been discarded!");
    }
    seek(pos);

    int offset = ((Integer)markBitStack.pop()).intValue();
    setBitOffset(offset);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:ImageInputStreamImpl.java

示例7: checkState

import javax.imageio.IIOException; //导入依赖的package包/类
private void checkState(int imageIndex) throws IOException {
    if (stream == null) {
        throw new IllegalStateException("input not set.");
    }
    if (imageIndex != 0) {
        throw new IndexOutOfBoundsException("index != 0");
    }
    if (width==-1) {
        byte[] sig = new byte[4];
        stream.reset();
        stream.read(sig);
        boolean ok = sig[0]=='S' && sig[1]=='I' &&
                     sig[2]=='M' && sig[3]=='P';
        if (!ok) {
            throw new IIOException("Not a SIMP image");
        }
        width = stream.readByte();
        height = stream.readByte();
    }
    if (width <= 0 || height <= 0) {
        throw new IOException("bad image size");
    }
    metadata = new SIMPMetadata(width, height);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:SIMPImageReader.java

示例8: MarkerSegment

import javax.imageio.IIOException; //导入依赖的package包/类
/**
 * Constructor for creating {@code MarkerSegment}s by reading
 * from an {@code ImageInputStream}.
 */
MarkerSegment(JPEGBuffer buffer) throws IOException {

    buffer.loadBuf(3);  // tag plus length
    tag = buffer.buf[buffer.bufPtr++] & 0xff;
    length = (buffer.buf[buffer.bufPtr++] & 0xff) << 8;
    length |= buffer.buf[buffer.bufPtr++] & 0xff;
    length -= 2;  // JPEG length includes itself, we don't

    if (length < 0) {
        throw new IIOException("Invalid segment length: " + length);
    }
    buffer.bufAvail -= 3;
    // Now that we know the true length, ensure that we've got it,
    // or at least a bufferful if length is too big.
    buffer.loadBuf(length);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:MarkerSegment.java

示例9: parse_hIST_chunk

import javax.imageio.IIOException; //导入依赖的package包/类
private void parse_hIST_chunk(int chunkLength) throws IOException,
    IIOException
{
    if (!metadata.PLTE_present) {
        throw new IIOException("hIST chunk without prior PLTE chunk!");
    }

    /* According to PNG specification length of
     * hIST chunk is specified in bytes and
     * hIST chunk consists of 2 byte elements
     * (so we expect length is even).
     */
    metadata.hIST_histogram = new char[chunkLength/2];
    stream.readFully(metadata.hIST_histogram,
                     0, metadata.hIST_histogram.length);

    metadata.hIST_present = true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:PNGImageReader.java

示例10: getTileOrStripOffset

import javax.imageio.IIOException; //导入依赖的package包/类
private long getTileOrStripOffset(int tileIndex) throws IIOException {
    TIFFField f
            = imageMetadata.getTIFFField(BaselineTIFFTagSet.TAG_TILE_OFFSETS);
    if (f == null) {
        f = imageMetadata.getTIFFField(BaselineTIFFTagSet.TAG_STRIP_OFFSETS);
    }
    if (f == null) {
        f = imageMetadata.getTIFFField(BaselineTIFFTagSet.TAG_JPEG_INTERCHANGE_FORMAT);
    }

    if (f == null) {
        throw new IIOException("Missing required strip or tile offsets field.");
    }

    return f.getAsLong(tileIndex);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:TIFFImageReader.java

示例11: write_IHDR

import javax.imageio.IIOException; //导入依赖的package包/类
private void write_IHDR() throws IOException {
        // Write IHDR chunk
        ChunkStream cs = new ChunkStream(PNGImageReader.IHDR_TYPE, stream);
        cs.writeInt(metadata.IHDR_width);
        cs.writeInt(metadata.IHDR_height);
        cs.writeByte(metadata.IHDR_bitDepth);
        cs.writeByte(metadata.IHDR_colorType);
        if (metadata.IHDR_compressionMethod != 0) {
            throw new IIOException(
"Only compression method 0 is defined in PNG 1.1");
        }
        cs.writeByte(metadata.IHDR_compressionMethod);
        if (metadata.IHDR_filterMethod != 0) {
            throw new IIOException(
"Only filter method 0 is defined in PNG 1.1");
        }
        cs.writeByte(metadata.IHDR_filterMethod);
        if (metadata.IHDR_interlaceMethod < 0 ||
            metadata.IHDR_interlaceMethod > 1) {
            throw new IIOException(
"Only interlace methods 0 (node) and 1 (adam7) are defined in PNG 1.1");
        }
        cs.writeByte(metadata.IHDR_interlaceMethod);
        cs.finish();
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:PNGImageWriter.java

示例12: reset

import javax.imageio.IIOException; //导入依赖的package包/类
/**
 * Resets the current stream byte and bit positions from the stack
 * of marked positions.
 *
 * <p> An {@code IOException} will be thrown if the previous
 * marked position lies in the discarded portion of the stream.
 *
 * @exception IOException if an I/O error occurs.
 */
public void reset() throws IOException {
    if (markByteStack.empty()) {
        return;
    }

    long pos = markByteStack.pop().longValue();
    if (pos < flushedPos) {
        throw new IIOException
            ("Previous marked position has been discarded!");
    }
    seek(pos);

    int offset = markBitStack.pop().intValue();
    setBitOffset(offset);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:ImageInputStreamImpl.java

示例13: writePlainTextExtension

import javax.imageio.IIOException; //导入依赖的package包/类
private void writePlainTextExtension(GIFWritableImageMetadata im)
  throws IOException {
    if (im.hasPlainTextExtension) {
        try {
            stream.write(0x21);
            stream.write(0x1);

            stream.write(12);

            stream.writeShort(im.textGridLeft);
            stream.writeShort(im.textGridTop);
            stream.writeShort(im.textGridWidth);
            stream.writeShort(im.textGridHeight);
            stream.write(im.characterCellWidth);
            stream.write(im.characterCellHeight);
            stream.write(im.textForegroundColor);
            stream.write(im.textBackgroundColor);

            writeBlocks(im.text);

            stream.write(0x00);
        } catch (IOException e) {
            throw new IIOException("I/O error writing Plain Text Extension!", e);
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:GIFImageWriter.java

示例14: skipPass

import javax.imageio.IIOException; //导入依赖的package包/类
private void skipPass(int passWidth, int passHeight)
    throws IOException, IIOException  {
    if ((passWidth == 0) || (passHeight == 0)) {
        return;
    }

    int inputBands = inputBandsForColorType[metadata.IHDR_colorType];
    int bytesPerRow = (inputBands*passWidth*metadata.IHDR_bitDepth + 7)/8;

    // Read the image row-by-row
    for (int srcY = 0; srcY < passHeight; srcY++) {
        // Skip filter byte and the remaining row bytes
        pixelStream.skipBytes(1 + bytesPerRow);

        // If read has been aborted, just return
        // processReadAborted will be called later
        if (abortRequested()) {
            return;
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:22,代码来源:PNGImageReader.java

示例15: Qtable

import javax.imageio.IIOException; //导入依赖的package包/类
Qtable(JPEGBuffer buffer) throws IIOException {
    elementPrecision = buffer.buf[buffer.bufPtr] >>> 4;
    tableID = buffer.buf[buffer.bufPtr++] & 0xf;
    if (elementPrecision != 0) {
        // IJG is compiled for 8-bits, so this shouldn't happen
        throw new IIOException ("Unsupported element precision");
    }
    data = new int [QTABLE_SIZE];
    // Read from zig-zag order to natural order
    for (int i = 0; i < QTABLE_SIZE; i++) {
        data[i] = buffer.buf[buffer.bufPtr+zigzag[i]] & 0xff;
    }
    buffer.bufPtr += QTABLE_SIZE;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:DQTMarkerSegment.java


注:本文中的javax.imageio.IIOException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。