|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2016 the original author or authors. |
|
|
|
|
* Copyright 2002-2017 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -109,19 +109,23 @@ public interface Resource extends InputStreamSource {
@@ -109,19 +109,23 @@ public interface Resource extends InputStreamSource {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Return a File handle for this resource. |
|
|
|
|
* @throws IOException if the resource cannot be resolved as absolute |
|
|
|
|
* file path, i.e. if the resource is not available in a file system |
|
|
|
|
* @throws java.io.FileNotFoundException if the resource cannot be resolved as |
|
|
|
|
* absolute file path, i.e. if the resource is not available in a file system |
|
|
|
|
* @throws IOException in case of general resolution/reading failures |
|
|
|
|
* @see #getInputStream() |
|
|
|
|
*/ |
|
|
|
|
File getFile() throws IOException; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Return a {@link ReadableByteChannel}. |
|
|
|
|
* <p>It is expected that each call creates a <i>fresh</i> channel. |
|
|
|
|
* <p>The default implementation returns {@link Channels#newChannel(InputStream)} with the |
|
|
|
|
* result of {@link #getInputStream()}. |
|
|
|
|
* <p>The default implementation returns {@link Channels#newChannel(InputStream)} |
|
|
|
|
* with the result of {@link #getInputStream()}. |
|
|
|
|
* @return the byte channel for the underlying resource (must not be {@code null}) |
|
|
|
|
* @throws IOException if the channel could not be opened |
|
|
|
|
* @throws java.io.FileNotFoundException if the underlying resource doesn't exist |
|
|
|
|
* @throws IOException if the content channel could not be opened |
|
|
|
|
* @since 5.0 |
|
|
|
|
* @see #getInputStream() |
|
|
|
|
*/ |
|
|
|
|
default ReadableByteChannel readableChannel() throws IOException { |
|
|
|
|
return Channels.newChannel(getInputStream()); |
|
|
|
|
|