org.glassfish.grizzly.http.util.Header.getLowerCaseBytes()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中org.glassfish.grizzly.http.util.Header.getLowerCaseBytes()方法的一些代码示例,展示了Header.getLowerCaseBytes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Header.getLowerCaseBytes()方法的具体详情如下:
包路径:org.glassfish.grizzly.http.util.Header
类名称:Header
方法名:getLowerCaseBytes

Header.getLowerCaseBytes介绍

[英]Returns the lower-case byte representation of this header encoded using ISO-8859-1.
[中]返回使用ISO-8859-1编码的此标头的小写字节表示形式。

代码示例

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

/**
 * 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;
}

代码示例来源:origin: javaee/grizzly

/**
 * 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;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http

/**
 * 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;
}

代码示例来源:origin: javaee/grizzly

/**
 * 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;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core

/**
 * 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;
}

代码示例来源:origin: javaee/grizzly

/**
 * 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;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http

/**
 * 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;
}

代码示例来源:origin: javaee/grizzly

/**
 * 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;
}

代码示例来源:origin: javaee/grizzly

/**
 * 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;
}

代码示例来源:origin: javaee/grizzly

/**
 * 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;
}

代码示例来源:origin: javaee/grizzly

/**
 * 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;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

/**
 * 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;
}

代码示例来源:origin: javaee/grizzly

/**
 * 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;
}

代码示例来源:origin: javaee/grizzly

/**
 * 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;
}

代码示例来源:origin: javaee/grizzly

/**
 * 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;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core

/**
 * 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;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http

/**
 * 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--);
    }
  }
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

/**
 * 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--);
    }
  }
}

代码示例来源:origin: javaee/grizzly

/**
 * 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--);
    }
  }
}

代码示例来源:origin: javaee/grizzly

/**
 * 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--);
    }
  }
}

相关文章