/** * Find the index of a header with the given name. */ public int indexOf(final Header header, final int fromIndex) { // We can use a hash - but it's not clear how much // benefit you can get - there is an overhead // and the number of headers is small (4-5 ?) // Another problem is that we'll pay the overhead // of constructing the hashtable // A custom search tree may be better final byte[] bytes = header.getLowerCaseBytes(); for (int i = fromIndex; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase(bytes)) { return i; } } return -1; }
/** * Find the index of a header with the given name. */ public int indexOf(final Header header, final int fromIndex) { // We can use a hash - but it's not clear how much // benefit you can get - there is an overhead // and the number of headers is small (4-5 ?) // Another problem is that we'll pay the overhead // of constructing the hashtable // A custom search tree may be better final byte[] bytes = header.getLowerCaseBytes(); for (int i = fromIndex; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase(bytes)) { return i; } } return -1; }
/** * Find the index of a header with the given name. */ public int indexOf(final Header header, final int fromIndex) { // We can use a hash - but it's not clear how much // benefit you can get - there is an overhead // and the number of headers is small (4-5 ?) // Another problem is that we'll pay the overhead // of constructing the hashtable // A custom search tree may be better final byte[] bytes = header.getLowerCaseBytes(); for (int i = fromIndex; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase(bytes)) { return i; } } return -1; }
/** * Find the index of a header with the given name. */ public int indexOf(final Header header, final int fromIndex) { // We can use a hash - but it's not clear how much // benefit you can get - there is an overhead // and the number of headers is small (4-5 ?) // Another problem is that we'll pay the overhead // of constructing the hashtable // A custom search tree may be better final byte[] bytes = header.getLowerCaseBytes(); for (int i = fromIndex; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase(bytes)) { return i; } } return -1; }
/** * Find the index of a header with the given name. */ public int indexOf(final Header header, final int fromIndex) { // We can use a hash - but it's not clear how much // benefit you can get - there is an overhead // and the number of headers is small (4-5 ?) // Another problem is that we'll pay the overhead // of constructing the hashtable // A custom search tree may be better final byte[] bytes = header.getLowerCaseBytes(); for (int i = fromIndex; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase(bytes)) { return i; } } return -1; }
/** * Find the index of a header with the given name. */ public int indexOf(final Header header, final int fromIndex) { // We can use a hash - but it's not clear how much // benefit you can get - there is an overhead // and the number of headers is small (4-5 ?) // Another problem is that we'll pay the overhead // of constructing the hashtable // A custom search tree may be better final byte[] bytes = header.getLowerCaseBytes(); for (int i = fromIndex; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase(bytes)) { return i; } } return -1; }
/** * Finds and returns a header field with the given name. If no such * field exists, null is returned. If more than one such field is * in the header, an arbitrary one is returned. */ public DataChunk getValue(final Header header) { final byte[] bytes = header.getLowerCaseBytes(); for (int i = 0; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase(bytes)) { return headers[i].getValue(); } } return null; }
/** * Finds and returns a header field with the given name. If no such * field exists, null is returned. If more than one such field is * in the header, an arbitrary one is returned. */ public DataChunk getValue(final Header header) { final byte[] bytes = header.getLowerCaseBytes(); for (int i = 0; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase(bytes)) { return headers[i].getValue(); } } return null; }
/** * Finds and returns a header field with the given name. If no such * field exists, null is returned. If more than one such field is * in the header, an arbitrary one is returned. */ public DataChunk getValue(final Header header) { final byte[] bytes = header.getLowerCaseBytes(); for (int i = 0; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase(bytes)) { return headers[i].getValue(); } } return null; }
/** * Finds and returns a header field with the given name. If no such * field exists, null is returned. If more than one such field is * in the header, an arbitrary one is returned. */ public DataChunk getValue(final Header header) { final byte[] bytes = header.getLowerCaseBytes(); for (int i = 0; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase(bytes)) { return headers[i].getValue(); } } return null; }
/** * Finds and returns a header field with the given name. If no such * field exists, null is returned. If more than one such field is * in the header, an arbitrary one is returned. */ public DataChunk getValue(final Header header) { final byte[] bytes = header.getLowerCaseBytes(); for (int i = 0; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase(bytes)) { return headers[i].getValue(); } } return null; }
/** * Finds and returns a header field with the given name. If no such * field exists, null is returned. If more than one such field is * in the header, an arbitrary one is returned. */ public DataChunk getValue(final Header header) { final byte[] bytes = header.getLowerCaseBytes(); for (int i = 0; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase(bytes)) { return headers[i].getValue(); } } return null; }
/** * Finds and returns a header field with the given name. If no such * field exists, null is returned. If more than one such field is * in the header, an arbitrary one is returned. */ public DataChunk getValue(final Header header) { final byte[] bytes = header.getLowerCaseBytes(); for (int i = 0; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase(bytes)) { return headers[i].getValue(); } } return null; }
/** * Finds and returns a header field with the given name. If no such * field exists, null is returned. If more than one such field is * in the header, an arbitrary one is returned. */ public DataChunk getValue(final Header header) { final byte[] bytes = header.getLowerCaseBytes(); for (int i = 0; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase(bytes)) { return headers[i].getValue(); } } return null; }
/** * Finds and returns a header field with the given name. If no such * field exists, null is returned. If more than one such field is * in the header, an arbitrary one is returned. */ public DataChunk getValue(final Header header) { final byte[] bytes = header.getLowerCaseBytes(); for (int i = 0; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase(bytes)) { return headers[i].getValue(); } } return null; }
/** * Finds and returns a header field with the given name. If no such * field exists, null is returned. If more than one such field is * in the header, an arbitrary one is returned. */ public DataChunk getValue(final Header header) { final byte[] bytes = header.getLowerCaseBytes(); for (int i = 0; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase(bytes)) { return headers[i].getValue(); } } return null; }
/** * Removes the headers with the given name whose values contain the * given string. * * @param header The name of the {@link Header}s to be removed * @param regex The regex string to check the header values against */ public void removeHeaderMatches(final Header header, final String regex) { for (int i = 0; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase( header.getLowerCaseBytes()) && getValue(i) != null && getValue(i).toString() != null && getValue(i).toString().matches(regex)) { removeHeader(i--); } } }
/** * Removes the headers with the given name whose values contain the * given string. * * @param header The name of the {@link Header}s to be removed * @param regex The regex string to check the header values against */ public void removeHeaderMatches(final Header header, final String regex) { for (int i = 0; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase( header.getLowerCaseBytes()) && getValue(i) != null && getValue(i).toString() != null && getValue(i).toString().matches(regex)) { removeHeader(i--); } } }
/** * Removes the headers with the given name whose values contain the * given string. * * @param header The name of the {@link Header}s to be removed * @param regex The regex string to check the header values against */ public void removeHeaderMatches(final Header header, final String regex) { for (int i = 0; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase( header.getLowerCaseBytes()) && getValue(i) != null && getValue(i).toString() != null && getValue(i).toString().matches(regex)) { removeHeader(i--); } } }
/** * Removes the headers with the given name whose values contain the * given string. * * @param header The name of the {@link Header}s to be removed * @param regex The regex string to check the header values against */ public void removeHeaderMatches(final Header header, final String regex) { for (int i = 0; i < count; i++) { if (headers[i].getName().equalsIgnoreCaseLowerCase( header.getLowerCaseBytes()) && getValue(i) != null && getValue(i).toString() != null && getValue(i).toString().matches(regex)) { removeHeader(i--); } } }