@@ -131,7 +131,7 @@ void testBuilder() {
131131 * @throws Exception Usually signifies a bug in the Base58 commons-codec implementation.
132132 */
133133 private void testByChunk (final byte [] encoded , final byte [] decoded , final int chunkSize , final byte [] separator ) throws Exception {
134- try (InputStream in = Base58InputStream .builder ().setInputStream ( new ByteArrayInputStream ( decoded ) ).setEncode (true ).get ()) {
134+ try (InputStream in = Base58InputStream .builder ().setByteArray ( decoded ).setEncode (true ).get ()) {
135135 final byte [] output = BaseNTestData .streamToBytes (in );
136136 assertEquals (-1 , in .read (), "EOF" );
137137 assertEquals (-1 , in .read (), "Still EOF" );
@@ -169,7 +169,7 @@ private void testByChunk(final byte[] encoded, final byte[] decoded, final int c
169169 */
170170 private void testByteByByte (final byte [] encoded , final byte [] decoded , final int chunkSize , final byte [] separator ) throws Exception {
171171 InputStream in ;
172- in = Base58InputStream .builder ().setInputStream ( new ByteArrayInputStream ( decoded ) ).setEncode (true ).get ();
172+ in = Base58InputStream .builder ().setByteArray ( decoded ).setEncode (true ).get ();
173173 byte [] output = BaseNTestData .streamToBytes (in );
174174 assertEquals (-1 , in .read (), "EOF" );
175175 assertEquals (-1 , in .read (), "Still EOF" );
@@ -200,8 +200,7 @@ private void testByteByByte(final byte[] encoded, final byte[] decoded, final in
200200 @ Test
201201 void testMarkSupported () throws Exception {
202202 final byte [] decoded = StringUtils .getBytesUtf8 (STRING_FIXTURE );
203- final ByteArrayInputStream bin = new ByteArrayInputStream (decoded );
204- try (Base58InputStream in = Base58InputStream .builder ().setInputStream (bin ).setEncode (true ).get ()) {
203+ try (Base58InputStream in = Base58InputStream .builder ().setByteArray (decoded ).setEncode (true ).get ()) {
205204 // Always returns false for now.
206205 assertFalse (in .markSupported (), "Base58InputStream.markSupported() is false" );
207206 }
@@ -217,8 +216,7 @@ void testRead0() throws Exception {
217216 final byte [] decoded = StringUtils .getBytesUtf8 (STRING_FIXTURE );
218217 final byte [] buf = new byte [1024 ];
219218 int bytesRead = 0 ;
220- final ByteArrayInputStream bin = new ByteArrayInputStream (decoded );
221- try (Base58InputStream in = Base58InputStream .builder ().setInputStream (bin ).setEncode (true ).get ()) {
219+ try (Base58InputStream in = Base58InputStream .builder ().setByteArray (decoded ).setEncode (true ).get ()) {
222220 bytesRead = in .read (buf , 0 , 0 );
223221 assertEquals (0 , bytesRead , "Base58InputStream.read(buf, 0, 0) returns 0" );
224222 }
@@ -232,8 +230,7 @@ void testRead0() throws Exception {
232230 @ Test
233231 void testReadNull () throws Exception {
234232 final byte [] decoded = StringUtils .getBytesUtf8 (STRING_FIXTURE );
235- final ByteArrayInputStream bin = new ByteArrayInputStream (decoded );
236- try (Base58InputStream in = Base58InputStream .builder ().setInputStream (bin ).setEncode (true ).get ()) {
233+ try (Base58InputStream in = Base58InputStream .builder ().setByteArray (decoded ).setEncode (true ).get ()) {
237234 assertThrows (NullPointerException .class , () -> in .read (null , 0 , 0 ));
238235 }
239236 }
@@ -247,8 +244,7 @@ void testReadNull() throws Exception {
247244 void testReadOutOfBounds () throws Exception {
248245 final byte [] decoded = StringUtils .getBytesUtf8 (STRING_FIXTURE );
249246 final byte [] buf = new byte [1024 ];
250- final ByteArrayInputStream bin = new ByteArrayInputStream (decoded );
251- try (Base58InputStream in = Base58InputStream .builder ().setInputStream (bin ).setEncode (true ).get ()) {
247+ try (Base58InputStream in = Base58InputStream .builder ().setByteArray (decoded ).setEncode (true ).get ()) {
252248 assertThrows (IndexOutOfBoundsException .class , () -> in .read (buf , -1 , 0 ), "Base58InputStream.read(buf, -1, 0)" );
253249 assertThrows (IndexOutOfBoundsException .class , () -> in .read (buf , 0 , -1 ), "Base58InputStream.read(buf, 0, -1)" );
254250 assertThrows (IndexOutOfBoundsException .class , () -> in .read (buf , buf .length + 1 , 0 ), "Base58InputStream.read(buf, buf.length + 1, 0)" );
0 commit comments