override public String parseInformation() { if (this.getInformation().Size < HEADER_SIZE + GTIN_SIZE) { return(null); } StringBuilder buf = new StringBuilder(); encodeCompressedGtin(buf, HEADER_SIZE); int lastAIdigit = this.getGeneralDecoder().extractNumericValueFromBitArray(HEADER_SIZE + GTIN_SIZE, LAST_DIGIT_SIZE); buf.Append("(392"); buf.Append(lastAIdigit); buf.Append(')'); DecodedInformation decodedInformation = this.getGeneralDecoder().decodeGeneralPurposeField(HEADER_SIZE + GTIN_SIZE + LAST_DIGIT_SIZE, null); buf.Append(decodedInformation.getNewString()); return(buf.ToString()); }
internal String decodeAllCodes(StringBuilder buff, int initialPosition) { int currentPosition = initialPosition; String remaining = null; do { DecodedInformation info = this.decodeGeneralPurposeField(currentPosition, remaining); String parsedFields = FieldParser.parseFieldsInGeneralPurpose(info.getNewString()); if (parsedFields != null) { buff.Append(parsedFields); } if (info.isRemaining()) { remaining = info.getRemainingValue().ToString(); } else { remaining = null; } if (currentPosition == info.NewPosition) {// No step forward! break; } currentPosition = info.NewPosition; } while (true); return(buff.ToString()); }
private BlockParsedResult parseIsoIec646Block() { while (isStillIsoIec646(current.getPosition())) { DecodedChar iso = decodeIsoIec646(current.getPosition()); current.setPosition(iso.NewPosition); if (iso.isFNC1()) { DecodedInformation information = new DecodedInformation(current.getPosition(), buffer.ToString()); return(new BlockParsedResult(information, true)); } buffer.Append(iso.getValue()); } if (isAlphaOr646ToNumericLatch(current.getPosition())) { current.incrementPosition(3); current.setNumeric(); } else if (isAlphaTo646ToAlphaLatch(current.getPosition())) { if (current.getPosition() + 5 < this.information.Size) { current.incrementPosition(5); } else { current.setPosition(this.information.Size); } current.setAlpha(); } return(new BlockParsedResult(false)); }
internal DecodedInformation decodeGeneralPurposeField(int pos, String remaining) { this.buffer.Length = 0; if (remaining != null) { this.buffer.Append(remaining); } this.current.setPosition(pos); DecodedInformation lastDecoded = parseBlocks(); if (lastDecoded != null && lastDecoded.isRemaining()) { return(new DecodedInformation(this.current.getPosition(), this.buffer.ToString(), lastDecoded.getRemainingValue())); } return(new DecodedInformation(this.current.getPosition(), this.buffer.ToString())); }
override public String parseInformation() { if (this.getInformation().Size < HEADER_SIZE + GTIN_SIZE) { return(null); } StringBuilder buf = new StringBuilder(); encodeCompressedGtin(buf, HEADER_SIZE); int lastAIdigit = this.getGeneralDecoder().extractNumericValueFromBitArray(HEADER_SIZE + GTIN_SIZE, LAST_DIGIT_SIZE); buf.Append("(393"); buf.Append(lastAIdigit); buf.Append(')'); int firstThreeDigits = this.getGeneralDecoder().extractNumericValueFromBitArray(HEADER_SIZE + GTIN_SIZE + LAST_DIGIT_SIZE, FIRST_THREE_DIGITS_SIZE); if (firstThreeDigits / 100 == 0) { buf.Append('0'); } if (firstThreeDigits / 10 == 0) { buf.Append('0'); } buf.Append(firstThreeDigits); DecodedInformation generalInformation = this.getGeneralDecoder().decodeGeneralPurposeField(HEADER_SIZE + GTIN_SIZE + LAST_DIGIT_SIZE + FIRST_THREE_DIGITS_SIZE, null); buf.Append(generalInformation.getNewString()); return(buf.ToString()); }
private BlockParsedResult parseNumericBlock() { while (isStillNumeric(current.getPosition())) { DecodedNumeric numeric = decodeNumeric(current.getPosition()); current.setPosition(numeric.NewPosition); if (numeric.isFirstDigitFNC1()) { DecodedInformation information; if (numeric.isSecondDigitFNC1()) { information = new DecodedInformation(current.getPosition(), buffer.ToString()); } else { information = new DecodedInformation(current.getPosition(), buffer.ToString(), numeric.getSecondDigit()); } return(new BlockParsedResult(information, true)); } buffer.Append(numeric.getFirstDigit()); if (numeric.isSecondDigitFNC1()) { DecodedInformation information = new DecodedInformation(current.getPosition(), buffer.ToString()); return(new BlockParsedResult(information, true)); } buffer.Append(numeric.getSecondDigit()); } if (isNumericToAlphaNumericLatch(current.getPosition())) { current.setAlpha(); current.incrementPosition(4); } return(new BlockParsedResult(false)); }