/** Writes the TIFF file header. */ public void writeHeader() throws IOException { // write endianness indicator out.seek(0); if (isLittleEndian()) { out.writeByte(TiffConstants.LITTLE); out.writeByte(TiffConstants.LITTLE); } else { out.writeByte(TiffConstants.BIG); out.writeByte(TiffConstants.BIG); } // write magic number if (bigTiff) { out.writeShort(TiffConstants.BIG_TIFF_MAGIC_NUMBER); } else out.writeShort(TiffConstants.MAGIC_NUMBER); // write the offset to the first IFD // for vanilla TIFFs, 8 is the offset to the first IFD // for BigTIFFs, 8 is the number of bytes in an offset if (bigTiff) { out.writeShort(8); out.writeShort(0); // write the offset to the first IFD for BigTIFF files out.writeLong(16); } else { out.writeInt(8); } }
/** Writes the TIFF file header. */ public void writeHeader() throws IOException { // write endianness indicator out.seek(0); if (isLittleEndian()) { out.writeByte(TiffConstants.LITTLE); out.writeByte(TiffConstants.LITTLE); } else { out.writeByte(TiffConstants.BIG); out.writeByte(TiffConstants.BIG); } // write magic number if (bigTiff) { out.writeShort(TiffConstants.BIG_TIFF_MAGIC_NUMBER); } else out.writeShort(TiffConstants.MAGIC_NUMBER); // write the offset to the first IFD // for vanilla TIFFs, 8 is the offset to the first IFD // for BigTIFFs, 8 is the number of bytes in an offset if (bigTiff) { out.writeShort(8); out.writeShort(0); // write the offset to the first IFD for BigTIFF files out.writeLong(16); } else { out.writeInt(8); } }
out.writeShort(q); else out.writeByte(q);
out.writeShort(q); else out.writeByte(q);
out.write(tmp, row * rowLen, rowLen); for (int i=0; i<pad; i++) { out.writeByte(0);
out.write(tmp, row * rowLen, rowLen); for (int i=0; i<pad; i++) { out.writeByte(0);
writeIntValue(out, q.length); if (q.length <= dataLength) { for (int i=0; i<q.length; i++) out.writeByte(q[i]); for (int i=q.length; i<dataLength; i++) out.writeByte(0); for (int i=0; i<q.length; i++) extraOut.writeByte(q[i]); for (int i=0; i<q.length; i++) out.writeByte(q[i]); // value(s) for (int i=q.length; i<dataLength; i++) out.writeByte(0); // padding for (int i=0; i<q.length; i++) extraOut.writeByte(q[i]); // values extraOut.writeByte(0); // concluding NULL byte
writeIntValue(out, q.length); if (q.length <= dataLength) { for (int i=0; i<q.length; i++) out.writeByte(q[i]); for (int i=q.length; i<dataLength; i++) out.writeByte(0); for (int i=0; i<q.length; i++) extraOut.writeByte(q[i]); for (int i=0; i<q.length; i++) out.writeByte(q[i]); // value(s) for (int i=q.length; i<dataLength; i++) out.writeByte(0); // padding for (int i=0; i<q.length; i++) extraOut.writeByte(q[i]); // values extraOut.writeByte(0); // concluding NULL byte