/** * Get the capacity, which is the maximum count that could handled without * resizing the backing storage. * * @return The number of bytes */ public int getCapacity() { return this.get().length; }
/** * Convert the byte buffer to a string an specific character encoding * * @param charsetName Valid Java Character Set Name */ public String toString(String charsetName) throws UnsupportedEncodingException { return new String(this.get(), 0, this.getCount(), charsetName); }
/** * Convert the byte buffer to a string an specific character encoding * * @param charsetName Valid Java Character Set Name */ public String toString(String charsetName) throws UnsupportedEncodingException { return new String(this.get(), 0, this.getCount(), charsetName); }
/** * Get the capacity, which is the maximum count that could handled without * resizing the backing storage. * * @return The number of bytes */ public int getCapacity() { return this.get().length; }
/** * Convert the byte buffer to a string an specific character encoding * * @param charsetName Valid Java Character Set Name */ public String toString(String charsetName) throws UnsupportedEncodingException { return new String(this.get(), 0, this.getCount(), charsetName); }
/** * Get the capacity, which is the maximum count that could handled without * resizing the backing storage. * * @return The number of bytes */ public int getCapacity() { return this.get().length; }
/** * Writes a bytes buffer as a typed bytes sequence. * * @param buffer the bytes buffer to be written * @throws IOException */ public void writeBytes(Buffer buffer) throws IOException { writeBytes(buffer.get(), Type.BYTES.code, buffer.getCount()); }
@Override public int hashCode() { int hash = 1; byte[] b = this.get(); for (int i = 0; i < count; i++) hash = (31 * hash) + b[i]; return hash; }
/** * Writes a bytes buffer as a typed bytes sequence. * * @param buffer the bytes buffer to be written * @throws IOException */ public void writeBytes(Buffer buffer) throws IOException { writeBytes(buffer.get(), Type.BYTES.code, buffer.getCount()); }
public int hashCode() { int hash = 1; byte[] b = this.get(); for (int i = 0; i < count; i++) hash = (31 * hash) + (int)b[i]; return hash; }
@Override public Object clone() throws CloneNotSupportedException { Buffer result = (Buffer) super.clone(); result.copy(this.get(), 0, this.getCount()); return result; } }
/** * Append specified bytes to the buffer. * * @param bytes byte array to be appended * @param offset offset into byte array * @param length length of data */ public void append(byte[] bytes, int offset, int length) { setCapacity(count+length); System.arraycopy(bytes, offset, this.get(), count, length); count = count + length; }
public Object clone() throws CloneNotSupportedException { Buffer result = (Buffer) super.clone(); result.copy(this.get(), 0, this.getCount()); return result; } }
/** * Append specified bytes to the buffer. * * @param bytes byte array to be appended * @param offset offset into byte array * @param length length of data */ public void append(byte[] bytes, int offset, int length) { setCapacity(count+length); System.arraycopy(bytes, offset, this.get(), count, length); count = count + length; }
@Override public Object clone() throws CloneNotSupportedException { Buffer result = (Buffer) super.clone(); result.copy(this.get(), 0, this.getCount()); return result; } }
/** * Append specified bytes to the buffer. * * @param bytes byte array to be appended * @param offset offset into byte array * @param length length of data */ public void append(byte[] bytes, int offset, int length) { setCapacity(count+length); System.arraycopy(bytes, offset, this.get(), count, length); count = count + length; }
public Object clone() throws CloneNotSupportedException { Buffer result = (Buffer) super.clone(); result.copy(this.get(), 0, this.getCount()); return result; } }
/** * Append specified bytes to the buffer. * * @param bytes byte array to be appended * @param offset offset into byte array * @param length length of data */ public void append(byte[] bytes, int offset, int length) { setCapacity(count+length); System.arraycopy(bytes, offset, this.get(), count, length); count = count + length; }
@Override public void writeBuffer(Buffer buf, String tag) throws IOException { byte[] barr = buf.get(); int len = buf.getCount(); Utils.writeVInt(out, len); out.write(barr, 0, len); }
@Override public void writeBuffer(Buffer buf, String tag) throws IOException { byte[] barr = buf.get(); int len = buf.getCount(); Utils.writeVInt(out, len); out.write(barr, 0, len); }