Java ÊäÈë/Êä³ö
ÔÚjavaÓïÑÔÖУ¬I/OµÄ·½Ê½ÊÇÁ÷µÄ·½Ê½¡£Á÷£¨stream£©ÕâÊǸöѧϰjavaÊäÈëÊä³öµÄ×î»ù±¾µÄ¸ÅÄî¡£Á÷ÊÇ×Ö½Ú´ÓÔ´µ½Ä¿µÄµÄÓÐÐòÐòÁС£Ò»·½ÃæÊÇ×Ö½Ú£¬Ò»·½ÃæÊÇÓÐÐòµÄ¡£Á÷ÃèÊöµÄÊÇÒ»¸ö¹ý³Ì£¬Ë³ÐòÑϸñ¡£Ò»¸öÐèÒª¼üÅÌÊäÈëµÄ³ÌÐò¿ÉÒÔÓÃÁ÷À´×öµ½ÕâÒ»µã¡£Á½ÖÖ»ù±¾µÄÁ÷ÊÇ£ºÊäÈëÁ÷ºÍÊä³öÁ÷¡£Äã¿ÉÒÔ´ÓÊäÈëÁ÷¶Á£¬µ«Äã²»ÄܶÔËüд¡£Òª´ÓÊäÈëÁ÷¶ÁÈ¡×Ö½Ú£¬±ØÐëÓÐÒ»¸öÓëÕâ¸öÁ÷Ïà¹ØÁªµÄ×Ö·ûÔ´¡£ÕâЩ¶«Î÷¶¼·ÅÔÚjava.io.*Õâ¸ö°üÀïÁË¡£ioÊÇjavaµÄµÚÒ»´ó°ü¡£ÔÚjava.io °üÖУ¬ÓÐһЩÁ÷ÊǽáµãÁ÷£¬¼´ËüÃÇ¿ÉÒÔ´ÓÒ»¸öÌض¨µÄµØ·½¶Áд£¬ÀýÈç´ÅÅÌ»òÕßÒ»¿éÄÚ´æ¡£ÆäËûÁ÷³Æ×÷¹ýÂËÁ÷¡£Ò»¸ö¹ýÂËÆ÷ÊäÈëÁ÷ÊÇÓÃÒ»¸öµ½ÒÑ´æÔÚµÄÊäÈëÁ÷µÄÁ¬½Ó´´½¨µÄ¡£´Ëºó£¬µ±ÄãÊÔͼ´Ó¹ýÂËÊäÈëÁ÷¶ÔÏó¶Áʱ£¬ËüÏòÄãÌṩÀ´×ÔÁíÒ»¸öÊäÈëÁ÷¶ÔÏóµÄ×Ö·û¡£
³£¼ûµÄ¼¸ÖÖÁ÷£º
×Ö½ÚÁ÷£º´«×ֽڵġ£ÒÔ8λ×Ö½ÚΪµ¥Î»½øÐжÁд£¬ÒÔInputStreamÓëOutputStreamΪ»ù´¡Àà
×Ö·ûÁ÷: ´«×Ö·ûµÄ¡£ÒÔ16λ×Ö·ûΪµ¥Î»½øÐжÁд£¬ÒÔReaderÓëWriterΪ»ù´¡Àà
ÎļþÁ÷: ´«ÎļþµÄ¡£ÊôÓÚ½ÚµãÁ÷£¬¶ÔÎļþ¶Áд£¬´«Êä¡£ÀïÃæµÄÀàºÜ¶à¡£
ÐòÁл¯£º´«¶ÔÏóµÄ¡£Ò»¸ö¶ÔÏóÔõô¶Á°¡£¬Ö»Óбä³É¶þ½øÖƲſÉÒÔ¶Á£¬Õâ¾ÍÊÇÐòÁл¯¡£
ʵ¼ù£º //ÕâÊÇÒ»¸ö×Ö½ÚÁ÷µÄÀý×Ó£¬ÒÔInputStreamÓëOutputStreamΪ»ù´¡Àà
import java.io.*;
class ByteArrayOutputStreamDemo {
public static void main(String args[]) throws IOException {
ByteArrayOutputStream f = new ByteArrayOutputStream();
String s = "This should end up in the array";
byte buf[] = s.getBytes();
f.write(buf);
System.out.println("Buffer as a string");
System.out.println(f.toString());
System.out.println("Into array");
byte b[] = f.toByteArray();
for (int i=0; i<b.length; i++) {
System.out.print((char) b[i]);}
System.out.println("\nTo an OutputStream()");
//Êä³öµ½Îļþtest.txtÖÐ
OutputStream f2 = new FileOutputStream("test.txt");
f.writeTo(f2);
f2.close();
System.out.println("Doing a reset");
f.reset();
for (int i=0; i<3; i++)
f.write('X');
System.out.println(f.toString());}}
//×Ö·ûÁ÷µÄÀý×Ó£¬ÒÔReaderÓëWriterΪ»ù´¡Àà
import java.io.*;
public class CharArrayReaderDemo {
public static void main(String args[]) throws IOException {
String tmp = "abcdefghijklmnopqrstuvwxyz";
int length = tmp.length();
cha
Ïà¹ØÎĵµ£º
ÖíÄêÎÞÁÄ,¸ÄÁËÒ»¸ö´úÂ룬ÓеãD°æÄǸöÒâ˼£¬°ÑWAP PUSHµÄC#´úÂë¸Äµ½ÁËJAVA
ÔÀ´³ö´¦£º
http://www.codeproject.com/cs/internet/wappush.asp
¸Ä¹ýºóµÄ´úÂëÔÚÏÂÃ棬³ÌÐòºÃÏñ¿ÉÒÔÊä³öÁËWAPPUSHµÄ½á¹¹»¯µÄ¶«Î÷£¬µ«ÊÇ£¬Ã»ÓÐÔÚCMPPÐÒéÉϲâÊÔͨ¹ý¡£
¹²7¸öÎļþ£º
package com.wap.wbxml;
public class Runner {
&nbs ......
Javaѧϰ·¾¶£¨Ò»£©¹¤¾ßƪ
Ò»¡¢ JDK (Java Development Kit)
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJDKÊÇSun¹«Ë¾·¢²¼µÄJDK£¬³ýÁËSunÖ®Í⣬»¹Óкܶ๠......
1.JavaµÄ±àÒëÔËÐÐ
JavaÖеÄpackage¸ÅÄîÏ൱ÓÚC++ÖеÄnamespaceµÄ¸ÅÄî¡£µ«ÊÇjava»á°ÑpackageµÄÃû×ÖºÍÎļþϵͳÖÐĿ¼½á¹¹¶ÔÓ¦ÆðÀ´£¬Ò²¼´Èç¹ûÄãÉêÃ÷ÁËij¸öpackageµÄÃû×ÖΪcom.tij.everythingisobj£¬ÄÇôÄãµÄÎļþϵͳÖбØÐë´´½¨com\tij\everythingisobjÕâÑùÒ»¸ö ......
package cf.java.study.java.io;
import java.io.File;
import java.io.FileInputStream;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class FileTests {
@Before
public void set ......
-
JavaÊÇÓÉSun Microsystems¹«Ë¾ÓÚ1995Äê5ÔÂÍƳöµÄJava³ÌÐòÉè¼ÆÓïÑÔ£¨ÒÔϼò³ÆJavaÓïÑÔ£©ºÍJavaƽ̨µÄ×ܳơ£ÓÃJavaʵÏÖµÄHotJavaä¯ÀÀÆ÷£¨Ö§³ÖJava applet£©ÏÔʾÁËJavaµÄ÷ÈÁ¦£º¿çƽ̨¡¢¶¯Ì¬µÄWeb¡¢Internet¼ÆËã¡£´Ó´Ë£¬Java±»¹ã·º½ÓÊܲ¢Íƶ¯ÁËWebµÄѸËÙ·¢Õ¹£¬³£ÓõÄä¯ÀÀÆ÷ÏÖÔÚ¾ùÖ§³ÖJava applet¡£ÁíÒ»·½Ã棬Java¼¼ÊõÒ ......