Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java¶ÁÎļþ

import java.io.*;
public class FileReaderSample {
  public static void main(String args[]) throws IOException
  {
    // ½¨Á¢¿ÉÈÝÄÉ1024¸ö×Ö·ûµÄÊý×é
    char data[]=new char[1024];
    // ½¨Á¢¶ÔÏófr
    FileReader fr=new FileReader("c:\\Java\\donkey.txt");
    // ½«Êý¾Ý¶ÁÈë×Ö·ûÁбídataÄÚ
    int num=fr.read(data);
    // ½«×Ö·ûÁбíת»»³É×Ö·û´®
    String str=new String(data,0,num);
    // Êä³öÔÚ¿ØÖÆ̨
    System.out.println("Characters read= "+num);
    System.out.println(str);
    fr.close();
  }
}
ʾÀý¶þ£º
    FileReader fr = null;
    BufferedReader brd = null;
    fr = new FileReader("c:\\h\\test.xml");
    brd = new BufferedReader( fr );//×Ö·ûÁ÷ûÓÐÉèÖñàÂë¡£¡£¡£¡£¡£
    while (brd.readLine() != null {
        String fileline = brd.readLine();
        out.println(fileline);
    }


Ïà¹ØÎĵµ£º

javaÎļþÏÂÔصļ¸ÖÖ·½Ê½

//JavaÎļþÏÂÔصļ¸ÖÖ·½Ê½  
 
    public HttpServletResponse download(String path, HttpServletResponse response) {  
        try {  
            // pathÊ ......

java ·¾¶

java(Web)ÖÐÏà¶Ô·¾¶£¬¾ø¶Ô·¾¶ÎÊÌâ×ܽá
    javaÖÐÏà¶Ô·¾¶£¬¾ø¶Ô·¾¶ÎÊÌâ×ܽá
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡————bohemia(³Ç)
Ç°ÑÔ£º
Ç°Ò»¶Îʱ¼ä£¬ÓÉÓÚÔÚ´¦ÀíWebÓ¦ÓÃϵÄÎļþ´´½¨ÓëÒƶ¯µÈ£¬Òò´ËÉæ¼°µ½ºÜ¶à¹ØÓÚjava
ÖÐÏà¶Ô·¾¶£¬¾ø¶Ô·¾¶µÈÎÊÌ⡣ͬʱ£¬¶ÔÓÚWebÓ¦ÓÃÖÐµÄ ......

java±àÂë2

String str = "ÖÐ";
 
 
  String str1 = new String(str.getBytes("gbk"), "ISO8859-1");
  String str2 = new String(str1.getBytes("ISO8859-1"), "gbk");
  System.out.println(str2);  //Êä³ö"ÖÐ" ......

java ²å¼þ¼ÓÔØ

package tao.hai.bing;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
public class LoadJar {
 public static void main(String[] args)
 {
  Syst ......

UvaOJ javaÊäÈë´úÂë

1. byte Èç¹ûûÓи³Öµ£¬ÄÇôjava»á×Ô¶¯½«Ëü¸³ÖµÎª £¨byte£©0;
static String ReadLn (int maxLg) // utility function to read from stdin
{
byte lin[] = new byte [maxLg];
int lg = 0, car = -1;
String line = "";
try
{
while (lg < maxLg)
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