com.tuneology.avm.burner
Class ShellBurner

java.lang.Object
  |
  +--com.tuneology.avm.burner.ShellBurner
Direct Known Subclasses:
CdrdaoBurner, CdrecordBurner, HdiutilBurner

public abstract class ShellBurner
extends java.lang.Object

An abstract class implementing a shell command for writing CD-R data.

Version:
$Id: ShellBurner.java,v 1.9 2003/06/10 08:39:06 xnarf Exp $
Author:
Fran Taylor

Field Summary
protected  AtipInfo atipInfo
           
protected  CDRDrive drive
           
protected  int maxMediaWriteSpeed
           
protected  java.lang.String msInfo
           
protected  ProgressListener pm
           
protected  java.lang.String shellEncoding
           
 
Constructor Summary
protected ShellBurner(CDRDrive drive)
           
 
Method Summary
 void burnSession(int speed, int mode, boolean multi, java.lang.String mcn, java.lang.String[] tracks, boolean[] types, DiscInfo info, java.io.File tempDir, ProgressListener pm)
          Burns a session on a CD-R.
protected abstract  void cleanupErase()
           
protected abstract  void cleanupMsinfo()
           
protected abstract  void cleanupSession(java.io.File tempDir)
           
 void createCopy(CDDrive src, int speed, boolean onTheFly, ProgressListener pm)
           
 void erase(int mode)
           
protected abstract  java.util.ArrayList getAtipCmd()
          Returns the command required to read the ATIP info from the disc.
 AtipInfo getAtipInfo()
           
protected abstract  java.util.ArrayList getCopyCmd(CDDrive src, int speed, boolean onTheFly)
          Returns the command required to create a copy of the disc in the src drive.
protected abstract  java.util.ArrayList getEraseCmd(int mode)
          Returns the command required to erase the disc in the given mode.
 java.lang.String getMsinfo()
          Returns multisession info for the disc in the drive.
protected abstract  java.util.ArrayList getMsinfoCmd()
          Returns the command required to read the multisession info from the disc.
protected abstract  java.util.ArrayList getSessionCmd(int speed, int mode, boolean multi, java.lang.String mcn, java.lang.String[] tracks, boolean[] types, DiscInfo cdText, java.io.File tempDir)
           
protected abstract  java.util.ArrayList getStreamingCmd(int speed, int mode, boolean multi, java.lang.String mcn, boolean type, TocEntry cdText)
           
protected abstract  boolean readAtipOutput(java.lang.String str)
          Called for each line of output from the program while reading the ATIP info from a disc.
protected abstract  boolean readCopyOutput(java.lang.String str)
          Called for each line of output from the program while copying a disc.
protected abstract  boolean readEraseOutput(java.lang.String str)
          Called for each line of output from the program while erasing a disc.
protected abstract  boolean readMsinfoOutput(java.lang.String str)
          Called for each line of output from the program while reading the multisession info from a disc.
protected abstract  boolean readSessionOutput(java.lang.String str)
          Called for each line of output from the program while writing a session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

drive

protected CDRDrive drive

pm

protected ProgressListener pm

msInfo

protected java.lang.String msInfo

maxMediaWriteSpeed

protected int maxMediaWriteSpeed

atipInfo

protected AtipInfo atipInfo

shellEncoding

protected java.lang.String shellEncoding
Constructor Detail

ShellBurner

protected ShellBurner(CDRDrive drive)
Method Detail

burnSession

public void burnSession(int speed,
                        int mode,
                        boolean multi,
                        java.lang.String mcn,
                        java.lang.String[] tracks,
                        boolean[] types,
                        DiscInfo info,
                        java.io.File tempDir,
                        ProgressListener pm)
                 throws java.lang.Exception
Burns a session on a CD-R. Will create: Audio CDs, CD-Extra CDs, Data CDs, and Bootable Data CDs, depending on the arguments passed. Can optionally add CD-TEXT information to audio tracks.
Parameters:
speed - The speed at which to burn the CD.
mode - The mode in which to burn the CD, one of: DAO_MODE, RAW96R_MODE, RAW16_MODE, RAW96P_MODE. If the DUMMY_MODE bit is set, the operation is tested but no data is burned to disc.
multi - When burning multisession discs, set this flag to true for all sessions except the last.
mcn - Media Catalog Number for audio CD (optional).
tracks - A list of files containing track data.
types - A list of boolean values, true if the corresponding track is data, false for audio. If null, assumes all tracks are audio.
info - The CD-TEXT info for each audio track (optional). The values written are: DiscInfo.artist, TocEntry.artist, TocEntry.album, TocEntry.title.
tempDir - The directory to use for temp files.
pm - The status indicator (optional).
Throws:
java.lang.Exception - if there is an error.

