Skip to content

Commit 671e63b

Browse files
committed
Inline single use local variable
Reduce vertical whitespace
1 parent 8d874ab commit 671e63b

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/main/java/org/apache/commons/io/build/AbstractOrigin.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,7 @@ public byte[] getByteArray() {
440440
protected Channel getChannel(final OpenOption... options) throws IOException {
441441
for (final OpenOption option : options) {
442442
if (option == StandardOpenOption.WRITE) {
443-
throw new UnsupportedOperationException(
444-
"Only READ is supported for byte[] origins: " + Arrays.toString(options));
443+
throw new UnsupportedOperationException("Only READ is supported for byte[] origins: " + Arrays.toString(options));
445444
}
446445
}
447446
return ByteArraySeekableByteChannel.wrap(getByteArray());
@@ -524,10 +523,7 @@ public Reader getReader(final Charset charset) throws IOException {
524523

525524
@Override
526525
public Writer getWriter(final Charset charset, final OpenOption... options) throws IOException {
527-
return Channels.newWriter(
528-
getChannel(WritableByteChannel.class, options),
529-
Charsets.toCharset(charset).newEncoder(),
530-
-1);
526+
return Channels.newWriter(getChannel(WritableByteChannel.class, options), Charsets.toCharset(charset).newEncoder(), -1);
531527
}
532528

533529
@Override
@@ -563,8 +559,7 @@ public byte[] getByteArray() {
563559
protected Channel getChannel(final OpenOption... options) throws IOException {
564560
for (final OpenOption option : options) {
565561
if (option == StandardOpenOption.WRITE) {
566-
throw new UnsupportedOperationException(
567-
"Only READ is supported for CharSequence origins: " + Arrays.toString(options));
562+
throw new UnsupportedOperationException("Only READ is supported for CharSequence origins: " + Arrays.toString(options));
568563
}
569564
}
570565
return ByteArraySeekableByteChannel.wrap(getByteArray());
@@ -713,8 +708,7 @@ public Reader getReader(final Charset charset) throws IOException {
713708
@Override
714709
public long size() throws IOException {
715710
if (origin instanceof FileInputStream) {
716-
final FileInputStream fileInputStream = (FileInputStream) origin;
717-
return fileInputStream.getChannel().size();
711+
return ((FileInputStream) origin).getChannel().size();
718712
}
719713
throw unsupportedOperation("size");
720714
}

0 commit comments

Comments
 (0)