本文整理了Java中org.glassfish.grizzly.Buffer.toStringContent()
方法的一些代码示例,展示了Buffer.toStringContent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.toStringContent()
方法的具体详情如下:
包路径:org.glassfish.grizzly.Buffer
类名称:Buffer
方法名:toStringContent
[英]Returns Buffer content as String, using default Charset
[中]使用默认字符集以字符串形式返回缓冲区内容
代码示例来源:origin: com.ning/async-http-client
@Override
public String getResponseBody(String charset) throws IOException {
return responseBody.toStringContent(getCharset(charset));
}
代码示例来源:origin: com.ning/async-http-client
@Override
public String getResponseBodyExcerpt(int maxLength, String charset) throws IOException {
final int len = Math.min(responseBody.remaining(), maxLength);
final int pos = responseBody.position();
return responseBody.toStringContent(getCharset(charset), pos, len + pos);
}
代码示例来源:origin: javaee/grizzly
@Override
public String toString(final int start, final int end) {
return buffer.toStringContent(DEFAULT_CHARSET, this.start + start,
this.start + end);
}
代码示例来源:origin: javaee/grizzly
@Override
public String toString(final int start, final int end) {
return buffer.toStringContent(DEFAULT_CHARSET, this.start + start,
this.start + end);
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http
@Override
public String toString(final int start, final int end) {
return buffer.toStringContent(DEFAULT_CHARSET, this.start + start,
this.start + end);
}
代码示例来源:origin: javaee/grizzly
@Override
public String toString(final int start, final int end) {
return buffer.toStringContent(DEFAULT_CHARSET, this.start + start,
this.start + end);
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http
public String toString(Charset charset) {
if (charset == null) charset = DEFAULT_CHARSET;
if (cachedString != null && charset.equals(cachedStringCharset)) {
return cachedString;
}
cachedString = buffer.toStringContent(charset, start, end);
cachedStringCharset = charset;
return cachedString;
}
代码示例来源:origin: javaee/grizzly
public String toString(Charset charset) {
if (charset == null) charset = DEFAULT_CHARSET;
if (cachedString != null && charset.equals(cachedStringCharset)) {
return cachedString;
}
cachedString = buffer.toStringContent(charset, start, end);
cachedStringCharset = charset;
return cachedString;
}
代码示例来源:origin: javaee/grizzly
public String toString(Charset charset) {
if (charset == null) charset = DEFAULT_CHARSET;
if (cachedString != null && charset.equals(cachedStringCharset)) {
return cachedString;
}
cachedString = buffer.toStringContent(charset, start, end);
cachedStringCharset = charset;
return cachedString;
}
代码示例来源:origin: javaee/grizzly
public String toString(Charset charset) {
if (charset == null) charset = DEFAULT_CHARSET;
if (cachedString != null && charset.equals(cachedStringCharset)) {
return cachedString;
}
cachedString = buffer.toStringContent(charset, start, end);
cachedStringCharset = charset;
return cachedString;
}
代码示例来源:origin: javaee/grizzly
public String toString(Charset charset) {
if (charset == null) charset = DEFAULT_CHARSET;
if (cachedString != null && charset.equals(cachedStringCharset)) {
return cachedString;
}
cachedString = buffer.toStringContent(charset, start, end);
cachedStringCharset = charset;
return cachedString;
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server
public String toString(Charset charset) {
if (charset == null) charset = DEFAULT_CHARSET;
if (cachedString != null && charset.equals(cachedStringCharset)) {
return cachedString;
}
cachedString = buffer.toStringContent(charset, start, end);
cachedStringCharset = charset;
return cachedString;
}
代码示例来源:origin: org.mule.modules/mule-module-http
private void logBuffer(Buffer buffer)
{
if (logger.isDebugEnabled())
{
logger.debug(loggerType.name() + "\n" + buffer.toStringContent());
}
}
代码示例来源:origin: javaee/grizzly
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
if (len > 0) {
final Buffer buffer = parentInputStream.getBuffer();
final int start = buffer.position() + offset;
sb.append(buffer.toStringContent(null, start, start + len));
}
return sb.toString();
}
}
代码示例来源:origin: javaee/grizzly
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
if (len > 0) {
final Buffer buffer = parentInputStream.getBuffer();
final int start = buffer.position() + offset;
sb.append(buffer.toStringContent(null, start, start + len));
}
return sb.toString();
}
}
代码示例来源:origin: javaee/grizzly
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
if (len > 0) {
final Buffer buffer = parentInputStream.getBuffer();
final int start = buffer.position() + offset;
sb.append(buffer.toStringContent(null, start, start + len));
}
return sb.toString();
}
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
if (len > 0) {
final Buffer buffer = parentInputStream.getBuffer();
final int start = buffer.position() + offset;
sb.append(buffer.toStringContent(null, start, start + len));
}
return sb.toString();
}
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-multipart
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
if (len > 0) {
final Buffer buffer = parentInputStream.getBuffer();
final int start = buffer.position() + offset;
sb.append(buffer.toStringContent(null, start, start + len));
}
return sb.toString();
}
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-client
@Override
public String getResponseBodyExcerpt(int maxLength, String charset) throws IOException {
final int len = Math.min(responseBody.remaining(), maxLength);
final int pos = responseBody.position();
return responseBody.toStringContent(getCharset(charset), pos, len + pos);
}
代码示例来源:origin: javaee/grizzly
@Test
public void testEmptyBufferPrepend() {
Buffer buffer1 = Buffers.wrap(mm, "1234");
buffer1.position(3);
Buffer buffer2 = mm.allocate(0);
CompositeBuffer compositeBuffer = createCompositeBuffer(buffer1);
assertEquals('4', (char) compositeBuffer.get(0));
Buffer resultBuffer = Buffers.appendBuffers(mm, buffer2, compositeBuffer);
assertEquals(resultBuffer.toStringContent(), "4");
}
内容来源于网络,如有侵权,请联系作者删除!