createCopy

public void createCopy(CDDrive src,
                       int speed,
                       boolean onTheFly,
                       ProgressListener pm)
                throws java.lang.Exception

getMsinfo

public java.lang.String getMsinfo()
                           throws java.lang.Exception
Returns multisession info for the disc in the drive.
Returns:
the multisession info as a string.
Throws:
java.io.IOException - if there is an error reading or writing a file.
java.lang.InterruptedException - if the java thread is interrupted.
ProcessException - if there is an error running a process.

erase

public void erase(int mode)
           throws java.lang.Exception
Throws:
java.lang.Exception -  

getAtipInfo

public AtipInfo getAtipInfo()
                     throws java.lang.Exception
Throws:
java.lang.Exception -  

getStreamingCmd

protected abstract java.util.ArrayList getStreamingCmd(int speed,
                                                       int mode,
                                                       boolean multi,
                                                       java.lang.String mcn,
                                                       boolean type,
                                                       TocEntry cdText)
                                                throws java.lang.Exception
Throws:
java.lang.Exception -  

getSessionCmd

protected abstract java.util.ArrayList getSessionCmd(int speed,
                                                     int mode,
                                                     boolean multi,
                                                     java.lang.String mcn,
                                                     java.lang.String[] tracks,
                                                     boolean[] types,
                                                     DiscInfo cdText,
                                                     java.io.File tempDir)
                                              throws java.lang.Exception
Throws:
java.lang.Exception -  

readSessionOutput

protected abstract boolean readSessionOutput(java.lang.String str)
                                      throws java.lang.Exception
Called for each line of output from the program while writing a session.
Parameters:
str - the line of output.
Returns:
true if there is no error.
Throws:
java.lang.Exception -  

cleanupSession

protected abstract void cleanupSession(java.io.File tempDir)
                                throws java.lang.Exception

cleanupErase

protected abstract void cleanupErase()
                              throws java.lang.Exception

cleanupMsinfo

protected abstract void cleanupMsinfo()
                               throws java.lang.Exception

getEraseCmd

protected abstract java.util.ArrayList getEraseCmd(int mode)
Returns the command required to erase the disc in the given mode.
Parameters:
mode - the desired erase mode
Returns:
the list of strings to execute.

readEraseOutput

protected abstract boolean readEraseOutput(java.lang.String str)
Called for each line of output from the program while erasing a disc.
Parameters:
str - the line of output.
Returns:
true if there is no error.

getMsinfoCmd

protected abstract java.util.ArrayList getMsinfoCmd()
Returns the command required to read the multisession info from the disc.
Returns:
the list of strings to execute.

readMsinfoOutput

protected abstract boolean readMsinfoOutput(java.lang.String str)
Called for each line of output from the program while reading the multisession info from a disc.
Parameters:
str - the line of output.
Returns:
true if there is no error.

getAtipCmd

protected abstract java.util.ArrayList getAtipCmd()
Returns the command required to read the ATIP info from the disc.
Returns:
the list of strings to execute.

readAtipOutput

protected abstract boolean readAtipOutput(java.lang.String str)
Called for each line of output from the program while reading the ATIP info from a disc.
Parameters:
str - the line of output.
Returns:
true if there is no error.

getCopyCmd

protected abstract java.util.ArrayList getCopyCmd(CDDrive src,
                                                  int speed,
                                                  boolean onTheFly)
                                           throws java.lang.Exception
Returns the command required to create a copy of the disc in the src drive.
Returns:
the list of strings to execute.
Throws:
java.lang.Exception -  

readCopyOutput

protected abstract boolean readCopyOutput(java.lang.String str)
                                   throws java.lang.Exception
Called for each line of output from the program while copying a disc.
Parameters:
str - the line of output.
Returns:
true if there is no error.