/** * Append mode info. On success, store the result in "bits". */ static void appendModeInfo(Mode mode, BitArray bits) { bits.appendBits(mode.getBits(), 4); }
static void append8BitBytes(String content, BitArray bits, String encoding) throws WriterException { byte[] bytes; try { bytes = content.getBytes(encoding); } catch (UnsupportedEncodingException uee) { throw new WriterException(uee); } for (byte b : bytes) { bits.appendBits(b, 8); } }
private static void appendECI(CharacterSetECI eci, BitArray bits) { bits.appendBits(Mode.ECI.getBits(), 4); // This is correct for values up to 127, which is all we need now. bits.appendBits(eci.getValue(), 8); }
/** * Append mode info. On success, store the result in "bits". */ static void appendModeInfo(Mode mode, BitArray bits) { bits.appendBits(mode.getBits(), 4); }
private static void appendECI(CharacterSetECI eci, BitArray bits) { bits.appendBits(Mode.ECI.getBits(), 4); // This is correct for values up to 127, which is all we need now. bits.appendBits(eci.getValue(), 8); }
static void append8BitBytes(String content, BitArray bits, String encoding) throws WriterException { byte[] bytes; try { bytes = content.getBytes(encoding); } catch (UnsupportedEncodingException uee) { throw new WriterException(uee); } for (byte b : bytes) { bits.appendBits(b, 8); } }
/** * Append mode info. On success, store the result in "bits". */ static void appendModeInfo(Mode mode, BitArray bits) { bits.appendBits(mode.getBits(), 4); }
static void append8BitBytes(String content, BitArray bits, String encoding) throws WriterException { byte[] bytes; try { bytes = content.getBytes(encoding); } catch (UnsupportedEncodingException uee) { throw new WriterException(uee.toString()); } for (int i = 0; i < bytes.length; ++i) { bits.appendBits(bytes[i], 8); } }
private static void appendECI(ECI eci, BitArray bits) { bits.appendBits(Mode.ECI.getBits(), 4); // This is correct for values up to 127, which is all we need now. bits.appendBits(eci.getValue(), 8); }
private static void appendECI(CharacterSetECI eci, BitArray bits) { bits.appendBits(Mode.ECI.getBits(), 4); // This is correct for values up to 127, which is all we need now. bits.appendBits(eci.getValue(), 8); }
/** * Append mode info. On success, store the result in "bits". */ static void appendModeInfo(Mode mode, BitArray bits) { bits.appendBits(mode.getBits(), 4); }
static void append8BitBytes(String content, BitArray bits, String encoding) throws WriterException { byte[] bytes; try { bytes = content.getBytes(encoding); } catch (UnsupportedEncodingException uee) { throw new WriterException(uee.toString()); } for (int i = 0; i < bytes.length; ++i) { bits.appendBits(bytes[i], 8); } }
/** * Append length info. On success, store the result in "bits". */ static void appendLengthInfo(int numLetters, Version version, Mode mode, BitArray bits) throws WriterException { int numBits = mode.getCharacterCountBits(version); if (numLetters >= (1 << numBits)) { throw new WriterException(numLetters + " is bigger than " + ((1 << numBits) - 1)); } bits.appendBits(numLetters, numBits); }
/** * Append length info. On success, store the result in "bits". */ static void appendLengthInfo(int numLetters, Version version, Mode mode, BitArray bits) throws WriterException { int numBits = mode.getCharacterCountBits(version); if (numLetters >= (1 << numBits)) { throw new WriterException(numLetters + " is bigger than " + ((1 << numBits) - 1)); } bits.appendBits(numLetters, numBits); }
public static void makeVersionInfoBits(int version, BitArray bits) throws WriterException { bits.appendBits(version, 6); int bchCode = calculateBCHCode(version, VERSION_INFO_POLY); bits.appendBits(bchCode, 12); if (bits.getSize() != 18) { // Just in case. throw new WriterException("should not happen but we got: " + bits.getSize()); } }
public static void makeVersionInfoBits(int version, BitArray bits) throws WriterException { bits.appendBits(version, 6); int bchCode = calculateBCHCode(version, VERSION_INFO_POLY); bits.appendBits(bchCode, 12); if (bits.getSize() != 18) { // Just in case. throw new WriterException("should not happen but we got: " + bits.getSize()); } }
/** * Append length info. On success, store the result in "bits". */ static void appendLengthInfo(int numLetters, int version, Mode mode, BitArray bits) throws WriterException { int numBits = mode.getCharacterCountBits(Version.getVersionForNumber(version)); if (numLetters > ((1 << numBits) - 1)) { throw new WriterException(numLetters + "is bigger than" + ((1 << numBits) - 1)); } bits.appendBits(numLetters, numBits); }
static void makeVersionInfoBits(Version version, BitArray bits) throws WriterException { bits.appendBits(version.getVersionNumber(), 6); int bchCode = calculateBCHCode(version.getVersionNumber(), VERSION_INFO_POLY); bits.appendBits(bchCode, 12); if (bits.getSize() != 18) { // Just in case. throw new WriterException("should not happen but we got: " + bits.getSize()); } }
static void makeVersionInfoBits(Version version, BitArray bits) throws WriterException { bits.appendBits(version.getVersionNumber(), 6); int bchCode = calculateBCHCode(version.getVersionNumber(), VERSION_INFO_POLY); bits.appendBits(bchCode, 12); if (bits.getSize() != 18) { // Just in case. throw new WriterException("should not happen but we got: " + bits.getSize()); } }
/** * Append length info. On success, store the result in "bits". */ static void appendLengthInfo(int numLetters, int version, Mode mode, BitArray bits) throws WriterException { int numBits = mode.getCharacterCountBits(Version.getVersionForNumber(version)); if (numLetters > ((1 << numBits) - 1)) { throw new WriterException(numLetters + "is bigger than" + ((1 << numBits) - 1)); } bits.appendBits(numLetters, numBits); }