Android Open Source - MCCDash File Info






From Project

Back to project page MCCDash.

License

The source code is released under:

Apache License

If you think the Android project MCCDash listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package edu.bupt.mccdash.bluetooth;
//from   w  w w.  j  a va 2 s  .com
import java.io.File;

import android.util.Log;
import edu.bupt.mccdash.io.FileFactory;
import edu.bupt.mccdash.io.Logger;

public class FileInfo {
  public String fileName;
  public int fileStartPoint;
  public int fileLength;
  public String filePath;
  public byte[] fileContent;

  private static final String TAG = "MainActivity";

  public static FileInfo getFileInfoFromString(String readMessage) {
    int nameIndex = readMessage.indexOf("NAME:");
    int nameEndIndex = readMessage.indexOf("END NAME");
    String fileName = readMessage.substring(nameIndex + "NAME:".length(),
        nameEndIndex);

    // obtain the length:
    int lengthIndex = readMessage.indexOf("LENGTH:");
    int lengthEndIndex = readMessage.indexOf("END LENGTH");
    String fileStartLengthString = readMessage.substring(lengthIndex
        + "LENGTH:".length(), lengthEndIndex);
    int fileStartLength = Integer.valueOf(fileStartLengthString);

    FileInfo fileInfo = new FileInfo();

    fileInfo = new FileInfo();
    fileInfo.fileName = fileName;
    fileInfo.fileStartPoint = fileStartLength;

    return fileInfo;

  }

  public static FileInfo getFile(String filePath, String outputFileName,int startPoint,int range) {
    FileInfo fileInfo = null;

    File file = new File(FileFactory.SDPath + filePath);
    try {
      byte[] fileByte = FileFactory.getByte2(file,startPoint,range);
      //Logger.i("fileByte.length" + fileByte.length);
      Log.v(TAG, "110.mp4 byte[]fileByte---" + fileByte.length);

      // qq?????
      // String test =Base64.encodeToString(fileByte, Base64.DEFAULT);
      // String test = new String(Base64.encode(fileByte,Base64.DEFAULT));
      // Log.v(TAG, "110.mp4 String---"+test.length());
      // Logger.i("test.length()"+test.length());
      // Logger.i(test);
      fileInfo = new FileInfo();
      fileInfo.fileContent = fileByte;
      fileInfo.fileName = outputFileName;
      fileInfo.fileStartPoint = startPoint;
      fileInfo.fileLength = range;

    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      return fileInfo;
    }

  }

}




Java Source Code List

edu.bupt.mccdash.HttpDownloader.java
edu.bupt.mccdash.MainActivity.java
edu.bupt.mccdash.MediaPlayerDemo_Video.java
edu.bupt.mccdash.OnBluetoothRecvCompleteListener.java
edu.bupt.mccdash.OnHttpDownloadCompleteListener.java
edu.bupt.mccdash.bluetooth.BluetoothConnectionService.java
edu.bupt.mccdash.bluetooth.DeviceListActivity.java
edu.bupt.mccdash.bluetooth.FileInfo.java
edu.bupt.mccdash.bluetooth.WirelessConnectionService.java
edu.bupt.mccdash.cpuutils.CpuManager.java
edu.bupt.mccdash.io.FileFactory.java
edu.bupt.mccdash.io.Logger.java
edu.bupt.mccdash.m3u8.FakeStreamPlayer.java
edu.bupt.mccdash.m3u8.M3u8Resolver.java