This commit is contained in:
Smoss 2013-03-12 14:15:16 -04:00
commit 7624f3b040
2 changed files with 15 additions and 5 deletions

View File

@ -187,6 +187,7 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
} else if (state.equals(State.READY)) {
ExtractMedia em = new ExtractMedia(currentFile, getJFile(currentFile));
em.execute();
em.getExtractedBytes();
}
}
}//GEN-LAST:event_pauseButtonActionPerformed
@ -483,14 +484,21 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
boolean success = false;
private AbstractFile sFile;
private java.io.File jFile;
String duration;
String position;
private String duration;
private String position;
private long extractedBytes;
ExtractMedia(org.sleuthkit.datamodel.AbstractFile sFile, java.io.File jFile) {
this.sFile = sFile;
this.jFile = jFile;
}
public long getExtractedBytes() {
return extractedBytes;
}
@Override
protected Object doInBackground() throws Exception {
success = false;
@ -504,7 +512,7 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
progress.start();
progress.switchToDeterminate(100);
try {
ContentUtils.writeToFile(sFile, jFile, progress, this, true);
extractedBytes = ContentUtils.writeToFile(sFile, jFile, progress, this, true);
} catch (IOException ex) {
logger.log(Level.WARNING, "Error buffering file", ex);
}

View File

@ -126,7 +126,7 @@ public final class ContentUtils {
private static final int TO_FILE_BUFFER_SIZE = 8192;
/**
* Reads all the data from any content object and writes it to a file.
* Reads all the data from any content object and writes (extracts) it to a file.
*
* @param content Any content object.
* @param outputFile Will be created if it doesn't exist, and overwritten if
@ -136,9 +136,10 @@ public final class ContentUtils {
* @param worker the swing worker background thread the process runs within,
* or null, if in the main thread, used to handle task cancellation
* @param source true if source file
* @return number of bytes extracted
* @throws IOException if file could not be written
*/
public static void writeToFile(Content content, java.io.File outputFile,
public static long writeToFile(Content content, java.io.File outputFile,
ProgressHandle progress, SwingWorker worker, boolean source) throws IOException {
InputStream in = new ReadContentInputStream(content);
@ -174,6 +175,7 @@ public final class ContentUtils {
} finally {
out.close();
}
return totalRead;
}
public static void writeToFile(Content content, java.io.File outputFile) throws IOException {