Esempio n. 1
0
 public static void prepend(ICharsetCodec cc, StringBuilder sb, IUnitChain unitChain) {
   try (BytesBuilder bb = BytesBuilder.get()) {
     cc.encode(sb, bb);
     int length = bb.length();
     IUnit unit = Util.firstUnit(unitChain);
     while ((length -= prepend(bb, 0, length, unit)) > 0) unit = Util.prependNewUnit(unitChain);
   }
 }
Esempio n. 2
0
 @Override
 public void prepend(char[] chars, int offset, int length, IUnitChain unitChain) {
   final ICharsetCodec cc = CharsetCodec.get(m_charsetName);
   try (BytesBuilder bb = BytesBuilder.get()) {
     cc.encode(chars, offset, length, bb);
     length = bb.length();
     IUnit unit = Util.firstUnit(unitChain);
     while ((length -= Helper.prepend(bb, 0, length, unit)) > 0)
       unit = Util.prependNewUnit(unitChain);
   }
 }