private int _appendByte(int ch, int esc, ByteArrayBuilder bb, int ptr) { bb.setCurrentSegmentLength(ptr); bb.append('\\'); if (esc < 0) { // standard escape bb.append('u'); if (ch > 0xFF) { int hi = (ch >> 8); bb.append(HB[hi >> 4]); bb.append(HB[hi & 0xF]); ch &= 0xFF; } else { bb.append('0'); bb.append('0'); } bb.append(HB[ch >> 4]); bb.append(HB[ch & 0xF]); } else { // 2-char simple escape bb.append((byte) esc); } return bb.getCurrentSegmentLength(); }
private int _appendByte(int ch, int esc, ByteArrayBuilder bb, int ptr) { bb.setCurrentSegmentLength(ptr); bb.append('\\'); if (esc < 0) { // standard escape bb.append('u'); if (ch > 0xFF) { int hi = (ch >> 8); bb.append(HB[hi >> 4]); bb.append(HB[hi & 0xF]); ch &= 0xFF; } else { bb.append('0'); bb.append('0'); } bb.append(HB[ch >> 4]); bb.append(HB[ch & 0xF]); } else { // 2-char simple escape bb.append((byte) esc); } return bb.getCurrentSegmentLength(); }
private int _appendByte(int ch, int esc, ByteArrayBuilder bb, int ptr) { bb.setCurrentSegmentLength(ptr); bb.append('\\'); if (esc < 0) { // standard escape bb.append('u'); if (ch > 0xFF) { int hi = (ch >> 8); bb.append(HB[hi >> 4]); bb.append(HB[hi & 0xF]); ch &= 0xFF; } else { bb.append('0'); bb.append('0'); } bb.append(HB[ch >> 4]); bb.append(HB[ch & 0xF]); } else { // 2-char simple escape bb.append((byte) esc); } return bb.getCurrentSegmentLength(); }
private int _appendByteEscape(int ch, int escCode, ByteArrayBuilder byteBuilder, int ptr) { byteBuilder.setCurrentSegmentLength(ptr); byteBuilder.append(INT_BACKSLASH); if (escCode < 0) { // standard escape byteBuilder.append(INT_U); if (ch > 0xFF) { int hi = (ch >> 8); byteBuilder.append(HEX_BYTES[hi >> 4]); byteBuilder.append(HEX_BYTES[hi & 0xF]); ch &= 0xFF; } else { byteBuilder.append(INT_0); byteBuilder.append(INT_0); } byteBuilder.append(HEX_BYTES[ch >> 4]); byteBuilder.append(HEX_BYTES[ch & 0xF]); } else { // 2-char simple escape byteBuilder.append((byte) escCode); } return byteBuilder.getCurrentSegmentLength(); }
private int _appendByte(int ch, int esc, ByteArrayBuilder bb, int ptr) { bb.setCurrentSegmentLength(ptr); bb.append('\\'); if (esc < 0) { // standard escape bb.append('u'); if (ch > 0xFF) { int hi = (ch >> 8); bb.append(HB[hi >> 4]); bb.append(HB[hi & 0xF]); ch &= 0xFF; } else { bb.append('0'); bb.append('0'); } bb.append(HB[ch >> 4]); bb.append(HB[ch & 0xF]); } else { // 2-char simple escape bb.append((byte) esc); } return bb.getCurrentSegmentLength(); }
private int _appendByte(int ch, int esc, ByteArrayBuilder bb, int ptr) { bb.setCurrentSegmentLength(ptr); bb.append('\\'); if (esc < 0) { // standard escape bb.append('u'); if (ch > 0xFF) { int hi = (ch >> 8); bb.append(HB[hi >> 4]); bb.append(HB[hi & 0xF]); ch &= 0xFF; } else { bb.append('0'); bb.append('0'); } bb.append(HB[ch >> 4]); bb.append(HB[ch & 0xF]); } else { // 2-char simple escape bb.append((byte) esc); } return bb.getCurrentSegmentLength(); }
private int _appendByteEscape(int ch, int escCode, ByteArrayBuilder byteBuilder, int ptr) { byteBuilder.setCurrentSegmentLength(ptr); byteBuilder.append(INT_BACKSLASH); if (escCode < 0) { // standard escape byteBuilder.append(INT_U); if (ch > 0xFF) { int hi = (ch >> 8); byteBuilder.append(HEX_BYTES[hi >> 4]); byteBuilder.append(HEX_BYTES[hi & 0xF]); ch &= 0xFF; } else { byteBuilder.append(INT_0); byteBuilder.append(INT_0); } byteBuilder.append(HEX_BYTES[ch >> 4]); byteBuilder.append(HEX_BYTES[ch & 0xF]); } else { // 2-char simple escape byteBuilder.append((byte) escCode); } return byteBuilder.getCurrentSegmentLength(); }
private int _appendByte(int ch, int esc, ByteArrayBuilder bb, int ptr) { bb.setCurrentSegmentLength(ptr); bb.append('\\'); if (esc < 0) { // standard escape bb.append('u'); if (ch > 0xFF) { int hi = (ch >> 8); bb.append(HB[hi >> 4]); bb.append(HB[hi & 0xF]); ch &= 0xFF; } else { bb.append('0'); bb.append('0'); } bb.append(HB[ch >> 4]); bb.append(HB[ch & 0xF]); } else { // 2-char simple escape bb.append((byte) esc); } return bb.getCurrentSegmentLength(); }