listfromfile.java

来自「基于JMF实现的MediaPlayer.」· Java 代码 · 共 56 行

JAVA
56
字号
/*
 * ListFromFile.java
 *
 * Created on 2006年5月11日, 上午9:42
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package media;
import java.io.*;
import java.util.*;
import java.awt.*;
import javax.swing.*;
/**
 *
 * @author freezing
 */
public class ListFromFile implements Serializable
{
    File file;
    String fileName;
    Vector temp;
    /** Creates a new instance of ListFromFile */
    public ListFromFile(String filename) {
        fileName="MusicInfo.ini";
        try{
            file=new File(fileName);
	    if(file.exists())
	   {
		FileInputStream fileIn=new FileInputStream(fileName);
            //创建对象输入流
                ObjectInputStream objectIn=new ObjectInputStream(fileIn);
                temp=(Vector)objectIn.readObject();
               //JOptionPane.showMessageDialog(null, "文件列表存在并已经读入!", "警告!", JOptionPane.INFORMATION_MESSAGE);
		}
            else
                temp=null;
        }catch(IOException e)
        {
            System.out.println(e.getMessage());
        }
        catch(ClassNotFoundException e)
        {
            System.out.println(e.getMessage());
        }
    }
    public Vector getContent()
    {
        if(temp!=null)
            return temp;
        else
            return null;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?