How to read .muse file from muse file reader for the eeg values i am using testlibmuseapp android example

i am beginner at programming please helo me out any helo will be highly appreciated how to read .muse file from muse file reader for the eeg values i am using testlibmuseapp android example
* Reads the provided .muse file and prints the data to the logcat.
* @param name The name of the file to read. The file in this example
* is assumed to be in the Environment.DIRECTORY_DOWNLOADS
* directory.
private void playMuseFile(String name) {

    File dir = getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
    File file = new File(dir, name);

    final String tag = "Muse File Reader";

    if (!file.exists()) {
        Log.w(tag, "file doesn't exist");

    MuseFileReader fileReader = MuseFileFactory.getMuseFileReader(file);

    // Loop through each message in the file.  gotoNextMessage will read the next message
    // and return the result of the read operation as a Result.
    Result res = fileReader.gotoNextMessage();
    while (res.getLevel() == ResultLevel.R_INFO && !res.getInfo().contains("EOF")) {

        MessageType type = fileReader.getMessageType();
        int id = fileReader.getMessageId();
        long timestamp = fileReader.getMessageTimestamp();

        Log.i(tag, "type: " + type.toString() +
              " id: " + Integer.toString(id) +
              " timestamp: " + String.valueOf(timestamp));

        switch(type) {
            // EEG messages contain raw EEG data or DRL/REF data.
            // EEG derived packets like ALPHA_RELATIVE and artifact packets
            // are stored as MUSE_ELEMENTS messages.
            case EEG:
            case BATTERY:
            case ACCELEROMETER:
            case QUANTIZATION:
            case GYRO:
            case MUSE_ELEMENTS:
                MuseDataPacket packet = fileReader.getDataPacket();
                Log.i(tag, "data packet: " + packet.packetType().toString());
            case VERSION:
                MuseVersion version = fileReader.getVersion();
                Log.i(tag, "version" + version.getFirmwareType());
            case CONFIGURATION:
                MuseConfiguration config = fileReader.getConfiguration();
                Log.i(tag, "config" + config.getBluetoothMac());
            case ANNOTATION:
                AnnotationData annotation = fileReader.getAnnotation();
                Log.i(tag, "annotation" + annotation.getData());

        // Read the next message.
        res = fileReader.gotoNextMessage();

// Listener translators
// Each of these classes extend from the appropriate listener and contain a weak reference
// to the activity.  Each class simply forwards the messages it receives back to the Activity.
class MuseL extends MuseListener {
    final WeakReference<MainActivity> activityRef;

    MuseL(final WeakReference<MainActivity> activityRef) {
        this.activityRef = activityRef;

    public void museListChanged() {

class ConnectionListener extends MuseConnectionListener {
    final WeakReference<MainActivity> activityRef;

    ConnectionListener(final WeakReference<MainActivity> activityRef) {
        this.activityRef = activityRef;

    public void receiveMuseConnectionPacket(final MuseConnectionPacket p, final Muse muse) {
        activityRef.get().receiveMuseConnectionPacket(p, muse);

class DataListener extends MuseDataListener {
    final WeakReference<MainActivity> activityRef;

    DataListener(final WeakReference<MainActivity> activityRef) {
        this.activityRef = activityRef;

    public void receiveMuseDataPacket(final MuseDataPacket p, final Muse muse) {
        activityRef.get().receiveMuseDataPacket(p, muse);

    public void receiveMuseArtifactPacket(final MuseArtifactPacket p, final Muse muse) {
        activityRef.get().receiveMuseArtifactPacket(p, muse);

i think this portion of code is doing the file reading