예제 #1
0
파일: Helper.java 프로젝트: jruyi/jruyi
 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);
   }
 }
예제 #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);
   }
 }