private int writeUTFArray(String[] utfs, int len, byte[] bufLocal, int mask, int pos) { pos = write32(bufLocal, mask, pos, len); for(int i=0;i<len;i++) { pos = encodeAsUTF8(utfs[i], utfs[i].length(), mask, bufLocal, pos); } return pos; }
@Override public void write(byte[] b) throws IOException { write(this,b,0,b.length,Integer.MAX_VALUE); }
private int writeByteArray(byte[] bytes, int len, byte[] bufLocal, int mask, int pos) { pos = write32(bufLocal, mask, pos, len); for(int i=0;i<len;i++) { bufLocal[mask & pos++] = (byte) bytes[i]; } return pos; }
@Override public void writeChar(int v) throws IOException { activePosition = write16(byteBuffer, byteMask, activePosition, v); }
public byte[] toByteArray() { byte[] result = new byte[length()]; Pipe.copyBytesFromToRing(byteBuffer, startPosition, byteMask, result, 0, Integer.MAX_VALUE, result.length); return result; }
@Override public void writeLong(long v) throws IOException { activePosition = write64(byteBuffer, byteMask, activePosition, v); }
@Override public void writeUTF(String s) throws IOException { activePosition = encodeAsUTF8(s, s.length(), byteMask, byteBuffer, activePosition); }
public void writeByteArray(byte[] bytes) throws IOException { activePosition = writeByteArray(bytes, bytes.length, byteBuffer, byteMask, activePosition); }
public void writeDoubleArray(double[] doubles) throws IOException { activePosition = writeDoubleArray(doubles, doubles.length, byteBuffer, byteMask, activePosition); }
public void writeCharArray(char[] chars) throws IOException { activePosition = writeCharArray(chars, chars.length, byteBuffer, byteMask, activePosition); }
public void writeBooleanArray(boolean[] booleans) throws IOException { activePosition = writeBooleanArray(booleans, booleans.length, byteBuffer, byteMask, activePosition); }
@Override public void writeShort(int v) throws IOException { activePosition = write16(byteBuffer, byteMask, activePosition, v); }
public byte[] toByteArray() { byte[] result = new byte[length()]; Pipe.copyBytesFromToRing(byteBuffer, startPosition, byteMask, result, 0, Integer.MAX_VALUE, result.length); return result; }
@Override public void writeLong(long v) throws IOException { activePosition = write64(byteBuffer, byteMask, activePosition, v); }
@Override public void writeUTF(String s) throws IOException { activePosition = encodeAsUTF8(s, s.length(), byteMask, byteBuffer, activePosition); }
public void writeByteArray(byte[] bytes) throws IOException { activePosition = writeByteArray(bytes, bytes.length, byteBuffer, byteMask, activePosition); }