Esempio n. 1
0
 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 decodeByteSegment(BitSource bits, System.Text.StringBuilder result, int count, CharacterSetECI currentCharacterSetECI, System.Collections.ArrayList 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'"
         result.Append(System.Text.Encoding.GetEncoding(encoding).GetString(SupportClass.ToByteArray(readBytes)));
     }
     catch (System.IO.IOException)
     {
         throw ReaderException.Instance;
     }
     byteSegments.Add(SupportClass.ToByteArray(readBytes));
 }