package com.atlassian.bitbucket.mesh.test;

import javax.annotation.Nonnull;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;

public class IoTestUtils {

    private IoTestUtils() {
        throw new UnsupportedOperationException(getClass().getName() + " is a utility class");
    }

    @Nonnull
    public static byte[] toBytes(@Nonnull String value) {
        return value.getBytes(StandardCharsets.UTF_8);
    }

    @Nonnull
    public static ByteBuffer toByteBuffer(@Nonnull String value) {
        return ByteBuffer.wrap(toBytes(value));
    }
}