本文整理了Java中org.glassfish.grizzly.http.util.Ascii
类的一些代码示例,展示了Ascii
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ascii
类的具体详情如下:
包路径:org.glassfish.grizzly.http.util.Ascii
类名称:Ascii
[英]This class implements some basic ASCII character handling functions.
[中]此类实现了一些基本的ASCII字符处理函数。
代码示例来源:origin: javaee/grizzly
private static int hashBytesIC(byte[] bytes, int start, int bytesLen ) {
int max=start+bytesLen;
int code=0;
for (int i = start; i < max ; i++) {
code = code * 31 + Ascii.toLower(bytes[i]);
}
return code;
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http
public long getLong() {
return Ascii.parseLong(buff, start,end-start);
}
代码示例来源:origin: javaee/grizzly
public static void intToHexString(Buffer buffer, int i) {
intToUnsignedString(buffer, i, 4);
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server
public static long parseLong(final DataChunk dataChunk, final int offset,
final int length) {
switch(dataChunk.getType()) {
case Buffer:
final BufferChunk bc = dataChunk.getBufferChunk();
return parseLong(bc.getBuffer(),
bc.getStart() + offset,
length);
case String:
return parseLong(dataChunk.toString(), offset, length);
case Chars:
final CharChunk cc = dataChunk.getCharChunk();
return parseLong(cc.getBuffer(),
cc.getStart() + offset,
cc.getLength());
default: throw new NullPointerException();
}
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server
public boolean equalsIgnoreCase(final byte[] b, final int offset, final int len) {
if (getLength() != len) {
return false;
}
int offs1 = start;
int offs2 = offset;
for (int i = 0; i < len; i++) {
if (Ascii.toLower(buffer.get(offs1++)) != Ascii.toLower(b[offs2++])) {
return false;
}
}
return true;
}
代码示例来源:origin: javaee/grizzly
private int findEndOfHeaderName(final Buffer buffer, int position,
final int limit) {
while (position < limit) {
final byte b = buffer.get(position);
if (b == ':') {
return position;
}
// lowercase the header name
buffer.put(position, (byte) Ascii.toLower(b));
position++;
}
return -1;
}
代码示例来源:origin: javaee/grizzly
public int getInt() {
return Ascii.parseInt(buff, start,end-start);
}
代码示例来源:origin: javaee/grizzly
public static int parseInt(char[] b, int off, int len)
throws NumberFormatException {
int c;
if (b == null || len <= 0 || !isDigit(c = b[off++])) {
throw new NumberFormatException();
}
int n = c - '0';
while (--len > 0) {
if (!isDigit(c = b[off++])) {
throw new NumberFormatException();
}
n = n * 10 + c - '0';
}
return n;
}
代码示例来源:origin: javaee/grizzly
public static long parseLong(final DataChunk dataChunk, final int offset,
final int length) {
switch(dataChunk.getType()) {
case Buffer:
final BufferChunk bc = dataChunk.getBufferChunk();
return parseLong(bc.getBuffer(),
bc.getStart() + offset,
length);
case String:
return parseLong(dataChunk.toString(), offset, length);
case Chars:
final CharChunk cc = dataChunk.getCharChunk();
return parseLong(cc.getBuffer(),
cc.getStart() + offset,
cc.getLength());
default: throw new NullPointerException();
}
}
代码示例来源:origin: javaee/grizzly
public boolean equalsIgnoreCase(final byte[] b, final int offset, final int len) {
if (getLength() != len) {
return false;
}
int offs1 = start;
int offs2 = offset;
for (int i = 0; i < len; i++) {
if (Ascii.toLower(buffer.get(offs1++)) != Ascii.toLower(b[offs2++])) {
return false;
}
}
return true;
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-multipart
private int findEndOfHeaderName(final Buffer buffer, int position,
final int limit) {
while (position < limit) {
final byte b = buffer.get(position);
if (b == ':') {
return position;
}
// lowercase the header name
buffer.put(position, (byte) Ascii.toLower(b));
position++;
}
return -1;
}
代码示例来源:origin: javaee/grizzly
public int getInt() {
return Ascii.parseInt(buff, start,end-start);
}
代码示例来源:origin: javaee/grizzly
public static int parseInt(char[] b, int off, int len)
throws NumberFormatException {
int c;
if (b == null || len <= 0 || !isDigit(c = b[off++])) {
throw new NumberFormatException();
}
int n = c - '0';
while (--len > 0) {
if (!isDigit(c = b[off++])) {
throw new NumberFormatException();
}
n = n * 10 + c - '0';
}
return n;
}
代码示例来源:origin: javaee/grizzly
public static long parseLong(final DataChunk dataChunk, final int offset,
final int length) {
switch(dataChunk.getType()) {
case Buffer:
final BufferChunk bc = dataChunk.getBufferChunk();
return parseLong(bc.getBuffer(),
bc.getStart() + offset,
length);
case String:
return parseLong(dataChunk.toString(), offset, length);
case Chars:
final CharChunk cc = dataChunk.getCharChunk();
return parseLong(cc.getBuffer(),
cc.getStart() + offset,
cc.getLength());
default: throw new NullPointerException();
}
}
代码示例来源:origin: javaee/grizzly
public boolean equalsIgnoreCase(CharSequence s) {
if (getLength() != s.length()) {
return false;
}
for (int i = start; i < end; i++) {
if (Ascii.toLower(buffer.get(i)) != Ascii.toLower(s.charAt(i - start))) {
return false;
}
}
return true;
}
代码示例来源:origin: javaee/grizzly
private static int hashBytesIC(byte[] bytes, int start, int bytesLen ) {
int max=start+bytesLen;
int code=0;
for (int i = start; i < max ; i++) {
code = code * 31 + Ascii.toLower(bytes[i]);
}
return code;
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core
public int getInt() {
return Ascii.parseInt(buff, start,end-start);
}
代码示例来源:origin: javaee/grizzly
public static int parseInt(char[] b, int off, int len)
throws NumberFormatException {
int c;
if (b == null || len <= 0 || !isDigit(c = b[off++])) {
throw new NumberFormatException();
}
int n = c - '0';
while (--len > 0) {
if (!isDigit(c = b[off++])) {
throw new NumberFormatException();
}
n = n * 10 + c - '0';
}
return n;
}
代码示例来源:origin: javaee/grizzly
public long getLong() {
return Ascii.parseLong(buff, start,end-start);
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server
public static void intToHexString(Buffer buffer, int i) {
intToUnsignedString(buffer, i, 4);
}
内容来源于网络,如有侵权,请联系作者删除!