/*
 *  @author Ranides Atterwim <ranides@gmail.com>
 *  @copyright Ranides Atterwim
 *  @license WTFPL
 *  @url http://ranides.net/projects/assira
 */

package net.ranides.assira.io;

import java.io.ByteArrayInputStream;
import java.nio.charset.Charset;
import net.ranides.assira.text.Charsets;

/**
 *
 * @author ranides
 */
public class StringInput extends ByteArrayInputStream {
    
    private final Charset cs;

    public StringInput(String text, Charset charset) {
        super(text.getBytes(charset));
        this.cs = charset;
    }

    public StringInput(String text, String charset) {
        this(text, Charset.forName(charset));
    }

    public StringInput(String text) {
        this(text, Charsets.UTF8);
    }
    
    public Charset charset() {
        return cs;
    }
    
}