/** * Writes the specified byte to this byte array output stream. * * @param b the byte to be written. */ public void write(int b) { data.add(b); }
public void add(byte[] b) { if (b == null || b.length == 0) { return; } add(b, 0, b.length); }
/** * Writes <code>len</code> bytes from the specified byte array * starting at offset <code>off</code> to this byte array output stream. * <p/> * <b>NO checks for bounds, parameters must be ok!</b> * * @param b the data. * @param off the start offset in the data. * @param len the number of bytes to write. */ public void write(byte b[], int off, int len) { data.add(b, off, len); }
public void copyTo(BytesArray to) { to.add(bytes, offset, size); }
public void add(String string) { if (string == null) { return; } add(string.getBytes(StringUtils.UTF_8)); }
public void copyTo(BytesArray to) { if (list == null) { return; } for (Object ref : list) { if (ref instanceof BytesArray) { ((BytesArray) ref).copyTo(to); } else { to.add((byte[]) ref); } } }
doc.add('{'); doc.add(input.bytes(), rangeStart, rangeStop - rangeStart); doc.add(','); doc.add('"'); doc.add(StringUtils.jsonEncoding(metadataField)); doc.add('"'); doc.add(':'); doc.add('{'); doc.add(input.bytes(), rangeStart, rangeStop - rangeStart); bytesPositionIndex += 2; doc.add('}'); doc.add('}');
@Test public void equalsHashCode() { BytesArray a = new BytesArray(10); BytesArray b = new BytesArray(20); BytesArray c = new BytesArray(""); assertEquals(a, b); assertEquals(b, a); assertEquals(a, c); assertEquals(b, c); assertEquals(c, a); assertEquals(c, b); assertEquals(a.hashCode(), b.hashCode()); assertEquals(a.hashCode(), c.hashCode()); BytesArray d = new BytesArray("test"); BytesArray e = new BytesArray(20); e.add("test"); assertEquals(d, e); assertEquals(e, d); assertEquals(e.hashCode(), d.hashCode()); } }
/** * Writes the specified byte to this byte array output stream. * * @param b the byte to be written. */ public void write(int b) { data.add(b); }
/** * Writes the specified byte to this byte array output stream. * * @param b the byte to be written. */ public void write(int b) { data.add(b); }
public void add(byte[] b) { if (b == null || b.length == 0) { return; } add(b, 0, b.length); }
/** * Writes the specified byte to this byte array output stream. * * @param b the byte to be written. */ public void write(int b) { data.add(b); }
public void add(byte[] b) { if (b == null || b.length == 0) { return; } add(b, 0, b.length); }
public void add(byte[] b) { if (b == null || b.length == 0) { return; } add(b, 0, b.length); }
public void add(byte[] b) { if (b == null || b.length == 0) { return; } add(b, 0, b.length); }
/** * Writes the specified byte to this byte array output stream. * * @param b the byte to be written. */ public void write(int b) { data.add(b); }
public void add(String string) { if (string == null) { return; } add(string.getBytes(StringUtils.UTF_8)); }
public void add(String string) { if (string == null) { return; } add(string.getBytes(StringUtils.UTF_8)); }
public void add(String string) { if (string == null) { return; } add(string.getBytes(StringUtils.UTF_8)); }