()
| 251 | } |
| 252 | |
| 253 | static void TestSizedInputStream() { |
| 254 | // Test on default FlatBufferBuilder that uses HeapByteBuffer |
| 255 | FlatBufferBuilder fbb = new FlatBufferBuilder(1); |
| 256 | |
| 257 | TestBuilderBasics(fbb, false); |
| 258 | |
| 259 | InputStream in = fbb.sizedInputStream(); |
| 260 | byte[] array = fbb.sizedByteArray(); |
| 261 | int count = 0; |
| 262 | int currentVal = 0; |
| 263 | |
| 264 | while (currentVal != -1 && count < array.length) { |
| 265 | try { |
| 266 | currentVal = in.read(); |
| 267 | } catch(java.io.IOException e) { |
| 268 | System.out.println("FlatBuffers test: couldn't read from InputStream"); |
| 269 | return; |
| 270 | } |
| 271 | TestEq((byte)currentVal, array[count]); |
| 272 | count++; |
| 273 | } |
| 274 | TestEq(count, array.length); |
| 275 | } |
| 276 | |
| 277 | static void TestBuilderBasics(FlatBufferBuilder fbb, boolean sizePrefix) { |
| 278 | int[] names = {fbb.createString("Frodo"), fbb.createString("Barney"), fbb.createString("Wilma")}; |
no test coverage detected