本文整理汇总了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);
}
示例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);
}
示例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
}
}