本文整理了Java中org.glassfish.grizzly.http.util.Header.toByteArray()
方法的一些代码示例,展示了Header.toByteArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Header.toByteArray()
方法的具体详情如下:
包路径:org.glassfish.grizzly.http.util.Header
类名称:Header
方法名:toByteArray
[英]Returns the US-ASCII encoded byte representation of this Header
.
[中]返回此Header
的US-ASCII编码字节表示形式。
代码示例来源:origin: javaee/grizzly
/** Create a new named header , return the MessageBytes
container for the new value
*/
public DataChunk addValue(final Header header) {
if (!isValidName(header)) {
return NOOP_CHUNK;
}
MimeHeaderField mh = createHeader();
mh.getName().setBytes(header.toByteArray());
return mh.getValue();
}
代码示例来源:origin: javaee/grizzly
/** Create a new named header , return the MessageBytes
container for the new value
*/
public DataChunk addValue(final Header header) {
if (!isValidName(header)) {
return NOOP_CHUNK;
}
MimeHeaderField mh = createHeader();
mh.getName().setBytes(header.toByteArray());
return mh.getValue();
}
代码示例来源:origin: javaee/grizzly
/** Create a new named header , return the MessageBytes
container for the new value
*/
public DataChunk addValue(final Header header) {
if (!isValidName(header)) {
return NOOP_CHUNK;
}
MimeHeaderField mh = createHeader();
mh.getName().setBytes(header.toByteArray());
return mh.getValue();
}
代码示例来源:origin: javaee/grizzly
/** Create a new named header , return the MessageBytes
container for the new value
*/
public DataChunk addValue(final Header header) {
if (!isValidName(header)) {
return NOOP_CHUNK;
}
MimeHeaderField mh = createHeader();
mh.getName().setBytes(header.toByteArray());
return mh.getValue();
}
代码示例来源:origin: javaee/grizzly
/** Create a new named header , return the MessageBytes
container for the new value
*/
public DataChunk addValue(final Header header) {
if (!isValidName(header)) {
return NOOP_CHUNK;
}
MimeHeaderField mh = createHeader();
mh.getName().setBytes(header.toByteArray());
return mh.getValue();
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http
/** Create a new named header , return the MessageBytes
container for the new value
*/
public DataChunk addValue(final Header header) {
if (!isValidName(header)) {
return NOOP_CHUNK;
}
MimeHeaderField mh = createHeader();
mh.getName().setBytes(header.toByteArray());
return mh.getValue();
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server
/** Create a new named header , return the MessageBytes
container for the new value
*/
public DataChunk addValue(final Header header) {
if (!isValidName(header)) {
return NOOP_CHUNK;
}
MimeHeaderField mh = createHeader();
mh.getName().setBytes(header.toByteArray());
return mh.getValue();
}
代码示例来源:origin: javaee/grizzly
/** Create a new named header , return the MessageBytes
container for the new value
*/
public DataChunk addValue(final Header header) {
if (!isValidName(header)) {
return NOOP_CHUNK;
}
MimeHeaderField mh = createHeader();
mh.getName().setBytes(header.toByteArray());
return mh.getValue();
}
代码示例来源:origin: javaee/grizzly
/** Create a new named header , return the MessageBytes
container for the new value
*/
public DataChunk addValue(final Header header) {
if (!isValidName(header)) {
return NOOP_CHUNK;
}
MimeHeaderField mh = createHeader();
mh.getName().setBytes(header.toByteArray());
return mh.getValue();
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core
/** Create a new named header , return the MessageBytes
container for the new value
*/
public DataChunk addValue(final Header header) {
if (!isValidName(header)) {
return NOOP_CHUNK;
}
MimeHeaderField mh = createHeader();
mh.getName().setBytes(header.toByteArray());
return mh.getValue();
}
代码示例来源:origin: javaee/grizzly
private static Buffer encodeContentEncodingHeader(final MemoryManager memoryManager,
Buffer buffer, final HttpHeader httpHeader,
final CacheableDataChunk name, final CacheableDataChunk value) {
final List<ContentEncoding> packetContentEncodings =
httpHeader.getContentEncodings(true);
name.setBytes(Header.ContentEncoding.toByteArray());
value.reset();
httpHeader.extractContentEncoding(value);
boolean needComma = !value.isNull();
final byte[] tempBuffer = httpHeader.getTempHeaderEncodingBuffer();
buffer = encodeMimeHeader(memoryManager, buffer, name, value, tempBuffer, false);
for (ContentEncoding encoding : packetContentEncodings) {
if (needComma) {
buffer = put(memoryManager, buffer, Constants.COMMA);
}
buffer = put(memoryManager, buffer, tempBuffer, encoding.getName());
needComma = true;
}
buffer = put(memoryManager, buffer, CRLF_BYTES);
return buffer;
}
代码示例来源:origin: javaee/grizzly
private static Buffer encodeContentEncodingHeader(final MemoryManager memoryManager,
Buffer buffer, final HttpHeader httpHeader,
final CacheableDataChunk name, final CacheableDataChunk value) {
final List<ContentEncoding> packetContentEncodings =
httpHeader.getContentEncodings(true);
name.setBytes(Header.ContentEncoding.toByteArray());
value.reset();
httpHeader.extractContentEncoding(value);
boolean needComma = !value.isNull();
final byte[] tempBuffer = httpHeader.getTempHeaderEncodingBuffer();
buffer = encodeMimeHeader(memoryManager, buffer, name, value, tempBuffer, false);
for (ContentEncoding encoding : packetContentEncodings) {
if (needComma) {
buffer = put(memoryManager, buffer, Constants.COMMA);
}
buffer = put(memoryManager, buffer, tempBuffer, encoding.getName());
needComma = true;
}
buffer = put(memoryManager, buffer, CRLF_BYTES);
return buffer;
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core
private static Buffer encodeContentEncodingHeader(final MemoryManager memoryManager,
Buffer buffer, final HttpHeader httpHeader,
final CacheableDataChunk name, final CacheableDataChunk value) {
final List<ContentEncoding> packetContentEncodings =
httpHeader.getContentEncodings(true);
name.setBytes(Header.ContentEncoding.toByteArray());
value.reset();
httpHeader.extractContentEncoding(value);
boolean needComma = !value.isNull();
final byte[] tempBuffer = httpHeader.getTempHeaderEncodingBuffer();
buffer = encodeMimeHeader(memoryManager, buffer, name, value, tempBuffer, false);
for (ContentEncoding encoding : packetContentEncodings) {
if (needComma) {
buffer = put(memoryManager, buffer, Constants.COMMA);
}
buffer = put(memoryManager, buffer, tempBuffer, encoding.getName());
needComma = true;
}
buffer = put(memoryManager, buffer, CRLF_BYTES);
return buffer;
}
代码示例来源:origin: javaee/grizzly
private static Buffer encodeContentEncodingHeader(final MemoryManager memoryManager,
Buffer buffer, final HttpHeader httpHeader,
final CacheableDataChunk name, final CacheableDataChunk value) {
final List<ContentEncoding> packetContentEncodings =
httpHeader.getContentEncodings(true);
name.setBytes(Header.ContentEncoding.toByteArray());
value.reset();
httpHeader.extractContentEncoding(value);
boolean needComma = !value.isNull();
final byte[] tempBuffer = httpHeader.getTempHeaderEncodingBuffer();
buffer = encodeMimeHeader(memoryManager, buffer, name, value, tempBuffer, false);
for (ContentEncoding encoding : packetContentEncodings) {
if (needComma) {
buffer = put(memoryManager, buffer, Constants.COMMA);
}
buffer = put(memoryManager, buffer, tempBuffer, encoding.getName());
needComma = true;
}
buffer = put(memoryManager, buffer, CRLF_BYTES);
return buffer;
}
代码示例来源:origin: javaee/grizzly
private static Buffer encodeContentEncodingHeader(final MemoryManager memoryManager,
Buffer buffer, final HttpHeader httpHeader,
final CacheableDataChunk name, final CacheableDataChunk value) {
final List<ContentEncoding> packetContentEncodings =
httpHeader.getContentEncodings(true);
name.setBytes(Header.ContentEncoding.toByteArray());
value.reset();
httpHeader.extractContentEncoding(value);
boolean needComma = !value.isNull();
final byte[] tempBuffer = httpHeader.getTempHeaderEncodingBuffer();
buffer = encodeMimeHeader(memoryManager, buffer, name, value, tempBuffer, false);
for (ContentEncoding encoding : packetContentEncodings) {
if (needComma) {
buffer = put(memoryManager, buffer, Constants.COMMA);
}
buffer = put(memoryManager, buffer, tempBuffer, encoding.getName());
needComma = true;
}
buffer = put(memoryManager, buffer, CRLF_BYTES);
return buffer;
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http
private static Buffer encodeContentEncodingHeader(final MemoryManager memoryManager,
Buffer buffer, final HttpHeader httpHeader,
final CacheableDataChunk name, final CacheableDataChunk value) {
final List<ContentEncoding> packetContentEncodings =
httpHeader.getContentEncodings(true);
name.setBytes(Header.ContentEncoding.toByteArray());
value.reset();
httpHeader.extractContentEncoding(value);
boolean needComma = !value.isNull();
final byte[] tempBuffer = httpHeader.getTempHeaderEncodingBuffer();
buffer = encodeMimeHeader(memoryManager, buffer, name, value, tempBuffer, false);
for (ContentEncoding encoding : packetContentEncodings) {
if (needComma) {
buffer = put(memoryManager, buffer, Constants.COMMA);
}
buffer = put(memoryManager, buffer, tempBuffer, encoding.getName());
needComma = true;
}
buffer = put(memoryManager, buffer, CRLF_BYTES);
return buffer;
}
代码示例来源:origin: javaee/grizzly
private static Buffer encodeContentEncodingHeader(final MemoryManager memoryManager,
Buffer buffer, final HttpHeader httpHeader,
final CacheableDataChunk name, final CacheableDataChunk value) {
final List<ContentEncoding> packetContentEncodings =
httpHeader.getContentEncodings(true);
name.setBytes(Header.ContentEncoding.toByteArray());
value.reset();
httpHeader.extractContentEncoding(value);
boolean needComma = !value.isNull();
final byte[] tempBuffer = httpHeader.getTempHeaderEncodingBuffer();
buffer = encodeMimeHeader(memoryManager, buffer, name, value, tempBuffer, false);
for (ContentEncoding encoding : packetContentEncodings) {
if (needComma) {
buffer = put(memoryManager, buffer, Constants.COMMA);
}
buffer = put(memoryManager, buffer, tempBuffer, encoding.getName());
needComma = true;
}
buffer = put(memoryManager, buffer, CRLF_BYTES);
return buffer;
}
代码示例来源:origin: javaee/grizzly
private static Buffer encodeContentEncodingHeader(final MemoryManager memoryManager,
Buffer buffer, final HttpHeader httpHeader,
final CacheableDataChunk name, final CacheableDataChunk value) {
final List<ContentEncoding> packetContentEncodings =
httpHeader.getContentEncodings(true);
name.setBytes(Header.ContentEncoding.toByteArray());
value.reset();
httpHeader.extractContentEncoding(value);
boolean needComma = !value.isNull();
final byte[] tempBuffer = httpHeader.getTempHeaderEncodingBuffer();
buffer = encodeMimeHeader(memoryManager, buffer, name, value, tempBuffer, false);
for (ContentEncoding encoding : packetContentEncodings) {
if (needComma) {
buffer = put(memoryManager, buffer, Constants.COMMA);
}
buffer = put(memoryManager, buffer, tempBuffer, encoding.getName());
needComma = true;
}
buffer = put(memoryManager, buffer, CRLF_BYTES);
return buffer;
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http
/**
* Allow "set" operations -
* return a DataChunk container for the
* header value ( existing header or new
* if this .
*/
public DataChunk setValue(final Header header) {
if (!isValidName(header)) {
return NOOP_CHUNK;
}
final byte[] bytes = header.getLowerCaseBytes();
for (int i = 0; i < count; i++) {
if (headers[i].getName().equalsIgnoreCaseLowerCase(bytes)) {
for (int j = i + 1; j < count; j++) {
if (headers[j].getName().equalsIgnoreCaseLowerCase(bytes)) {
removeHeader(j--);
}
}
return headers[i].getValue();
}
}
MimeHeaderField mh = createHeader();
mh.getName().setBytes(header.toByteArray());
return mh.getValue();
}
代码示例来源:origin: javaee/grizzly
/**
* Allow "set" operations -
* return a DataChunk container for the
* header value ( existing header or new
* if this .
*/
public DataChunk setValue(final Header header) {
if (!isValidName(header)) {
return NOOP_CHUNK;
}
final byte[] bytes = header.getLowerCaseBytes();
for (int i = 0; i < count; i++) {
if (headers[i].getName().equalsIgnoreCaseLowerCase(bytes)) {
for (int j = i + 1; j < count; j++) {
if (headers[j].getName().equalsIgnoreCaseLowerCase(bytes)) {
removeHeader(j--);
}
}
return headers[i].getValue();
}
}
MimeHeaderField mh = createHeader();
mh.getName().setBytes(header.toByteArray());
return mh.getValue();
}
内容来源于网络,如有侵权,请联系作者删除!