diff --git a/mq/main/mqcomm-util/src/main/java/com/sun/messaging/jmq/util/CharacterDecoder.java b/mq/main/mqcomm-util/src/main/java/com/sun/messaging/jmq/util/CharacterDecoder.java index 30f672860..a369399d8 100644 --- a/mq/main/mqcomm-util/src/main/java/com/sun/messaging/jmq/util/CharacterDecoder.java +++ b/mq/main/mqcomm-util/src/main/java/com/sun/messaging/jmq/util/CharacterDecoder.java @@ -155,13 +155,4 @@ public byte decodeBuffer(String inputString)[] throws IOException { decodeBuffer(inStream, outStream); return (outStream.toByteArray()); } - - /** - * Decode the contents of the inputstream into a buffer. - */ - public byte decodeBuffer(InputStream in)[] throws IOException { - ByteArrayOutputStream outStream = new ByteArrayOutputStream(); - decodeBuffer(in, outStream); - return (outStream.toByteArray()); - } } diff --git a/mq/main/mqcomm-util/src/main/java/com/sun/messaging/jmq/util/CharacterEncoder.java b/mq/main/mqcomm-util/src/main/java/com/sun/messaging/jmq/util/CharacterEncoder.java index 1db665f3a..dabc8a8ff 100644 --- a/mq/main/mqcomm-util/src/main/java/com/sun/messaging/jmq/util/CharacterEncoder.java +++ b/mq/main/mqcomm-util/src/main/java/com/sun/messaging/jmq/util/CharacterEncoder.java @@ -205,20 +205,4 @@ public void encodeBuffer(byte aBuffer[], OutputStream aStream) throws IOExceptio encodeBuffer(inStream, aStream); } - /** - * A 'streamless' version of encode that simply takes a buffer of bytes and returns a string containing the encoded - * buffer. - */ - public String encodeBuffer(byte aBuffer[]) { - ByteArrayOutputStream outStream = new ByteArrayOutputStream(); - ByteArrayInputStream inStream = new ByteArrayInputStream(aBuffer); - try { - encodeBuffer(inStream, outStream); - } catch (Exception IOException) { - // This should never happen. - return null; - } - return (outStream.toString()); - } - } diff --git a/mq/main/mqcomm-util/src/test/java/com/sun/messaging/jmq/util/BASE64EncoderTest.java b/mq/main/mqcomm-util/src/test/java/com/sun/messaging/jmq/util/BASE64EncoderTest.java index 001d2a9af..ecc352ffe 100644 --- a/mq/main/mqcomm-util/src/test/java/com/sun/messaging/jmq/util/BASE64EncoderTest.java +++ b/mq/main/mqcomm-util/src/test/java/com/sun/messaging/jmq/util/BASE64EncoderTest.java @@ -18,16 +18,21 @@ import static org.assertj.core.api.Assertions.assertThat; +import java.io.ByteArrayOutputStream; +import java.io.IOException; + import org.junit.jupiter.api.Test; class BASE64EncoderTest { private BASE64Encoder encoder = new BASE64Encoder(); @Test - void testEncodingDate() { + void testEncodingDate() throws IOException { var plain = "Thu 16 Dec 20:37:57 UTC 2021"; + var buffer = new ByteArrayOutputStream(); - var encoded = encoder.encodeBuffer(plain.getBytes()); + encoder.encodeBuffer(plain.getBytes(), buffer); + var encoded = buffer.toString(); assertThat(encoded).isEqualTo("VGh1IDE2IERlYyAyMDozNzo1NyBVVEMgMjAyMQ==" + System.lineSeparator()); }