private static void appendECI(CharacterSetECI eci, BitVector bits) { bits.appendBits(Mode.ECI.Bits, 4); // This is correct for values up to 127, which is all we need now. bits.appendBits(eci.Value, 8); }
private static void addCharacterSet(int value_Renamed, System.String encodingName) { CharacterSetECI eci = new CharacterSetECI(value_Renamed, encodingName); VALUE_TO_ECI[(System.Int32) value_Renamed] = eci; // can't use valueOf NAME_TO_ECI[encodingName] = eci; }
private static void addCharacterSet(int value_Renamed, System.String[] encodingNames) { CharacterSetECI eci = new CharacterSetECI(value_Renamed, encodingNames[0]); VALUE_TO_ECI[(System.Int32) value_Renamed] = eci; // can't use valueOf for (int i = 0; i < encodingNames.Length; i++) { NAME_TO_ECI[encodingNames[i]] = eci; } }
private static void decodeByteSegment(BitSource bits, System.Text.StringBuilder result, int count, CharacterSetECI currentCharacterSetECI, System.Collections.Generic.List<Object> byteSegments) { sbyte[] readBytes = new sbyte[count]; if (count << 3 > bits.available()) { throw ReaderException.Instance; } for (int i = 0; i < count; i++) { readBytes[i] = (sbyte) bits.readBits(8); } System.String encoding; if (currentCharacterSetECI == null) { // The spec isn't clear on this mode; see // section 6.4.5: t does not say which encoding to assuming // upon decoding. I have seen ISO-8859-1 used as well as // Shift_JIS -- without anything like an ECI designator to // give a hint. encoding = guessEncoding(readBytes); } else { encoding = currentCharacterSetECI.EncodingName; } try { //UPGRADE_TODO: The differences in the Format of parameters for constructor 'java.lang.String.String' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1092'" //Marauderz : Switching to UTF 8 encoding //result.Append(System.Text.Encoding.GetEncoding(encoding).GetString(SupportClass.ToByteArray(readBytes))); byte[] inputBytes =SupportClass.ToByteArray(readBytes); //Marauderz : Errrr... what if this thing isn't Null terminated? result.Append(System.Text.Encoding.UTF8.GetString(inputBytes,0,inputBytes.Length)); } catch (System.IO.IOException uce) { throw ReaderException.Instance; } byteSegments.Add(SupportClass.ToByteArray(readBytes)); }