/** Reads an unsigned number of any type. * @param type TIFF type to read */ public long readUnsigned(int type) throws IOException { long u = 0L; switch (type) { case BYTE: case UNDEFINED: u = ModuleBase.readUnsignedByte(_raf); break; case SHORT: u = ModuleBase.readUnsignedShort(_raf, _bigEndian); break; case LONG: case IFD: u = ModuleBase.readUnsignedInt(_raf, _bigEndian); break; } return u; }
/** * Reads a TIFF array of DOUBLE 64-bit values and returns * it as a double array. * * @param count Number of values to read * @param value Offset from which to read */ protected double [] readDoubleArray(long count, long value) throws IOException { _raf.seek(value); double [] darray = new double [(int) count]; for (int i=0; i<count; i++) { darray[i] = ModuleBase.readDouble(_raf, _bigEndian); } return darray; }
public static int readSignedByte (DataInputStream stream, ModuleBase counted) throws IOException { int val = stream.readByte (); if (counted != null) { counted._nByte++; } return val; }
public static int readSignedInt (DataInputStream stream, boolean endian, ModuleBase counted) throws IOException { long b = readUnsignedInt (stream, endian, counted); if ((b & 0X80000000L) != 0) { b |= ~0XFFFFFFFFL; } return (int) b; }
public static int readSignedShort (DataInputStream stream, boolean endian, ModuleBase counted) throws IOException { int b = readUnsignedShort (stream, endian, counted); if ((b & 0X8000) != 0) { b |= ~0XFFFF; } return b; }
int nEntries = ModuleBase.readUnsignedShort (file, bigEndian); _tags.put (leading (offset, 8) + offset, "IFD " + nIFD + " with " + nEntries + " entries"); long os = offset + 2 + i*12; file.seek (os); int tag = ModuleBase.readUnsignedShort (file, bigEndian); int type = ModuleBase.readUnsignedShort (file, bigEndian); long count = ModuleBase.readUnsignedInt (file, bigEndian); if (type == IFD.ASCII) { if (count > 4) { long vo = ModuleBase.readUnsignedInt (file, bigEndian); file.seek (vo); ascii.append ((char) ModuleBase.readUnsignedByte (file)); type == IFD.UNDEFINED) { if (count > 4) { long vo = ModuleBase.readUnsignedInt (file, bigEndian); file.seek (vo); long by = ModuleBase.readUnsignedByte (file); buffer.append (" " + by); long vo = ModuleBase.readUnsignedInt (file, bigEndian); file.seek (vo); double db = ModuleBase.readDouble (file, bigEndian);
long ckSize = ModuleBase.readUnsignedInt (stream, ENDIAN); int ch = ModuleBase.readUnsignedByte(stream); formType.append((char) ch); int ch = ModuleBase.readUnsignedByte(stream); sbuf.append((char) ch); ckSize = ModuleBase.readUnsignedInt (stream, ENDIAN); System.out.print (leading (os, 8) + os + ": " + ckID + " " + ckSize); int [] aes = new int[24]; for (int i=0; i<24; i++) { aes[i] = ModuleBase.readUnsignedByte (stream); sbuf.setLength (0); for (int i=0; i<ckSize; i++) { int ch = ModuleBase.readUnsignedByte (stream); sbuf.append ((char) ch); sbuf.setLength (0); for (int i=0; i<4; i++) { int ch = ModuleBase.readUnsignedByte (stream); sbuf.append ((char) ch); int numChannels = ModuleBase.readSignedShort (stream, ENDIAN); long numSampleFrames =
/** * Reads an unsigned byte from a DataInputStream. * @param stream Stream to read */ public static int readUnsignedByte (DataInputStream stream) throws IOException { return readUnsignedByte (stream, null); }
/** Read the CRC itself. Naturally, this doesn't update * the CRC. */ public long readCRC() throws IOException { long c = ModuleBase.readUnsignedInt (_dstream, true); return c; }
/** * Reads the header of a chunk. If _chunkID is non-null, * it's assumed to have already been read. */ public boolean readHeader (DataInputStream dstrm) throws IOException { StringBuffer id = new StringBuffer(4); for (int i = 0; i < 4; i++) { int ch = ModuleBase.readUnsignedByte (dstrm, _module); if (ch < 32) { String hx = Integer.toHexString (ch); if (hx.length () < 2) { hx = "0" + hx; } _repInfo.setMessage (new ErrorMessage (MessageConstants.ERR_CHUNK_ID_CHAR_INV, MessageConstants.ERR_CHUNK_ID_CHAR_SUB + hx, _module.getNByte ())); _repInfo.setWellFormed (false); return false; } id.append((char) ch); } _chunkID = id.toString (); _size = ModuleBase.readUnsignedInt (dstrm, _module.isBigEndian (), _module); return true; }
int unshiftedNote = ModuleBase.readUnsignedByte (_dstream, _module); int fineTune = ModuleBase.readSignedByte (_dstream, _module); int gain = ModuleBase.readSignedByte (_dstream, _module); int lowNote = ModuleBase.readUnsignedByte (_dstream, _module); int highNote = ModuleBase.readUnsignedByte (_dstream, _module); int lowVelocity = ModuleBase.readUnsignedByte (_dstream, _module); int highVelocity = ModuleBase.readUnsignedByte (_dstream, _module);
long ckSize = ModuleBase.readUnsignedInt (stream, ENDIAN); os += 4; ckSize = ModuleBase.readUnsignedInt (stream, ENDIAN); System.out.print (leading (os, 8) + os + ": " + ckID + " " + ckSize); if ("fact".equals (ckID)) { long sampleLength = ModuleBase.readUnsignedInt (stream, ENDIAN); System.out.print (": " + sampleLength); alreadyRead = 4; int formatTag = ModuleBase.readUnsignedShort (stream, ENDIAN); int channels = ModuleBase.readUnsignedShort (stream, ENDIAN); long samplesPerSec = ModuleBase.readUnsignedInt (stream, ENDIAN); long avgBytesPerSec = ModuleBase.readUnsignedInt (stream, ENDIAN); int blockAlign = ModuleBase.readUnsignedShort (stream, ENDIAN); String hex = Integer.toHexString (formatTag); if (ckSize > 14) { int bitsPerSample = ModuleBase.readUnsignedShort (stream, ENDIAN); System.out.print (" " + bitsPerSample);
/** Reads a box header and sets up for reading contents. */ public void read () throws IOException { length = ModuleBase.readUnsignedInt (dstream, ENDIAN, null); long headerLength = 8; type = read4Chars (); // If the length field is 1, there is an 8-byte extended // length field. if (length == 1) { length = ModuleBase.readSignedLong(dstream, true, null); headerLength = 16; } bytesLeft = length - headerLength; }
public static int readSignedShort (RandomAccessFile file, boolean endian) throws IOException { int b = readUnsignedShort (file, endian); if ((b & 0X8000) != 0) { b |= ~0XFFFF; } return b; }
public static Rational readUnsignedRational (DataInputStream stream, boolean endian, ModuleBase counted) throws IOException { long n = readUnsignedInt (stream, endian, counted); long d = readUnsignedInt (stream, endian, counted); return new Rational (n, d); }
public static Rational readSignedRational (RandomAccessFile file, boolean endian) throws IOException { long n = readSignedInt (file, endian); long d = readSignedInt (file, endian); return new Rational (n, d); }
/** * Initializes the state of the module for parsing. */ @Override protected void initParse () { super.initParse (); _sig = new byte[6]; _globalColorTableFlag = false; _globalColorTableSize = 0; _gceCounter = 0; _numGraphicBlocks = 0; }
JhoveBase je = _module.getBase (); boolean raw = je.getShowRawFlag (); int styp = ModuleBase.readUnsignedByte (_dstrm, _module); if (styp > 5) { styp, JP2Strings.digitalSigTypeStr)); int ptyp = ModuleBase.readUnsignedByte (_dstrm, _module); if (ptyp > 1) { _repInfo.setMessage (new ErrorMessage ModuleBase.readByteBuf(_dstrm, data, _module);
ModuleBase.readByteBuf(_dstream, guidBytes, module); subformat = formatGUID(guidBytes); module.setWaveFormatEx(true); ModuleBase.readByteBuf(_dstream, extraBytes, module); _module.skipBytes(_dstream, 1, module); String extendedMIMEType = _module.getMimeType()[0] + "; codec=" + codecID; info.setMimeType(extendedMIMEType);
/** Skip over some bytes. Return number of bytes skipped. */ public long skipBytes(DataInputStream stream, long bytesToSkip) throws IOException { return skipBytes(stream, bytesToSkip, null); }