易截截图软件、单文件、免安装、纯绿色、仅160KB

JAVA中FileHelper的一个用法

 public boolean writeXML(String content, String filename)
    {  
        String savepath;
        FileOutputStream fout;
//        log.info("content:"+content+" filename:"+filename+" writeDir:"+writeDir);
        savepath = (new StringBuilder(String.valueOf(writeDir))).append(File.separatorChar).append(filename).toString();
        fout = null;
        if(content == null)
            return false;
        File file = new File(writeDir);
        try
        {
         if(!file.exists()){
          file.mkdirs();
         }
            fout = new FileOutputStream(savepath);
            byte buffer[] = content.getBytes();
            fout.write(buffer);
           // break MISSING_BLOCK_LABEL_111;
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        if(fout != null)
            try
            {
       


相关文档:

Java Mail 发送邮件

package com.eastpro.batch.biz;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
import java.security.spec.X509EncodedKeySpec;
public class SendMail {
  private MimeMessage mimeMsg; //MIME mail object
  private Session session;
  ......

Java Mail send email

package com.eastpro.batch.biz;
//import javax.activation.*;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.mail.internet.*;
import javax.mail.*;
import java.io.UnsupportedEncodingException;
import java.util.*;
/**
 * Insert the type's descript ......

java设计模式之Singleton(单态)

定义:
Singleton模式主要作用是保证在Java应用程序中,一个类Class只有一个实例存在。
在很多操作中,比如建立目录 数据库连接都需要这样的单线程操作。
还有, singleton能够被状态化;
这样,多个单态类在一起就可以作为一个状态仓库一样向外提供服务,比如,你要论坛中的帖子计数器,每次浏览一次需要计数,单态类能否 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号