Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -482,4 +482,17 @@ public long skip(final long amount) throws IOException {
return amount;
}

/**
* Unwraps this instance by returning the underlying {@link Reader}.
* <p>
* Use with caution.
* </p>
*
* @return the underlying {@link Reader}.
* @since 2.23.0
*/
public Reader unwrap() {
return in;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

Expand Down Expand Up @@ -633,4 +634,12 @@ void testSkipIllegal() throws IOException {
br = new UnsynchronizedBufferedReader(new StringReader(testString));
assertThrows(IllegalArgumentException.class, () -> br.skip(-1));
}

@SuppressWarnings("resource")
@Test
void testUnwrap() throws IOException {
final StringReader reader = new StringReader(testString);
br = new UnsynchronizedBufferedReader(reader);
assertSame(reader, br.unwrap());
}
}
Loading