// The integer values below map to ASCII characters like so:
// A=65, B=66, C=67, D=68, E=69, F=70, G=71, H=72, I=73, J=74, ...,
// W=87, X=88, Y=89, Z=90. Note that the second blob ends with 250,
// which is outside the range of ASCII (i.e. it is not a valid UTF-8 string
// and therefore not equivalent to any builder.append(string) call).
Factory factory = Factory.getInstance();
BlobBuilder builderAbcd = factory.createBlobBuilder();
builderAbcd.append("AB");
builderAbcd.append((byte) 67);
builderAbcd.append((byte) (68 + 2560));
Blob blobAbcd = builderAbcd.getAsBlob();
byte[] bytesAbcd = blobAbcd.getBytes();
assertEquals(4, blobAbcd.getLength());
assertEquals((byte) 65, bytesAbcd[0]);
assertEquals((byte) 66, bytesAbcd[1]);
assertEquals((byte) 67, bytesAbcd[2]);
assertEquals((byte) 68, bytesAbcd[3]);
BlobBuilder builder = factory.createBlobBuilder();
builder.append("W");
builder.append("X");
builder.append((byte) 89);
builder.append(new String[] { "Z" });
builder.append(new Blob[] { blobAbcd });