Подскажите, как заставить ByteArrayOutputStream принять значение StringBuffer
public class Solution {
    public static ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    public static PrintStream stream = new PrintStream(outputStream);

    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);
        printSomething(scanner.nextLine());
        String result = outputStream.toString();
        //напишите тут ваш код
        StringBuffer buffer = new StringBuffer(result);
        outputStream.write(buffer.reverse().toString().getBytes());
    }

    public static void printSomething(String str) {stream.print(str);
    }
}