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); }
public static Rational readSignedRational (DataInputStream stream, boolean endian, ModuleBase counted) throws IOException { long n = readSignedInt (stream, endian, counted); long d = readSignedInt (stream, endian, counted); return new Rational (n, d); }
/** Reads an SRATIONAL value and returns it as a Rational. */ protected Rational readSignedRational(long count, long value) throws IOException { _raf.seek(value); long numer = ModuleBase.readSignedInt(_raf, _bigEndian); long denom = ModuleBase.readSignedInt(_raf, _bigEndian); return new Rational(numer, denom); }
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; }
/** Reads an array of SRATIONAL values and returns it as an * array of Rational. */ protected Rational [] readSignedRationalArray(long count, long value) throws IOException { _raf.seek(value); byte [] buffer = new byte [(int) calcValueSize(SRATIONAL, count)]; _raf.read(buffer); DataInputStream stream = new DataInputStream(new ByteArrayInputStream(buffer)); Rational [] rarray = new Rational [(int) count]; for (int i=0; i<count; i++) { long numer = ModuleBase.readSignedInt (stream, _bigEndian, null); long denom = ModuleBase.readSignedInt (stream, _bigEndian, null); rarray[i] = new Rational(numer, denom); } return rarray; }
int in = ModuleBase.readSignedInt (file, bigEndian); buffer.append (" " + in); long numer = ModuleBase.readSignedInt (file, bigEndian); long denom = ModuleBase.readSignedInt (file, bigEndian); buffer.append (" " + numer + "/" + denom);