1717
1818package org .apache .commons .io .build ;
1919
20- import java .io .Closeable ;
2120import java .io .File ;
2221import java .io .IOException ;
2322import java .io .InputStream ;
@@ -124,15 +123,7 @@ public int getBufferSizeDefault() {
124123 }
125124
126125 /**
127- * Gets the origin as a {@link Channel} of the given type, if supported.
128- *
129- * <p>If the origin is not already open, it will be opened using the options provided by
130- * {@link #getOpenOptions()}.</p>
131- *
132- * <p>Calling this method transfers ownership of the underlying resource to the caller.
133- * The caller is responsible for closing the returned stream once it is no longer needed.
134- * If the origin itself implements {@link Closeable}, closing the returned stream will
135- * also close the underlying origin resource.</p>
126+ * Gets a Channel from the origin with OpenOption[].
136127 *
137128 * @param channelType The channel type, not null.
138129 * @return A channel of the specified type.
@@ -144,7 +135,6 @@ public int getBufferSizeDefault() {
144135 * @see #getOpenOptions()
145136 * @since 2.21.0
146137 */
147- @ SuppressWarnings ("resource" )
148138 public <C extends Channel > C getChannel (final Class <C > channelType ) throws IOException {
149139 return checkOrigin ().getChannel (channelType , getOpenOptions ());
150140 }
@@ -159,7 +149,6 @@ public <C extends Channel> C getChannel(final Class<C> channelType) throws IOExc
159149 * @see AbstractOrigin#getCharSequence(Charset)
160150 * @since 2.13.0
161151 */
162- @ SuppressWarnings ("resource" )
163152 public CharSequence getCharSequence () throws IOException {
164153 return checkOrigin ().getCharSequence (getCharset ());
165154 }
@@ -191,21 +180,12 @@ public Charset getCharsetDefault() {
191180 * @see AbstractOrigin#getPath()
192181 * @since 2.18.0
193182 */
194- @ SuppressWarnings ("resource" )
195183 public File getFile () {
196184 return checkOrigin ().getFile ();
197185 }
198186
199187 /**
200- * Gets the origin as an {@link InputStream}, if supported.
201- *
202- * <p>If the origin is not already open, it will be opened using the options provided by
203- * {@link #getOpenOptions()}.</p>
204- *
205- * <p>Calling this method transfers ownership of the underlying resource to the caller.
206- * The caller is responsible for closing the returned stream once it is no longer needed.
207- * If the origin itself implements {@link Closeable}, closing the returned stream will
208- * also close the underlying origin resource.</p>
188+ * Gets an InputStream from the origin with OpenOption[].
209189 *
210190 * @return An input stream
211191 * @throws IllegalStateException if the {@code origin} is {@code null}.
@@ -215,7 +195,6 @@ public File getFile() {
215195 * @see #getOpenOptions()
216196 * @since 2.13.0
217197 */
218- @ SuppressWarnings ("resource" )
219198 public InputStream getInputStream () throws IOException {
220199 return checkOrigin ().getInputStream (getOpenOptions ());
221200 }
@@ -230,15 +209,7 @@ public OpenOption[] getOpenOptions() {
230209 }
231210
232211 /**
233- * Gets the origin as an {@link OutputStream}, if supported.
234- *
235- * <p>If the origin is not already open, it will be opened using the options provided by
236- * {@link #getOpenOptions()}.</p>
237- *
238- * <p>Calling this method transfers ownership of the underlying resource to the caller.
239- * The caller is responsible for closing the returned stream once it is no longer needed.
240- * If the origin itself implements {@link Closeable}, closing the returned stream will
241- * also close the underlying origin resource.</p>
212+ * Gets an OutputStream from the origin with OpenOption[].
242213 *
243214 * @return An OutputStream
244215 * @throws IllegalStateException if the {@code origin} is {@code null}.
@@ -248,7 +219,6 @@ public OpenOption[] getOpenOptions() {
248219 * @see #getOpenOptions()
249220 * @since 2.13.0
250221 */
251- @ SuppressWarnings ("resource" )
252222 public OutputStream getOutputStream () throws IOException {
253223 return checkOrigin ().getOutputStream (getOpenOptions ());
254224 }
@@ -262,43 +232,25 @@ public OutputStream getOutputStream() throws IOException {
262232 * @see AbstractOrigin#getPath()
263233 * @since 2.13.0
264234 */
265- @ SuppressWarnings ("resource" )
266235 public Path getPath () {
267236 return checkOrigin ().getPath ();
268237 }
269238
270239 /**
271- * Gets the origin as an {@link OutputStream}, if supported.
272- *
273- * <p>If the origin is not already open, it will be opened using the options provided by
274- * {@link #getOpenOptions()}.</p>
275- *
276- * <p>Calling this method transfers ownership of the underlying resource to the caller.
277- * The caller is responsible for closing the returned stream once it is no longer needed.
278- * If the origin itself implements {@link Closeable}, closing the returned stream will
279- * also close the underlying origin resource.</p>
240+ * Gets a RandomAccessFile from the origin.
280241 *
281242 * @return A RandomAccessFile
282243 * @throws IllegalStateException if the {@code origin} is {@code null}.
283244 * @throws UnsupportedOperationException if the origin cannot be converted to a {@link RandomAccessFile}.
284245 * @throws IOException if an I/O error occurs.
285246 * @since 2.18.0
286247 */
287- @ SuppressWarnings ("resource" )
288248 public RandomAccessFile getRandomAccessFile () throws IOException {
289249 return checkOrigin ().getRandomAccessFile (getOpenOptions ());
290250 }
291251
292252 /**
293- * Gets the origin as an {@link OutputStream}, if supported.
294- *
295- * <p>If the origin is not already open, it will be opened using the options provided by
296- * {@link #getOpenOptions()}.</p>
297- *
298- * <p>Calling this method transfers ownership of the underlying resource to the caller.
299- * The caller is responsible for closing the returned stream once it is no longer needed.
300- * If the origin itself implements {@link Closeable}, closing the returned stream will
301- * also close the underlying origin resource.</p>
253+ * Gets a Reader from the origin with a Charset.
302254 *
303255 * @return A Reader
304256 * @throws IllegalStateException if the {@code origin} is {@code null}.
@@ -308,21 +260,12 @@ public RandomAccessFile getRandomAccessFile() throws IOException {
308260 * @see #getCharset()
309261 * @since 2.16.0
310262 */
311- @ SuppressWarnings ("resource" )
312263 public Reader getReader () throws IOException {
313264 return checkOrigin ().getReader (getCharset ());
314265 }
315266
316267 /**
317- * Gets the origin as an {@link OutputStream}, if supported.
318- *
319- * <p>If the origin is not already open, it will be opened using the options provided by
320- * {@link #getOpenOptions()}.</p>
321- *
322- * <p>Calling this method transfers ownership of the underlying resource to the caller.
323- * The caller is responsible for closing the returned stream once it is no longer needed.
324- * If the origin itself implements {@link Closeable}, closing the returned stream will
325- * also close the underlying origin resource.</p>
268+ * Gets a Writer from the origin with an OpenOption[].
326269 *
327270 * @return An writer.
328271 * @throws IllegalStateException if the {@code origin} is {@code null}.
@@ -332,7 +275,6 @@ public Reader getReader() throws IOException {
332275 * @see #getOpenOptions()
333276 * @since 2.13.0
334277 */
335- @ SuppressWarnings ("resource" )
336278 public Writer getWriter () throws IOException {
337279 return checkOrigin ().getWriter (getCharset (), getOpenOptions ());
338280 }
0 commit comments