List of usage examples for java.io DataInput readLine
String readLine() throws IOException;
From source file:dk.statsbiblioteket.util.LineReaderTest.java
public void testSample(String type, DataInput in) throws Exception { assertEquals("Int 1 should work for " + type, 12345, in.readInt()); assertEquals("Int 2 should work for " + type, -87, in.readInt()); assertEquals("Long should work for " + type, 123456789L, in.readLong()); assertEquals("String 1 should work for " + type, "Hello World!", in.readLine()); assertEquals("String 2 should work for " + type, "Another world", in.readLine()); assertEquals("Float should work for " + type, 0.5f, in.readFloat()); assertEquals("Boolean 1 should work for " + type, true, in.readBoolean()); assertEquals("Boolean 2 should work for " + type, false, in.readBoolean()); assertEquals("Byte 1 should work for " + type, (byte) 12, in.readByte()); assertEquals("Byte 2 should work for " + type, (byte) -12, in.readByte()); assertEquals("Unsigned byte should work for " + type, 129, in.readUnsignedByte()); assertEquals("Short should work for " + type, -4567, in.readShort()); byte[] loaded = new byte[5]; byte[] expected = new byte[] { (byte) 'A', (byte) 'S', (byte) 'C', (byte) 'I', (byte) 'I' }; in.readFully(loaded);/*w w w . j a v a2 s. c o m*/ for (int i = 0; i < loaded.length; i++) { assertEquals("Byte-stored string should be equal at byte " + i + " for " + type, expected[i], loaded[i]); } }
From source file:org.pepstock.jem.util.filters.predicates.JemFilterPredicate.java
@Override public void readData(DataInput dataInput) throws IOException { // de-serialize the filter object String filterString = dataInput.readLine(); filter = (Filter) stream.fromXML(filterString); }