Skip to content

Commit

Permalink
Removed unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed May 2, 2018
1 parent 86b98bc commit 5f23cdb
Showing 1 changed file with 3 additions and 45 deletions.
Expand Up @@ -25,8 +25,9 @@ public abstract class AbstractScannerTestCase

private static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");

public static final String ASSERT_ENCODER = "TEST";
{
static final String ASSERT_ENCODER = "TEST";

static {
Syntax.builtIns();
Encoder.Factory.registrer(ASSERT_ENCODER, AssertEncoder.class);
}
Expand Down Expand Up @@ -84,47 +85,4 @@ protected void assertMatchExample(Syntax.Builder builder, String type, String ex
}
Assert.assertEquals(expectedContent, result);
}

static byte[] asByteArray(final InputStream in) throws IllegalArgumentException
{
// Precondition check
if (in == null)
{
throw new IllegalArgumentException("stream must be specified");
}

// Get content as an array of bytes
final ByteArrayOutputStream out = new ByteArrayOutputStream(8192);
final int len = 4096;
final byte[] buffer = new byte[len];
int read = 0;
try
{
while (((read = in.read(buffer)) != -1))
{
out.write(buffer, 0, read);
}
}
catch (final IOException ioe)
{
throw new RuntimeException("Error in obtainting bytes from " + in, ioe);
}
finally
{
try
{
in.close();
}
catch (final IOException ignore)
{
}
// We don't need to close the outstream, it's a byte array out
}

// Represent as byte array
final byte[] content = out.toByteArray();

// Return
return content;
}
}

0 comments on commit 5f23cdb

Please sign in to comment.