加密后,可以解密还原,没有问题
public String readfile(String filename) throws IOException
{
String strbuffer=new String();
byte[] data=new byte[500];
int nread;
try{
FileInputStream inputfile=new FileInputStream(filename);
DataInputStream inputdata=new DataInputStream(inputfile);
while((nread=inputdata.read(data))!=-1)
strbuffer=strbuffer+new String(data,0,nread);
inputdata.close();
}
catch(IOException e)
{
throw e;
}
return strbuffer;
}
public void savefile(String filename) throws IOException
{
try{
FileOutputStream outfile=new FileOutputStream(filename);
DataOutputStream outdata=new DataOutputStream(outfile);
//outdata.write(jEditorPane1.getText().getBytes());
outdata.writeBytes(jEditorPane1.getText());
outdata.flush();
outdata.close();
}
catch(IOException e)
{
throw e;
}
}
public String readfile(String filename) throws IOException
{
String strbuffer=new String();
byte[] data=new byte[500];
int nread;
try{
FileInputStream inputfile=new FileInputStream(filename);
DataInputStream inputdata=new DataInputStream(inputfile);
while((nread=inputdata.read(data))!=-1)
strbuffer=strbuffer+new String(data,0,nread);
inputdata.close();
}
catch(IOException e)
{
throw e;
}
return strbuffer;
}
public void savefile(String filename) throws IOException
{
try{
FileOutputStream outfile=new FileOutputStream(filename);
DataOutputStream outdata=new DataOutputStream(outfile);
//outdata.write(jEditorPane1.getText().getBytes());
outdata.writeBytes(jEditorPane1.getText());
outdata.flush();
outdata.close();
}
catch(IOException e)
{
throw e;
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货