package rb;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

/**
 * Created by IntelliJ IDEA.
 * User: Gong Zeng
 * Date: 5/16/11
 * Time: 12:12 PM
 */
public class MemoryFile {
    String name;
    String content;

    public MemoryFile(String name, String diff) {
        this.name = name;
        this.content = diff;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public InputStream getInputStream() {
        return new ByteArrayInputStream(content.getBytes());
    }
}

package rb;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;

/**
 * Created by IntelliJ IDEA.
 * User: Gong Zeng
 * Date: 5/16/11
 * Time: 12:12 PM
 */
public class MemoryFile {
    String name;
    String content;

    public MemoryFile(String name, String diff) {
        this.name = name;
        this.content = diff;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public InputStream getInputStream() throws UnsupportedEncodingException {
        return new ByteArrayInputStream(content.getBytes("utf-8"));
    }
}

Set default encoding of diff file to utf-8 according of issue reported by @yqt: diff file gets wrong encoding