小晒一下,一个残缺初级版音乐切割和组合软件
2011-09-05 15:21
211 查看
//////////////////////////////////////////////切割
package 文件的切割与和;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class Test3 implements ActionListener{
Frame frame;
TextField t1,t2;
Button btn1,btn2;
String string,string1;
Panel p1,p2,p3,p4;
Label l1,l2;
public Test3() {
frame = new Frame("把你割成粉碎");
t1 = new TextField(30);
t2 = new TextField(30);
p1 = new Panel();
p2 = new Panel();
p3 = new Panel();
p4 = new Panel();
l1 = new Label("文件读取路径名:");
l2 = new Label("切割到:");
btn1 = new Button("切割吧");
btn2 = new Button("合体");
btn1.addActionListener(this);
btn2.addActionListener(this);
frame.add(p2,"Center");
p2.add(p3,"North");
p3.add(l1);
p3.add(t1);
p2.add(p4,"South");
p4.add(l2);
p4.add(t2);
frame.add(p1,"South");
p1.add(btn1,"West");
p1.add(btn2,"East");
frame.setSize(600,200);
frame.setLocation(200,200);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
public void test3() {
try {
string = t1.getText();
string1 = t2.getText();
FileInputStream fis = new FileInputStream(string);
FileOutputStream fos = null;
byte[] buf = new byte[1024 * 1024];
int len = 0;
int count = 1;
while ((len = fis.read(buf)) != -1) {
fos = new FileOutputStream(string1 + (count++) + ".part");
fos.write(buf, 0, len);
fos.close();
}
fis.close();
} catch (Exception e) {
// TODO: handle exception
}
}
public static void main(String[] args) {
new Test3();
}
public void actionPerformed(ActionEvent e) {
if(e.getSource() == btn1){
test3();
}else if(e.getSource()==btn2){
new Test1();
frame.setVisible(false);
}
}
}
////////////////////////////////////////////////////组合
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
public class Test1 implements ActionListener {
Frame frame;
TextField t1,t2,t3;
Button btn2;
String string,string1;
Panel p1,p2,p3;
Label l1,l2,l3;
int i;
public Test1() {
frame = new Frame("超级赛亚人");
t1 = new TextField(20);
t2 = new TextField(20);
t3 = new TextField(5);
p1 = new Panel();
p2 = new Panel();
p3 = new Panel();
btn2 = new Button("合体吧");
btn2.addActionListener(this);
l1 = new Label("文件来源:");
l2 = new Label("存入路径和名称(MP3格式):");
l3 = new Label("文件数:");
frame.add(p1,"Center");
p1.add(p2,"North");
p1.add(p3,"South");
p2.add(l1);
p2.add(t1);
p2.add(l3);
p2.add(t3);
p3.add(l2);
p3.add(t2);
frame.add(btn2, "South");
frame.setSize(600, 200);
frame.setLocation(200, 200);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
public void test1() {
try {
string = t1.getText();
string1 = t2.getText();
i = Integer.parseInt(t3.getText());
ArrayList<FileInputStream> al = new ArrayList<FileInputStream>();
for (int x = 1; x < i+1; x++)
al.add(new FileInputStream(string+x+".part"));
final Iterator<FileInputStream> it = al.iterator();
Enumeration<FileInputStream> en = new Enumeration<FileInputStream>() {
public boolean hasMoreElements() {
return it.hasNext();
}
public FileInputStream nextElement() {
return it.next();
}
};
SequenceInputStream sis = new SequenceInputStream(en);
FileOutputStream fos = new FileOutputStream(string1);
byte[] buf = new byte[1024 * 4];
int len = 0;
while ((len = sis.read(buf)) != -1) {
fos.write(buf, 0, len);
}
fos.close();
sis.close();
} catch (Exception e) {
// TODO: handle exception
}
}
public static void main(String[] args) {
new Test1();
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == btn2){
test1();
}
}
}
package 文件的切割与和;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class Test3 implements ActionListener{
Frame frame;
TextField t1,t2;
Button btn1,btn2;
String string,string1;
Panel p1,p2,p3,p4;
Label l1,l2;
public Test3() {
frame = new Frame("把你割成粉碎");
t1 = new TextField(30);
t2 = new TextField(30);
p1 = new Panel();
p2 = new Panel();
p3 = new Panel();
p4 = new Panel();
l1 = new Label("文件读取路径名:");
l2 = new Label("切割到:");
btn1 = new Button("切割吧");
btn2 = new Button("合体");
btn1.addActionListener(this);
btn2.addActionListener(this);
frame.add(p2,"Center");
p2.add(p3,"North");
p3.add(l1);
p3.add(t1);
p2.add(p4,"South");
p4.add(l2);
p4.add(t2);
frame.add(p1,"South");
p1.add(btn1,"West");
p1.add(btn2,"East");
frame.setSize(600,200);
frame.setLocation(200,200);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
public void test3() {
try {
string = t1.getText();
string1 = t2.getText();
FileInputStream fis = new FileInputStream(string);
FileOutputStream fos = null;
byte[] buf = new byte[1024 * 1024];
int len = 0;
int count = 1;
while ((len = fis.read(buf)) != -1) {
fos = new FileOutputStream(string1 + (count++) + ".part");
fos.write(buf, 0, len);
fos.close();
}
fis.close();
} catch (Exception e) {
// TODO: handle exception
}
}
public static void main(String[] args) {
new Test3();
}
public void actionPerformed(ActionEvent e) {
if(e.getSource() == btn1){
test3();
}else if(e.getSource()==btn2){
new Test1();
frame.setVisible(false);
}
}
}
////////////////////////////////////////////////////组合
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
public class Test1 implements ActionListener {
Frame frame;
TextField t1,t2,t3;
Button btn2;
String string,string1;
Panel p1,p2,p3;
Label l1,l2,l3;
int i;
public Test1() {
frame = new Frame("超级赛亚人");
t1 = new TextField(20);
t2 = new TextField(20);
t3 = new TextField(5);
p1 = new Panel();
p2 = new Panel();
p3 = new Panel();
btn2 = new Button("合体吧");
btn2.addActionListener(this);
l1 = new Label("文件来源:");
l2 = new Label("存入路径和名称(MP3格式):");
l3 = new Label("文件数:");
frame.add(p1,"Center");
p1.add(p2,"North");
p1.add(p3,"South");
p2.add(l1);
p2.add(t1);
p2.add(l3);
p2.add(t3);
p3.add(l2);
p3.add(t2);
frame.add(btn2, "South");
frame.setSize(600, 200);
frame.setLocation(200, 200);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
public void test1() {
try {
string = t1.getText();
string1 = t2.getText();
i = Integer.parseInt(t3.getText());
ArrayList<FileInputStream> al = new ArrayList<FileInputStream>();
for (int x = 1; x < i+1; x++)
al.add(new FileInputStream(string+x+".part"));
final Iterator<FileInputStream> it = al.iterator();
Enumeration<FileInputStream> en = new Enumeration<FileInputStream>() {
public boolean hasMoreElements() {
return it.hasNext();
}
public FileInputStream nextElement() {
return it.next();
}
};
SequenceInputStream sis = new SequenceInputStream(en);
FileOutputStream fos = new FileOutputStream(string1);
byte[] buf = new byte[1024 * 4];
int len = 0;
while ((len = sis.read(buf)) != -1) {
fos.write(buf, 0, len);
}
fos.close();
sis.close();
} catch (Exception e) {
// TODO: handle exception
}
}
public static void main(String[] args) {
new Test1();
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == btn2){
test1();
}
}
}
相关文章推荐
- 总结一下维护了一年的一个软件系统的软件体系(一)
- 穆利堂推荐--软件行业销售该怎么做?我和北京安证通的一个销售人员的沟通,做销售的可以看看,思考一下
- 一个在线音乐软件的故事(一、故事的由来)
- 一个在线音乐软件的故事(五、让我们开始写代码吧)
- 找到一个软件测试的学习网址,保留一下
- 凌晨2点完成了软件系统中一个比较关键的功能窃喜一下
- 最近写了一个恶意软件,成功绕过了symantec和360,庆祝一下
- 精品软件 推荐 酷我音乐 一个可以下载320k 音质的音乐播放软件
- 一个在线音乐软件的故事(二、其实故事从这里才开始)
- 总结一下维护了一年的一个软件系统的软件体系(五)
- 写一个定时提醒小软件,到点有音乐,或语音朗读提醒
- 新年所做,一个进程结束小软件的完成,及所用的知识,总结一下
- 总结一下维护了一年的一个软件系统的软件体系(四)
- 软件架构的一个设想以及谈一下过去两年开发软件的过失
- 总结一下维护了一年的一个软件系统的软件体系(三)
- 水一个:组合数学生成作业的程序,算法很垃圾,有兴趣的帮我改一下啊
- 推荐我一个很喜欢的音乐软件 多米音乐盒
- 最近写了一个小的管理软件,其中在LOGO里加入了视频,这里讨论一下文件的保密
- 最近写了一个小的管理软件,其中在LOGO里加入了视频,这里讨论一下文件的保密
- 一个不错的mac软件下载站,mark一下 (商业使用请务必支持正版)