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


Java ImageOutputStream.writeInt方法代码示例

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


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

示例1: ChunkStream

import javax.imageio.stream.ImageOutputStream; //导入方法依赖的package包/类
public ChunkStream(int type, ImageOutputStream stream) throws IOException {
    this.stream = stream;
    this.startPos = stream.getStreamPosition();

    stream.writeInt(-1); // length, will backpatch
    writeInt(type);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:PNGImageWriter.java

示例2: ChunkStream

import javax.imageio.stream.ImageOutputStream; //导入方法依赖的package包/类
ChunkStream(int type, ImageOutputStream stream) throws IOException {
    this.stream = stream;
    this.startPos = stream.getStreamPosition();

    stream.writeInt(-1); // length, will backpatch
    writeInt(type);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:PNGImageWriter.java

示例3: writeTIFFFieldToStream

import javax.imageio.stream.ImageOutputStream; //导入方法依赖的package包/类
private static void writeTIFFFieldToStream(TIFFField field,
                                           ImageOutputStream stream)
    throws IOException {
    int count = field.getCount();
    Object data = field.getData();

    switch (field.getType()) {
    case TIFFTag.TIFF_ASCII:
        for (int i = 0; i < count; i++) {
            String s = ((String[])data)[i];
            int length = s.length();
            for (int j = 0; j < length; j++) {
                stream.writeByte(s.charAt(j) & 0xff);
            }
            stream.writeByte(0);
        }
        break;
    case TIFFTag.TIFF_UNDEFINED:
    case TIFFTag.TIFF_BYTE:
    case TIFFTag.TIFF_SBYTE:
        stream.write((byte[])data);
        break;
    case TIFFTag.TIFF_SHORT:
        stream.writeChars((char[])data, 0, ((char[])data).length);
        break;
    case TIFFTag.TIFF_SSHORT:
        stream.writeShorts((short[])data, 0, ((short[])data).length);
        break;
    case TIFFTag.TIFF_SLONG:
        stream.writeInts((int[])data, 0, ((int[])data).length);
        break;
    case TIFFTag.TIFF_LONG:
        for (int i = 0; i < count; i++) {
            stream.writeInt((int)(((long[])data)[i]));
        }
        break;
    case TIFFTag.TIFF_IFD_POINTER:
        stream.writeInt(0); // will need to be backpatched
        break;
    case TIFFTag.TIFF_FLOAT:
        stream.writeFloats((float[])data, 0, ((float[])data).length);
        break;
    case TIFFTag.TIFF_DOUBLE:
        stream.writeDoubles((double[])data, 0, ((double[])data).length);
        break;
    case TIFFTag.TIFF_SRATIONAL:
        for (int i = 0; i < count; i++) {
            stream.writeInt(((int[][])data)[i][0]);
            stream.writeInt(((int[][])data)[i][1]);
        }
        break;
    case TIFFTag.TIFF_RATIONAL:
        for (int i = 0; i < count; i++) {
            long num = ((long[][])data)[i][0];
            long den = ((long[][])data)[i][1];
            stream.writeInt((int)num);
            stream.writeInt((int)den);
        }
        break;
    default:
        // error
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:64,代码来源:TIFFIFD.java


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