Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        private static void AddCharacterSet(int value, string encodingName)
        {
            CharacterSetECI eci = new CharacterSetECI(value, encodingName);

            VALUE_TO_ECI[value]       = 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;
			}
		}
Ejemplo n.º 4
0
        public static CharacterSetECI getCharacterSetECIByValue(int value)
        {
            CharacterSetECI eci = (CharacterSetECI)VALUE_TO_ECI[value];

            if (eci == null)
            {
                throw new Exception("Unsupported value: " + value);
            }
            return(eci);
        }
Ejemplo n.º 5
0
        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;
            }
        }
Ejemplo n.º 6
0
        private static void AddCharacterSet(int value, string[] encodingNames)
        {
            CharacterSetECI eci = new CharacterSetECI(value, encodingNames[0]);

            VALUE_TO_ECI[value] = eci;             // can't use valueOf
            foreach (string s in encodingNames)
            {
                NAME_TO_ECI[s] = eci;
            }
        }
Ejemplo n.º 7
0
 public static ECI getECIByValue(int value)
 {
     if (value < 0 || value > 999999)
     {
         throw new Exception("Bad ECI value: " + value);
     }
     if (value < 900)   // Character set ECIs use 000000 - 000899
     {
         return(CharacterSetECI.getCharacterSetECIByValue(value));
     }
     throw new Exception("Unsupported ECI value: " + value);
 }
Ejemplo n.º 8
0
 /// <param name="value">ECI value
 /// </param>
 /// <returns> {@link ECI} representing ECI of given value, or null if it is legal but unsupported
 /// </returns>
 /// <throws>  IllegalArgumentException if ECI value is invalid </throws>
 internal static ECI getECIByValue(int value_Renamed)
 {
     if (value_Renamed < 0 || value_Renamed > 999999)
     {
         throw new System.ArgumentException("Bad ECI value: " + value_Renamed);
     }
     if (value_Renamed < 900)
     {
         // Character set ECIs use 000000 - 000899
         return(CharacterSetECI.getCharacterSetECIByValue(value_Renamed));
     }
     return(null);
 }
Ejemplo n.º 9
0
 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;
 }
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: private static void decodeByteSegment(com.google.zxing.common.BitSource bits, StringBuilder result, int count, com.google.zxing.common.CharacterSetECI currentCharacterSetECI, java.util.Collection<byte[]> byteSegments, java.util.Map<com.google.zxing.DecodeHintType,?> hints) throws com.google.zxing.FormatException
        private static void decodeByteSegment(BitSource bits, StringBuilder result, int count, CharacterSetECI currentCharacterSetECI, ICollection<sbyte[]> byteSegments, IDictionary<DecodeHintType, object> hints)
        {
            // Don't crash trying to read more bits than we have available.
            if (count << 3 > bits.available())
            {
              throw FormatException.FormatInstance;
            }

            sbyte[] readBytes = new sbyte[count];
            for (int i = 0; i < count; i++)
            {
              readBytes[i] = (sbyte) bits.readBits(8);
            }
            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 = StringUtils.guessEncoding(readBytes, hints);
            }
            else
            {
              encoding = currentCharacterSetECI.name();
            }
            try
            {
              //result.Append(new string(readBytes, encoding));
            result.Append(GetEncodedStringFromBuffer(readBytes, encoding));
            }
            catch (System.IO.IOException)
            {
              throw FormatException.FormatInstance;
            }
            byteSegments.Add(readBytes);
        }