org.simpleframework.http.Response.getByteChannel()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(118)

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

Response.getByteChannel介绍

[英]Used to write a message body with the Response. The semantics of this WritableByteChannel are determined by the HTTP version of the client, and whether or not the content length has been set, through the setContentLength method. If the length of the output is not known then the output is chunked for HTTP/1.1 clients and closed for HTTP/1.0 clients.
[中]用于编写带有[$0$]的消息正文。此WritableByteChannel的语义由客户端的HTTP版本决定,以及是否通过setContentLength方法设置了内容长度。如果输出的长度未知,则HTTP/1.1客户端的输出将分块,HTTP/1.0客户端的输出将关闭。

代码示例

代码示例来源:origin: org.restlet/org.restlet.ext.simple

/**
 * Returns the response channel if it exists.
 * 
 * @return The response channel if it exists.
 */
@Override
public WritableByteChannel getResponseEntityChannel() {
  try {
    return this.response.getByteChannel();
  } catch (Exception ex) {
    return null;
  }
}

代码示例来源:origin: ngallagher/simpleframework

/**
* Used to write a message body with the <code>Response</code>. The 
* semantics of this <code>WritableByteChannel</code> are determined 
* by the HTTP version of the client, and whether or not the content
* length has been set, through the <code>setContentLength</code>
* method. If the length of the output is not known then the output
* is chunked for HTTP/1.1 clients and closed for HTTP/1.0 clients.
* 
* @return a writable byte channel used to write the message body
*/ 
public WritableByteChannel getByteChannel() throws IOException {
 return response.getByteChannel();
}

代码示例来源:origin: org.simpleframework/simple

/**
* Used to write a message body with the <code>Response</code>. The 
* semantics of this <code>WritableByteChannel</code> are determined 
* by the HTTP version of the client, and whether or not the content
* length has been set, through the <code>setContentLength</code>
* method. If the length of the output is not known then the output
* is chunked for HTTP/1.1 clients and closed for HTTP/1.0 clients.
* 
* @return a writable byte channel used to write the message body
*/ 
public WritableByteChannel getByteChannel() throws IOException {
 return response.getByteChannel();
}

代码示例来源:origin: org.simpleframework/simple-http

/**
* Used to write a message body with the <code>Response</code>. The 
* semantics of this <code>WritableByteChannel</code> are determined 
* by the HTTP version of the client, and whether or not the content
* length has been set, through the <code>setContentLength</code>
* method. If the length of the output is not known then the output
* is chunked for HTTP/1.1 clients and closed for HTTP/1.0 clients.
* 
* @return a writable byte channel used to write the message body
*/ 
public WritableByteChannel getByteChannel() throws IOException {
 return response.getByteChannel();
}

代码示例来源:origin: org.simpleframework/simple

/**
* Used to write a message body with the <code>Response</code>. The 
* semantics of this <code>WritableByteChannel</code> are determined 
* by the HTTP version of the client, and whether or not the content
* length has been set, through the <code>setContentLength</code>
* method. If the length of the output is not known then the output
* is chunked for HTTP/1.1 clients and closed for HTTP/1.0 clients.
* <p>
* This will ensure that there is buffering done so that the output
* can be reset using the <code>reset</code> method. This will 
* enable the specified number of bytes to be written without
* committing the response. This specified size is the minimum size
* that the response buffer must be. 
* 
* @param size the minimum size that the response buffer must be
* 
* @return a writable byte channel used to write the message body
*/ 
public WritableByteChannel getByteChannel(int size) throws IOException {
 return response.getByteChannel(size);
}

代码示例来源:origin: org.simpleframework/simple-http

/**
* Used to write a message body with the <code>Response</code>. The 
* semantics of this <code>WritableByteChannel</code> are determined 
* by the HTTP version of the client, and whether or not the content
* length has been set, through the <code>setContentLength</code>
* method. If the length of the output is not known then the output
* is chunked for HTTP/1.1 clients and closed for HTTP/1.0 clients.
* <p>
* This will ensure that there is buffering done so that the output
* can be reset using the <code>reset</code> method. This will 
* enable the specified number of bytes to be written without
* committing the response. This specified size is the minimum size
* that the response buffer must be. 
* 
* @param size the minimum size that the response buffer must be
* 
* @return a writable byte channel used to write the message body
*/ 
public WritableByteChannel getByteChannel(int size) throws IOException {
 return response.getByteChannel(size);
}

代码示例来源:origin: ngallagher/simpleframework

/**
* Used to write a message body with the <code>Response</code>. The 
* semantics of this <code>WritableByteChannel</code> are determined 
* by the HTTP version of the client, and whether or not the content
* length has been set, through the <code>setContentLength</code>
* method. If the length of the output is not known then the output
* is chunked for HTTP/1.1 clients and closed for HTTP/1.0 clients.
* <p>
* This will ensure that there is buffering done so that the output
* can be reset using the <code>reset</code> method. This will 
* enable the specified number of bytes to be written without
* committing the response. This specified size is the minimum size
* that the response buffer must be. 
* 
* @param size the minimum size that the response buffer must be
* 
* @return a writable byte channel used to write the message body
*/ 
public WritableByteChannel getByteChannel(int size) throws IOException {
 return response.getByteChannel(size);
}

代码示例来源:origin: opendedup/sdfs

response.setDate("Last-Modified", time);
  response.setContentLength(data.length);
  response.getByteChannel().write(ByteBuffer.wrap(data));
  response.getByteChannel().close();
} else if (request.getTarget().startsWith(BATCH_BLOCK_PATH)) {
  byte[] rb = com.google.common.io.BaseEncoding.base64Url().decode(request.getParameter("data"));
  response.setDate("Last-Modified", time);
  response.setContentLength(rslt.length);
  response.getByteChannel().write(ByteBuffer.wrap(rslt));
  response.getByteChannel().close();
} else if (request.getTarget().startsWith(BATCH_BLOCK_POINTER)) {
  byte[] rb = com.google.common.io.BaseEncoding.base64Url().decode(request.getParameter("data"));
  response.setDate("Last-Modified", time);
  response.setContentLength(rslt.length);
  response.getByteChannel().write(ByteBuffer.wrap(rslt));
  response.getByteChannel().close();
} else {

相关文章