public CaseInsensitiveIdentifier(byte [] utf8) { this(new Utf8Array(utf8)); } public CaseInsensitiveIdentifier(AbstractUtf8Array utf8) {
public DataTypeIdentifier(byte [] utf8) { this(new Utf8Array(utf8)); }
static Utf8Array parseNullTerminatedString(ByteBuffer buf, int lengthExcludingNull) throws DeserializationException { Utf8Array utf8 = new Utf8Array(buf, lengthExcludingNull); buf.get(); //move past 0-termination return utf8; }
static Utf8Array parseNullTerminatedString(ByteBuffer buf, int lengthExcludingNull) throws DeserializationException { Utf8Array utf8 = new Utf8Array(buf, lengthExcludingNull); buf.get(); //move past 0-termination return utf8; }
/** * Create by decoding the value from the given buffer * * @param src buffer where the value is stored **/ StringValue(ByteBuffer src) { int size = src.getInt(); value = new Utf8String(new Utf8Array(src, size)); }
private static boolean verifyAny(byte c, byte [] identifier) { if (!((c == '_') || ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || ((c >= '0') && (c <= '9')))) { throw new IllegalArgumentException("Illegal character '" + (char)c + "' of identifier '" + new Utf8String(new Utf8Array(identifier)).toString() +"'."); } return true; } }
private static boolean verifyAny(byte c, byte [] identifier) { if (!((c == '_') || (c == '.') || ((c >= 'a') && (c <= 'z')) || ((c >= '0') && (c <= '9')))) { throw new IllegalArgumentException("Illegal character '" + (char)c + "' of identifier '" + new Utf8String(new Utf8Array(identifier)).toString() +"'."); } return true; }
private static boolean verifyAny(byte c, byte [] identifier) { if ((c >= 'A') && (c <= 'Z')) { throw new IllegalArgumentException("Illegal uppercase character '" + (char)c + "' of identifier '" + new Utf8String(new Utf8Array(identifier)).toString() +"'."); } return true; }
private static boolean verifyFirst(byte c, byte [] identifier) { if (!((c == '_') || ((c >= 'a') && (c <= 'z')))) { throw new IllegalArgumentException("Illegal starting character '" + (char)c + "' of identifier '" + new Utf8String(new Utf8Array(identifier)).toString() +"'."); } return true; } private static boolean verifyAny(byte c, byte [] identifier) {
private static boolean verifyFirst(byte c, byte [] identifier) { if (!((c == '_') || ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')))) { throw new IllegalArgumentException("Illegal starting character '" + (char)c + "' of identifier '" + new Utf8String(new Utf8Array(identifier)).toString() +"'."); } return true; } private static boolean verifyAny(byte c, byte [] identifier) {
private DataTypeIdentifier(final byte [] prefix, DataTypeIdentifier nested, final byte [] postfix) { utf8 = new Utf8String(new Utf8Array(createPrefixDataType(prefix, nested, postfix))); } private DataTypeIdentifier(final byte [] prefix, DataTypeIdentifier key, DataTypeIdentifier value) {
private DataTypeIdentifier(final byte [] prefix, DataTypeIdentifier key, DataTypeIdentifier value) { utf8 = new Utf8String(new Utf8Array(createMapDataType(prefix, key, value))); }
public Utf8Array ascii7BitLowerCase() { byte [] upper = new byte[getByteLength()]; for (int i=0; i< upper.length; i++ ) { byte b = getByte(i); if ((b >= 0x41) && (b < (0x41+26))) { b |= 0x20; // Lowercase } upper[i] = b; } return new Utf8Array(upper); }
protected Params toParams(Values args) { CompressionType compression = CompressionType.valueOf(args.get(3).asInt8()); byte[] slimeBytes = compressor.decompress(args.get(5).asData(), compression, args.get(4).asInt32()); Slime slime = BinaryFormat.decode(slimeBytes); Inspector root = slime.get(); Params p = new Params(); p.version = new Version(root.field(VERSION_F).asString()); p.route = root.field(ROUTE_F).asString(); p.session = root.field(SESSION_F).asString(); p.retryEnabled = root.field(USERETRY_F).asBool(); p.retry = (int)root.field(RETRY_F).asLong(); p.timeRemaining = root.field(TIMEREMAINING_F).asLong(); p.protocolName = new Utf8Array(Utf8.toBytes(root.field(PROTOCOL_F).asString())); p.payload = root.field(BLOB_F).asData(); p.traceLevel = (int)root.field(TRACELEVEL_F).asLong(); return p; }
Error error = null; if (payload.length > 0) { Object retval = decode(new Utf8Array(root.field(PROTOCOL_F).asUtf8()), version, payload); if (retval instanceof Reply) { reply = (Reply) retval;