package lc.mecha.file;

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

/**
 * Implementation of the {@link FilePointer} backed by a RAM byte array. This file pointer has the quality that
 * the <code>getData()</code> method can be called multiple times.
 *
 * @author Alex Leigh
 */
public class RamFile extends BaseFile implements Serializable {
    private static final long serialVersionUID = 1L;

    private byte[] data;

    public RamFile(String filename, String filetype) {
        super(filename, filetype);
    }

    @Override
    public InputStream getData() {
        return new ByteArrayInputStream(data);
    }
}
