/** * Method to get a date from the bytes table * * @param pAnnotation annotation data * @param pBit table bytes * @return The date read of null */ private static Date getDate(final AnnotationData pAnnotation, final BitUtils pBit) { Date date = null; if (pAnnotation.getDateStandard() == BCD_DATE) { SimpleDateFormat sdf = new SimpleDateFormat(pAnnotation.getFormat()); StringBuffer buff = new StringBuffer(); for (int i = 0; i < pAnnotation.getSize(); i += HALF_BYTE_SIZE) { buff.append(pBit.getNextInteger(HALF_BYTE_SIZE)); } try { date = sdf.parse(buff.toString()); } catch (ParseException e) { LOGGER.error("Start date invalid" + e.getMessage(), e); } } else { date = pBit.getNextDate(pAnnotation.getSize(), pAnnotation.getFormat()); } return date; }
/** * Method use to get float * * @param pAnnotation annotation * @param pBit bit utils * @return */ private static Float getFloat(final AnnotationData pAnnotation, final BitUtils pBit) { Float ret = null; if (BCD_FORMAT.equals(pAnnotation.getFormat())) { ret = Float.parseFloat(pBit.getNextHexaString(pAnnotation.getSize())); } else { ret = (float) getInteger(pAnnotation, pBit); } return ret; }