public ByteSequence getTerm(byte expression[]) { if (type != NodeType.TERM) throw new RuntimeException(); if (expression[start] == '"') { // its a quoted term int qStart = start + 1; int qEnd = end - 1; return new ArrayByteSequence(expression, qStart, qEnd - qStart); } return new ArrayByteSequence(expression, start, end - start); } }
public ByteSequence getTerm(byte expression[]) { if (type != NodeType.TERM) throw new RuntimeException(); if (expression[start] == '"') { // its a quoted term int qStart = start + 1; int qEnd = end - 1; return new ArrayByteSequence(expression, qStart, qEnd - qStart); } return new ArrayByteSequence(expression, start, end - start); } }
/** * Checks whether this object contains the given authorization. * * @param auth authorization, as a string encoded in UTF-8 * @return true if authorization is in this collection */ public boolean contains(byte[] auth) { return auths.contains(new ArrayByteSequence(auth)); }
@Override public ByteSequence subSequence(int start, int end) { if (start > end || start < 0 || end > length) { throw new IllegalArgumentException("Bad start and/end start = " + start + " end=" + end + " offset=" + offset + " length=" + length); } return new ArrayByteSequence(data, offset + start, end - start); }
/** * Checks whether this object contains the given authorization. * * @param auth authorization * @return true if authorization is in this collection */ public boolean contains(String auth) { return auths.contains(new ArrayByteSequence(auth)); }
@Override public ByteSequence subSequence(int start, int end) { if (start > end || start < 0 || end > length) { throw new IllegalArgumentException("Bad start and/end start = " + start + " end=" + end + " offset=" + offset + " length=" + length); } return new ArrayByteSequence(data, offset + start, end - start); }
/** * Checks whether this object contains the given authorization. * * @param auth authorization, as a string encoded in UTF-8 * @return true if authorization is in this collection */ public boolean contains(byte[] auth) { return auths.contains(new ArrayByteSequence(auth)); }
/** * Checks whether this object contains the given authorization. * * @param auth authorization * @return true if authorization is in this collection */ public boolean contains(String auth) { return auths.contains(new ArrayByteSequence(auth)); }
/** * Constructs an authorization object from a collection of string authorizations that have each already been encoded as UTF-8 bytes. Warning: This method does * not verify that each encoded string is valid UTF-8. * * @param authorizations collection of authorizations, as strings encoded in UTF-8 * @throws IllegalArgumentException if authorizations is null * @see #Authorizations(String...) */ public Authorizations(Collection<byte[]> authorizations) { for (byte[] auth : authorizations) auths.add(new ArrayByteSequence(auth)); checkAuths(); }
private void setAuthorizations(String... authorizations) { auths.clear(); for (String str : authorizations) { str = str.trim(); auths.add(new ArrayByteSequence(str.getBytes(Constants.UTF8))); } checkAuths(); }
private void setAuthorizations(String... authorizations) { auths.clear(); for (String str : authorizations) { str = str.trim(); auths.add(new ArrayByteSequence(str.getBytes(Constants.UTF8))); } checkAuths(); }
/** * Constructs an authorization object from a collection of string authorizations that have each already been encoded as UTF-8 bytes. Warning: This method does * not verify that each encoded string is valid UTF-8. * * @param authorizations collection of authorizations, as strings encoded in UTF-8 * @throws IllegalArgumentException if authorizations is null * @see #Authorizations(String...) */ public Authorizations(Collection<byte[]> authorizations) { for (byte[] auth : authorizations) auths.add(new ArrayByteSequence(auth)); checkAuths(); }
/** * Constructs an authorization object from a list of string authorizations that have each already been encoded as UTF-8 bytes. Warning: This method does not * verify that each encoded string is valid UTF-8. * * @param authorizations list of authorizations, as strings encoded in UTF-8 and placed in buffers * @throws IllegalArgumentException if authorizations is null * @see #Authorizations(String...) */ public Authorizations(List<ByteBuffer> authorizations) { for (ByteBuffer buffer : authorizations) { auths.add(new ArrayByteSequence(ByteBufferUtil.toBytes(buffer))); } checkAuths(); }
/** * Constructs an authorization object from a list of string authorizations that have each already been encoded as UTF-8 bytes. Warning: This method does not * verify that each encoded string is valid UTF-8. * * @param authorizations list of authorizations, as strings encoded in UTF-8 and placed in buffers * @throws IllegalArgumentException if authorizations is null * @see #Authorizations(String...) */ public Authorizations(List<ByteBuffer> authorizations) { for (ByteBuffer buffer : authorizations) { auths.add(new ArrayByteSequence(ByteBufferUtil.toBytes(buffer))); } checkAuths(); }