Creating a CD-burning feature for a music player based on Java
I'm trying to create a CD-burning feature for a Java-based music player for my school project. Since I'm new to real-life programming (I've only learned to write codes o开发者_运维百科n AP Computer Science A level), I don't know how I can apply the concepts I learned from APCS A to this task.
A friend of mine who is studying computer science at graduate school told me to "look up the cd player control functions and add methods in those classes to read in data that you want to write to the CD, write it to a buffer, write everything in the buffer to the CD itself, clear the buffer and then write a new chunk of data into the buffer," but I can't quite grasp what this means, and tt's really hard to contact her right now because she's busy working on her dissertation. Can someone from this forum please guide me through & explain the general concepts? Thank you!
You'll probably want to find a good CD burning library such as this one or any other one - just make sure it works on whatever operating system you will be making this for. You probably won't be able to do this directly from Java (at least I am not aware of any way to write to a CD natively in Java) but you can do it in, for example, C++, and then use JNI to call it. JNI will allow you to call C++ code from within Java.
A simpler solution would be to write a front end for the open source cdrtools.
JIIC: Java ISO Image Creator
JIIC is a streaming-based Java implementation of ISO 9660 for creating CD-ROM filesystem images ("ISO images") with the extensions El Torito, Joliet and Rock Ridge. It is based on the SABRE streaming API and provides an Ant task for easy integration into Java-based build processes. ISO 9660
The ISO 9660 standard from 1988 describes the filesystem to be used for CD-ROMs. ECMA-119 (2nd edition) is fully equivalent to ISO 9660. Several restrictions apply, including character sets, deep directory nesting and filename lengths. As a result, extensions like El Torito (bootable CD-ROMs), Joliet (Unicode, longer filenames) and Rock Ridge (support for UNIX filesystem characteristics) were developed. SABRE
The Simple API for Binary REpresentations (SABRE) was developed by Michael Hartle at the Darmstadt University of Technology, Germany. It introduces a Java-based streaming API for processing binary data (as opposed to textual representations like XML) through a set of modules acting as a pipeline. Read the article for details or visit its website. JIIC
JIIC is the result of the practical part of my diploma thesis at the Darmstadt University of Technology, Department of Computer Science, Telecooperation Group. The diploma thesis was supervised by Prof. Dr. Max Mühlhäuser and Michael Hartle, developer of SABRE.
JIIC and SABRE are provided as a set of Java 1.4 classes packed together in JAR files. The JIIC and SABRE source code is licensed under the LGPL. JIIC is available from CVS, SABRE from SourceForge. Downloads JIIC 1.1.2
All-in-one package
Updated test suite
JIIC 1.1.1
All-in-one package
Updated test suite
JIIC 1.1
All-in-one package
JIIC 1.0
ISO9660 JAR
SABRE JAR
ISOtest class
Test suite
Changelog
JIIC 1.1.2
added support for long Joliet file names (up to 103 Unicode characters instead of 64, disabled by default) like mkisofs's -joliet-long option, as requested by Nigel Tamplin
JIIC 1.1.1
fixed Joliet file name length check bug, reported by Alessandro Premoli and Christof Nef
JIIC 1.1 "JNode edition"
Incorporated a patch by Gilles "Wooden" Duboscq for adding support for patching the El Torito boot image (like mkisofs -boot-info-table) and padding the ISO image to 150 sectors (like mkisofs -pad). See build.xml for the new options.
精彩评论