common_helper/src/main/java/com/xiongyingqi/util/SerializeHelper.java
public static File writeObjectToFile(File folder, Serializable serializable) throws IOException {
        Assert.notNull(folder, "文件夹不能为空");
        if (!folder.exists()) {
            folder.mkdirs();
        }
        Assert.isTrue(folder.isDirectory(), folder + "不是文件夹");
        File file = new File(folder, System.currentTimeMillis() + nextIndex() + "");
        ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(file));
        outputStream.writeObject(serializable);
        outputStream.flush();
        outputStream.close();
        return file;
    }
public static File writeObjectToFile(File folder, Serializable serializable) throws IOException {
        Assert.notNull(folder, "文件夹不能为空");
        if (!folder.exists()) {
            folder.mkdirs();
        }
        Assert.isTrue(folder.isDirectory(), folder + "不是文件夹");
        File file = new File(folder, System.currentTimeMillis() + nextIndex() + "");
        ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(file));
        outputStream.writeObject(serializable);
        outputStream.flush();
        outputStream.close();
        return file;
    }
public static File writeObjectToFile ( File folder , Serializable serializable ) throws IOException { Assert . notNull ( folder , "文件夹不能为空"); if ( ! folder . exists ( ) ) { folder . mkdirs ( ) ; } Assert . isTrue ( folder . isDirectory ( ) , folder + "不是文件夹"); File file = new File ( folder , System . currentTimeMillis ( ) + nextIndex ( ) + "" ) ; ObjectOutputStream outputStream = new ObjectOutputStream ( new FileOutputStream ( file ) ) ; outputStream . writeObject ( serializable ) ; outputStream . flush ( ) ; outputStream . close ( ) ; return file ; }
将对象序列化到文件

@param folder       父目录
@param serializable
@return
@throws java.io.IOException
将对象序列化到文件