static final String readUTF8String(ChannelBuffer buffer, byte[] fourBytes) {
int size = readInt32(buffer, fourBytes);
// this is just protection in case it's corrupted, to avoid huge strings
if (size <= 0 || size > (32 * 1024 * 1024))
throw new BSONException("bad string size: " + size);
byte[] b = new byte[size];
buffer.readBytes(b);
try {
return new String(b, 0, size - 1, "UTF-8");
} catch (java.io.UnsupportedEncodingException uee) {
throw new BSONException("impossible", uee);
}
}