Gitlet / Blob.java
Blob.java
Raw
package gitlet;

import java.io.File;
import java.io.Serializable;

/** This class makes regular files serializable and
 *  storable for later use.
 *  @author Ethan Ikegami
 */
public class Blob implements Serializable {

    /** Initializes a Blob instance. Takes in
     *  a FILE and stores the name of the files and
     *  the contents of the file. */
    public Blob(File file) {
        _blob = Utils.readContentsAsString(file);
        _fileName = file.getName();
    }

    /** Returns the String contents of a file. */
    public String getBlob() {
        return _blob;
    }

    /** Returns the String filename. */
    public String getFileName() {
        return _fileName;
    }

    /** Contents of a file. */
    private String _blob;

    /** Filename of a file. */
    private String _fileName;
}