@Test public final void testValidDataStream() { ByteArray validBinLoc = null; try { validBinLoc = new ByteArray(new ByteArrayInputStream( VALID_BIN_DATA_POS_OFFSET_V2)); } catch (IOException obe) { fail("Unexpected Exception during creation of ByteArray from " + "stream", obe); } try { RawLocationReference locRef = decodeData(validBinLoc); Lrp[] expectedLrps = new Lrp[]{Lrp.LINE_DEC_LRP1, Lrp.LINE_DEC_LRP2, Lrp.LINE_DEC_LRP3}; Utils.checkDecodedLrps(locRef, expectedLrps); checkOffsetsV3(locRef.getOffsets(), EXPECTED_POS_OFFSET_V2, EXPECTED_NEG_OFFSET_V2); } catch (PhysicalFormatException e) { fail("failed on valid input", e); } }
@Override public RawLocationReference decodeData(final LocationReference lr) throws PhysicalFormatException { Object data = lr.getLocationReferenceData(); if (data == null || !(data instanceof ByteArray)) { throw new OpenLRBinaryException( PhysicalFormatError.INVALID_BINARY_DATA); } ByteArray dataList = (ByteArray) data; return parseBinaryData(lr.getID(), dataList.getData(), null); }
OpenLRBinaryDecoder implements PhysicalDecoder { @Override public RawLocationReference decodeData(final LocationReference lr) throws PhysicalFormatException { Object data = lr.getLocationReferenceData(); if (data == null || !(data instanceof ByteArray)) { throw new OpenLRBinaryException( PhysicalFormatError.INVALID_BINARY_DATA); } ByteArray dataList = (ByteArray) data; return parseBinaryData(lr.getID(), dataList.getData(), null); } }
OpenLRBinaryDecoder implements PhysicalDecoder { @Override public RawLocationReference decodeData(final LocationReference lr) throws PhysicalFormatException { Object data = lr.getLocationReferenceData(); if (data == null || !(data instanceof ByteArray)) { throw new OpenLRBinaryException( PhysicalFormatError.INVALID_BINARY_DATA); } ByteArray dataList = (ByteArray) data; return parseBinaryData(lr.getID(), dataList.getData(), null); }  }
OpenLRBinaryDecoder implements PhysicalDecoder { @Override public RawLocationReference decodeData(final LocationReference lr) throws PhysicalFormatException { Object data = lr.getLocationReferenceData(); if (data == null || !(data instanceof ByteArray)) { throw new OpenLRBinaryException( PhysicalFormatError.INVALID_BINARY_DATA); } ByteArray dataList = (ByteArray) data; return parseBinaryData(lr.getID(), dataList.getData(), null); }  static int[] getVersions(); @Override RawLocationReference decodeData(final LocationReference lr); @Override Class<?> getDataClass(); @Override String getDataFormatIdentifier(); RawBinaryData resolveBinaryData(final String id, final ByteArray ba); }
OpenLRBinaryDecoder implements PhysicalDecoder { @Override public RawLocationReference decodeData(final LocationReference lr) throws PhysicalFormatException { Object data = lr.getLocationReferenceData(); if (data == null || !(data instanceof ByteArray)) { throw new OpenLRBinaryException( PhysicalFormatError.INVALID_BINARY_DATA); } ByteArray dataList = (ByteArray) data; return parseBinaryData(lr.getID(), dataList.getData(), null); }  static int[] getVersions(); @Override RawLocationReference decodeData(final LocationReference lr); @Override Class<?> getDataClass(); @Override String getDataFormatIdentifier(); RawBinaryData resolveBinaryData(final String id, final ByteArray ba);  }