类java.nio.channels.InterruptibleChannel源码实例Demo

下面列出了怎么用java.nio.channels.InterruptibleChannel的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: DataHubSystem   文件: InterruptibleHttpClient.java
/**
 * Gets the given URL, writes the content into the given channel.
 *
 * @param <IWC> a generic type for any classe that implements
 *              InterruptibleChannel and WritableByteChannel.
 * @param url to get.
 * @param output written with the content of the HTTP response.
 *
 * @return a response (contains the HTTP Headers, the status code, ...).
 *
 * @throws IOException IO error.
 * @throws InterruptedException interrupted.
 * @throws RuntimeException containing the actual exception if it is not an
 *                          instance of IOException.
 */
public <IWC extends InterruptibleChannel & WritableByteChannel>
      HttpResponse interruptibleGet(String url, final IWC output)
      throws IOException, InterruptedException
{
   return interruptibleRequest(new HttpGet(url), output);
}
 
源代码2 项目: DataHubSystem   文件: InterruptibleHttpClient.java
/**
 * Deletes the given URL, writes the content into the given channel.
 *
 * @param <IWC> a generic type for any classe that implements
 *              InterruptibleChannel and WritableByteChannel.
 * @param url to delete.
 * @param output written with the content of the HTTP response.
 *
 * @return a response (contains the HTTP Headers, the status code, ...).
 *
 * @throws IOException IO error.
 * @throws InterruptedException interrupted.
 * @throws RuntimeException containing the actual exception if it is not an
 *                          instance of IOException.
 */
public <IWC extends InterruptibleChannel & WritableByteChannel>
      HttpResponse interruptibleDelete(String url, final IWC output)
      throws IOException, InterruptedException
{
   return interruptibleRequest(new HttpDelete(url), output);
}