java.nio.channels.InterruptibleChannel Java Examples

The following examples show how to use java.nio.channels.InterruptibleChannel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InterruptibleHttpClient.java    From DataHubSystem with GNU Affero General Public License v3.0 3 votes vote down vote up
/**
 * 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);
}
 
Example #2
Source File: InterruptibleHttpClient.java    From DataHubSystem with GNU Affero General Public License v3.0 3 votes vote down vote up
/**
 * 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);
}