Java读取文件的简单代码
网址: http://blog.csdn.net/justinavril/archive/2008/08/06/2775767.aspx
import
java.io.*;
public
class
FileToString {
public
static
String readFile(String fileName) {
String output = ""
;
File file = new
File(fileName);
if
(file.exists()){
if
(file.isFile()){
try
{
BufferedReader input = new
BufferedReader (
new
FileReader(file));
StringBuffer buffer = new
StringBuffer();
String text;
while
((text = input.readLine()) !=
null
)
&n
相关文档:
在目前的关于java自学的讨论中,最经常看到的就是钻研《Thinking in java》(TIJ)的经验,但是,尽管使用TIJ作为教学材料的教学行为也很多,我却尚未发现有从教师关于如何将TIJ用于教学的论述。为此,我权作抛砖引玉。
首先,为什么要学习java?按照Eckel的话说, ......
import java.io.*;
public class FileReaderSample {
public static void main(String args[]) throws IOException
{
// 建立可容纳1024个字符的数组
char data[]=new char[1024];
// 建立对象fr
FileReader fr= ......
关于加解密JAVA一般使用的JCE,关于C++可以实现AES加解密的开源项目就多的数不胜数的。
理论上上算法一样,对称密钥一样就能够互相识别了。
相信很多人开始想法都同我一样,起初我JAVA用JCE,C++使用openssl。
结果发现加密出的密文完全不相同。
出现问题就要解决
了解了一下JCE:
JC ......
http://liuleijsjx.javaeye.com/blog/422343
本人刚写的学习心得 希望能有所帮助
/**
*代码实例 通过反编译查看keytool的java code获得的数字证书的内部生成方法
*推荐使用jdk1.5
**/
1。首先生成selfcert
CertAndKeyGen cak = new CertAndKeyGen("RSA","MD5WithRSA",null);
//参数分别为 公钥 ......
1. ObjectInputStream 与 ObjectOutputStream的读写对象可以以对应的顺序进行多个对象的读写。
2. Break Loop label。 在循环语句前加上一个label,如label1: 然后在循环体的语句中加入break label1,即可跳出该循环,无论其是内层循环
还是外层循环。 ......