Java¶ÁÎļþ
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.RandomAccessFile;
import java.io.Reader;
public class ReadfromFile{
/**
* ÒÔ×Ö½ÚΪµ¥Î»¶ÁÈ¡Îļþ£¬³£ÓÃÓÚ¶Á¶þ½øÖÆÎļþ£¬ÈçͼƬ¡¢ÉùÒô¡¢Ó°ÏñµÈÎļþ¡£
* @param fileName ÎļþµÄÃû
*/
public static void readFileByBytes(String fileName){
File file = new File(fileName);
InputStream in = null;
try {
System.out.println("ÒÔ×Ö½ÚΪµ¥Î»¶ÁÈ¡ÎļþÄÚÈÝ£¬Ò»´Î¶ÁÒ»¸ö×Ö½Ú£º");
// Ò»´Î¶ÁÒ»¸ö×Ö½Ú
in = new FileInputStream(file);
int tempbyte;
while((tempbyte=in.read()) != -1){
System.out.write(tempbyte);
}
in.close();
} catch (IOException e) {
e.printStackTrace();
return;
}
try {
System.out.println("\nÒÔ×Ö½ÚΪµ¥Î»¶ÁÈ¡ÎļþÄÚÈÝ£¬Ò»´Î¶Á¶à¸ö×Ö½Ú£º");
//Ò»´Î¶Á¶à¸ö×Ö½Ú
byte[] tempbytes = new byte[100];
int byteread = 0;
in = new FileInputStream(fileName);
ReadfromFile.showAvailableBytes(in);
//¶ÁÈë¶à¸ö×Ö½Úµ½×Ö½ÚÊý×éÖУ¬bytereadΪһ´Î¶ÁÈëµÄ×Ö½ÚÊý
while ((byteread = in.read(tempbytes)) != -1){
System.out.write(tempbytes, 0, byteread);
}
} catch (Exception e1) {
e1.printStackTrace();
} finally {
if (in != null){
try {
in.close();
} catch (IOException e1) {
}
}
}
}
/**
* ÒÔ×Ö·ûΪµ¥Î»¶ÁÈ¡Îļþ£¬³£ÓÃÓÚ¶ÁÎı¾£¬Êý×ÖµÈÀàÐ͵ÄÎļþ
* @param fileName ÎļþÃû
*/
public static void readFileByChars(String fileName){
File file = new File(fileName);
Reader reader = null;
try {
System.out.println("\nÒÔ×Ö·ûΪµ¥Î»¶ÁÈ¡ÎļþÄÚÈÝ£¬Ò»´Î¶ÁÒ»¸ö×Ö½Ú£º");
// Ò»´Î¶ÁÒ»¸ö×Ö·û
reader = new InputStreamReader(new FileInputStream(file));
int tempchar;
while ((tempchar = reader.read()) != -1){
//¶ÔÓÚwindowsÏ£¬rnÕâÁ½¸ö×Ö·ûÔÚÒ»Æðʱ£¬±íʾһ¸ö»»ÐС£
//µ«Èç¹ûÕâÁ½¸ö×Ö·û·Ö¿ªÏÔʾʱ£¬»á»»Á½´ÎÐ
Ïà¹ØÎĵµ£º
ÏÈÀ´Á˽âÒ»ÏÂÁ´±íģʽµÄÔÀí£º
Ê×ÏÈдһ¸öJavaBean£¬ÄÚÈÝÊÇÒªÌí¼ÓµÄÔªËØºÍ¸ÃÔªËØµÄ½Úµã¡£
public class NodeBean implements Serializable
{
private Object data; //ÔªËØ±¾Éí
private NodeBean next; //ÏÂÒ»¸ö½Úµã
&n ......
ÔÚÏÂÃæÕâ¸ö³ÌÐòÖÐString args[]Æðʲô×÷Óã¿ÎÒѧ¹ýC++£¬String args[]ÓëC++ÖеÄʲôÀàËÆ£¿Èç¹ûÊÇC++£¬ÏëÒªÊä³ö×Ö·û´®Ö»ÒªÔÚÏÂÃæÐ´cout<<"...."<<endl;¾Í¿ÉÒÔÁË,void main()ÖеÄÀ¨ºÅΪ¿Õ£¬¶øjavaÖÐΪʲôҪдString args[]ÄØ£¿
class Example{
public static void main(String args[]){
System.out.printl ......
package test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.HttpURLConnection;
import java.net.PasswordAuthenticat ......
Eclipse ³£Óòå¼þµÄ°²×°
1£©Download plugin package
2) Exit Eclipse App
3) Unzip the plugin and copy it to ..\Eclipse\plugins
4) Restart Eclipse App
J2EE µÄ¿ªÔ´Æ½Ì¨
Eclipse+Tomcat+Lombez+MyEclipse
MyEclipse: MyEclipseEnterpriseWorkbeachInstall , °²×°µ½Ä¿Â¼Eclipse ϲſÉÒÔÕý³£Ê¹Óá£
Servlet ......