@Test public void testReadDouble() throws Exception { setContents("38" + "0000000000000000" + "38" + "3FF0000000000000" + "38" + "4000000000000000" + "38" + "BFF0000000000000" + "38" + "8000000000000000" + "38" + "FFF0000000000000" + "38" + "7FF0000000000000" + "38" + "7FF8000000000000"); assertEquals(0, Double.compare(0.0, r.readDouble())); assertEquals(0, Double.compare(1.0, r.readDouble())); assertEquals(0, Double.compare(2.0, r.readDouble())); assertEquals(0, Double.compare(-1.0, r.readDouble())); assertEquals(0, Double.compare(-0.0, r.readDouble())); assertEquals(0, Double.compare(Double.NEGATIVE_INFINITY, r.readDouble())); assertEquals(0, Double.compare(Double.POSITIVE_INFINITY, r.readDouble())); assertTrue(Double.isNaN(r.readDouble())); assertTrue(r.eof()); }
@Override public double readDouble() throws IOException { if (!hasDouble()) throw new FormatException(); hasLookahead = false; readIntoBuffer(8); long value = 0; for (int i = 0; i < 8; i++) value |= (buf[i] & 0xFFL) << (56 - i * 8); return Double.longBitsToDouble(value); }
BdfReaderImpl implements BdfReader { @Override public double readDouble() throws IOException { if (!hasDouble()) throw new FormatException(); hasLookahead = false; readIntoBuffer(8); long value = 0; for (int i = 0; i < 8; i++) value |= (buf[i] & 0xFFL) << (56 - i * 8); return Double.longBitsToDouble(value); } }
BdfReaderImpl implements BdfReader { @Override public double readDouble() throws IOException { if (!hasDouble()) throw new FormatException(); hasLookahead = false; readIntoBuffer(8); long value = 0; for (int i = 0; i < 8; i++) value |= (buf[i] & 0xFFL) << (56 - i * 8); return Double.longBitsToDouble(value); } BdfReaderImpl(InputStream in, int nestedLimit, int maxBufferSize); }
BdfReaderImpl implements BdfReader { @Override public double readDouble() throws IOException { if (!hasDouble()) throw new FormatException(); hasLookahead = false; readIntoBuffer(8); long value = 0; for (int i = 0; i < 8; i++) value |= (buf[i] & 0xFFL) << (56 - i * 8); return Double.longBitsToDouble(value); } BdfReaderImpl(InputStream in, int nestedLimit, int maxBufferSize); @Override boolean eof(); @Override void close(); @Override boolean hasNull(); @Override void readNull(); @Override void skipNull(); @Override boolean hasBoolean(); @Override boolean readBoolean(); @Override void skipBoolean(); @Override boolean hasLong(); @Override long readLong(); @Override void skipLong(); @Override boolean hasDouble(); @Override double readDouble(); @Override void skipDouble(); @Override boolean hasString(); @Override String readString(); @Override void skipString(); @Override boolean hasRaw(); @Override byte[] readRaw(); @Override void skipRaw(); @Override boolean hasList(); @Override BdfList readList(); @Override void readListStart(); @Override boolean hasListEnd(); @Override void readListEnd(); @Override void skipList(); @Override boolean hasDictionary(); @Override BdfDictionary readDictionary(); @Override void readDictionaryStart(); @Override boolean hasDictionaryEnd(); @Override void readDictionaryEnd(); @Override void skipDictionary(); }
BdfReaderImpl implements BdfReader { @Override public double readDouble() throws IOException { if (!hasDouble()) throw new FormatException(); hasLookahead = false; readIntoBuffer(8); long value = 0; for (int i = 0; i < 8; i++) value |= (buf[i] & 0xFFL) << (56 - i * 8); return Double.longBitsToDouble(value); } BdfReaderImpl(InputStream in, int nestedLimit, int maxBufferSize); @Override boolean eof(); @Override void close(); @Override boolean hasNull(); @Override void readNull(); @Override void skipNull(); @Override boolean hasBoolean(); @Override boolean readBoolean(); @Override void skipBoolean(); @Override boolean hasLong(); @Override long readLong(); @Override void skipLong(); @Override boolean hasDouble(); @Override double readDouble(); @Override void skipDouble(); @Override boolean hasString(); @Override String readString(); @Override void skipString(); @Override boolean hasRaw(); @Override byte[] readRaw(); @Override void skipRaw(); @Override boolean hasList(); @Override BdfList readList(); @Override void readListStart(); @Override boolean hasListEnd(); @Override void readListEnd(); @Override void skipList(); @Override boolean hasDictionary(); @Override BdfDictionary readDictionary(); @Override void readDictionaryStart(); @Override boolean hasDictionaryEnd(); @Override void readDictionaryEnd(); @Override void skipDictionary();  }