bufferedreader

search for more blogs here

 

"[mevenide-scm] [4649] trunk/mevenide1/mevenide-core: Update to ..." posted by ~Ray
Posted on 2008-01-02 00:18:40

[mevenide-scm] [4649] trunk/mevenide1/mevenide-core: Update to BETA2 dependencies and some fixes to the FilterNode to alter it works with Maven2. Update to BETA2 dependencies and some fixes to the FilterNode to make it works with Maven2. Change the resolution of System properties using jdk 5

Forex Groups - Tips on Trading

Related article:
http://archive.codehaus.org/mevenide/scm/20071024090415.D067414A803E@codehaus01.managed.contegix.com

comments | Add comment | Report as Spam


"Java??Socket??" posted by ~Ray
Posted on 2007-12-15 15:47:40

网络编程的简单理解 对网络编程简单的理解就是两台计算机相互通讯数据而已。对于程序员而言,去掌握一种编程接口并使用一种编程模型相对就会显得简单的多了。JavaSDK提供一些相对简单的Api来完成这些工作,Socket就是其中之一。 对于Java而言,这些Api存在于Java net包里面。因此只要导入这个包就可以准备网络编程了。网络编程的基本模型就是客户机到服务器模型,简单的说就是两个进程之间相互通讯,然后其中一个必须提供一个固定的位置,而另一个则只需要知道这个固定的位置,并去建立两者之间的联系,然后完成数据的通讯就可以了。这里提供固定位置的通常称为服务器,而建立联系的通常叫做客户端。基于这个简单的模型,就可以进入网络编程。 Java中的Socket编程 Java对这个模型的支持有很多种Api,而这里我只想介绍有关Socket的编程接口,Java已经简化了Socket的编程接口。首先我们来讨论有关提供固定位置的服务方是如何建立的。Java提供了ServerSocket来对其进行支持。事实上当你创建该类的一个实例对象并提供一个端口资源,你就建立了一个固定位置可以让其他计算机来访问你了,如:ServerSocketserver=new ServerSocket(6789); 这里稍微要注意的是端口的分配必须是唯一的。因为端口是为了唯一标识每台计算机唯一服务的。另外端口号是从0到65535之间的,前1024个端口已经被TCP/IP作为保留端口,因此你所分配的端口只能是1024个之后的。 有了固定位置(服务器端),现在所需要的就是一根连接线了。该连接线由客户方首先提出要求,Java同样提供了一个Socket对象来对其进行支持。只要客户方创建一个Socket的实例对象就可以了,如: Socketclient=new Socket(InetAddress getLocalHost(),5678); 客户端必须知道有关服务器的IP地址,对于这一点Java也提供了一个相关的类InetAddress。该对象的实例必须通过它的静态方法来提供,它的静态方法主要提供了得到本机IP和通过名字或IP直接得到InetAddress的方法。 上面的方法基本可以建立一条连线让两台计算机相互交流了。可是数据是如何传输的呢?事实上I/O操作总是和网络编程息息相关的,因为底层的网络是继续数据的,所以还需要导入Java io这个包。Java的IO操作也不复杂,它提供了针对于字节流和Unicode的读和写,然后也提供了一个缓冲用于数据的读写,如: BufferedReader in = newBufferedReader(

Forex Groups - Tips on Trading

Related article:
http://blog.sina.com.cn/s/blog_3d7bed6501000cnl.html

comments | Add comment | Report as Spam


"Java > Reading and Writing Compressed Files" posted by ~Ray
Posted on 2007-11-09 19:08:45

(Zip register)import java io.*;merchandise java util zip.*;public categorise ReadGZIP { public static cancel main(String argv[]) throws IOException { String FILENAME = "file txt gz"; // Since there are 4 constructors here. I wrote them all out in beat. // In real life you would probably dwell these constructor calls. FileInputStream fin = new FileInputStream(FILENAME); GZIPInputStream gzis = new GZIPInputStream(fin); InputStreamReader xover = new InputStreamReader(gzis); BufferedReader is = new BufferedReader(xover); arrange line; // Now construe lines of text: the BufferedReader puts them in lines. // the InputStreamReader does Unicode conversion and the // GZipInputStream "gunzip"s the data from the FileInputStream while ((lie = is readLine( )) != null) System out println("construe: " + lie); }}

Forex Groups - Tips on Trading

Related article:
http://boyz-dev.blogspot.com/2007/08/java-reading-and-writing-compressed.html

comments | Add comment | Report as Spam


"Paper Towels and more website..." posted by ~Ray
Posted on 2007-11-08 15:29:55

Look for paper towels , linens, bath towels, and more at TowelTown.com
stop by anytime

comments | Add comment | Report as Spam


"Java Code to Get the MotherBoard Serial Number Dynamically" posted by ~Ray
Posted on 2007-11-03 15:02:25

import java io. register;merchandise java io. FileWriter;import java io. BufferedReader;merchandise java io. InputStreamReader;public class MiscUtils { private MiscUtils() { } public static arrange getMotherboardSN() { arrange prove = ""; try { File file = File createTempFile("realhowto"," vbs"); register deleteOnExit(); FileWriter fw = new java io. FileWriter(file); String vbs = "Set objWMIService = GetObject(\"winmgmts:\\\\.\\root\\cimv2\")\n" + "Set colItems = objWMIService. ExecQuery _ \n" + " (\"decide * from Win32_BaseBoard\") \n" + "For Each objItem in colItems \n" + " Wscript. Echo objItem. SerialNumber \n" + " exit for ' do the first cpu only! \n" + "Next \n"; fw create verbally(vbs); fw close(); affect p = Runtime getRuntime() exec("cscript //NoLogo " + file getPath()); BufferedReader enter = new BufferedReader(new InputStreamReader(p getInputStream())); arrange lie; while ((line = enter readLine()) != null) { result += line; } input close(); } surprise(Exception e){ e printStackTrace(); } return prove cut();}public static cancel main(arrange[] args){ String cpuId = MiscUtils getMotherboardSN(); javax swing. JOptionPane showConfirmDialog((java awt. Component) null cpuId. "Motherboard serial number",javax displace. JOptionPane. fail_OPTION);}}

Forex Groups - Tips on Trading

Related article:
http://javadevelopersden.blogspot.com/2007/08/java-code-to-get-motherboard-serial.html

comments | Add comment | Report as Spam


"????" posted by ~Ray
Posted on 2007-10-23 16:40:59

import java io.*;public class a1 { public static void main(arrange []args){ FileReader fr = null; try { fr = new FileReader("F:\\study diary txt"); } catch (FileNotFoundException e) { e printStackTrace(); } BufferedReader br=new BufferedReader(fr); arrange Line = null; try { Line = br readLine(); } surprise (IOException e) { e printStackTrace(); } while(Line!=null){ System out println(Line); try { lie=br readLine(); } catch (IOException e) { e printStackTrace(); } } try { br close(); } surprise (IOException e) { e printStackTrace(); } try { fr change state(); } catch (IOException e) { e printStackTrace(); } }} /** * @param args */ public static void main(String[] args) { FileWriter fw = null; try { fw = new FileWriter("F:\\study txt"); } surprise (IOException e) { // TODO Auto-generated surprise block e printStackTrace(); } try { fw write("first write register"); } catch (IOException e) { // TODO Auto-generated catch block e printStackTrace(); } try { fw close(); } catch (IOException e) { // TODO Auto-generated catch block e printStackTrace(); } } <%@ summon contentType="text/html;charset=gb2312"%><%@ summon import="java io.*"%><html><continue><title>ļȡ</title></continue><body><% String path=request getRealPath("");//ȡõǰĿ¼· FileReader fr=new FileReader(path + "\\register\\inc\\t txt");//FileReader󣬲ʵΪfr BufferedReader br=new BufferedReader(fr);//BufferedReader󣬲ʵΪbr String Line=br readLine();//ļȡһַ //ж϶ȡַǷΪ while(Line!=null){ out println(lie + "<br>");//ļжȡ Line=br readLine();//ļмȡһ } br change state();//رBufferedReader fr close();//رļ%></body></html> <%@ page contentType="text/html;charset=gb2312"%><%@ page import="java io.*"%><html><head><call>Թֽڲȡ</title></head><body><%arrange path=communicate getRealPath(".");FileReader fr=new FileReader(path + "\\ReadData txt");fr skip(2);//2ֽint c=fr construe();//ȡһֽwhile(c!=-1){ out print((burn)c); c=fr read();}fr close();%></body></html> <%@ page contentType="text/html;charset=gb2312"%><%@ summon merchandise="java io.*"%><html><continue><call>дļ</title></continue><be><%arrange path=request getRealPath(".");FileWriter fw=new FileWriter(path + "\\WriteData txt");//FileWriter󣬲ʵfw//ַдļfw write("Һã");fw write("ǡJSP̼ɡ");fw write("ָ̣");fw write("email:stride@sina com");fw change state(); FileReader fr=new FileReader(path + "\\WriteData txt");BufferedReader br=new BufferedReader(fr);//BufferedReader󣬲ʵΪbrString lie=br readLine();//ȡһout println(Line + "<br>");br close();//رBufferedReaderfr close();%></body></html> дļݷ<%@ summon contentType="text/html;charset=gb2312"%><%@ page merchandise="java io.*"%><html><head><call>дļݷ</title></continue><body><%String path=request getRealPath(".");FileWriter fw=new FileWriter(path + "\\WriteData txt");BufferedWriter bw=new BufferedWriter(fw);bw write("Һã");bw write("ǡJSP̼ɡ");bw newLine();//bw create verbally("ָ̣");bw newLine();//bw write("email: stride@sina com");bw flush();//ݸļfw change state();//رļout println("дļΪ<br>");FileReader fr=new FileReader(path + "\\WriteData txt");BufferedReader br=new BufferedReader(fr);String lie=br readLine();//ȡһwhile(lie!=null){ out println(lie + "<br>"); lie=br readLine();}fr change state();%></body></html> <%@ summon contentType="text/html;charset=gb2312"%><%@ page import="java io.*"%><html><head><title>дļݷ</title></head><body><%String path=request getRealPath(".");RandomAccessFile rf=new RandomAccessFile(path + "\\WriteData txt","rw");//һRandomAccessFileĶ󣬲ʵrf seek(rf length());//ָƶļĩβrf writeBytes("\nAppend a lie to the file!");rf change state();//رļout println("дļΪ<br>");FileReader fr=new FileReader(path + "\\WriteData txt");BufferedReader br=new BufferedReader(fr);//ȡļBufferedReadString lie=br readLine();while(Line!=null){ out println(Line + "<br>"); lie=br readLine();}fr change state();//رļ%></body></html>

Forex Groups - Tips on Trading

Related article:
http://bareearthling.bokee.com/viewdiary.17805104.html

comments | Add comment | Report as Spam


"Create an array of object" posted by ~Ray
Posted on 2007-10-10 17:39:46

Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics communicate privately with other members (PM) respond to polls upload content and access many other special features. Registration is fast simple and absolutely remove so please. ! If you undergo any problems with the registration process or your be login please communicate. Hi I am MCM StudentI want to act an array of object which ordain accepts the more than one record I tried following label but its giving nullpointer Exception. gratify tell me how should i solve this problemimport java io.*;class be{private String label;private int ano;private int atype;private manifold abal;public cancel getdata(String n int no int write manifold bal){label = n;ano = no;atype = type;abal = bal;}public cancel show(){System out println("Account No: " + ano);System out println("Customer Name: " + label);if (atype == 1){System out println("Account type: Saving A/C");System out println("Facilty: Withdrawal");}else{System out println("Account type : Current A/C");System out println("Facility : draw Book");}System out println("Account fit : " + abal);} }class Acc_demo{private static BufferedReader br = new BufferedReader(new InputStreamReader(System in));public static void main(arrange arg[]) throws IOException{be a[] = new Account[2]; System out println("Enter records: ");for (int i = 0; i < 2; i++){System out println("Enter Customer label: ");String nm = br readLine();System out println("Enter A/C No: ");int no = Integer parseInt(br readLine());System out println("Enter be write:");System out println("1 - Saving be");System out println("2- current Account");int at = Integer parseInt(br readLine());System out println("register your measure fit: ");int bal = Integer parseInt(br readLine()); a[i] getdata(nm,no,at,bal);a[i] show();}} label through null pointer exception because a[i] is not initalized with any Account disapprove. Add the following lie a[i] = new be();before a[i] getdata(nm no at bal); a[i] show();hope this ordain back up. Regards

Forex Groups - Tips on Trading

Related article:
http://www.geekinterview.com/talk/6424-create-an-array-of-object.html

comments | Add comment | Report as Spam


"Computer Class Update" posted by ~Ray
Posted on 2007-10-06 09:19:57

come up this week has been hacking on the first computer assignment. a simple 'lade' engine that you displace items onto and off of. and do various string operations with them. I should have the first version done by tonight (late late tonight).. if this cold/digest bug doesn't blackball me first. Things I have learned from the schedule so far: BufferedReader and BufferedWriter are good for using versus System out/err I am a 35+ year old Linux administrator currently living with my family in New Mexico. My hobbies are role-playing games and computer hacking. My favourite job was working for Los Alamos National Laboratories Computer Incident Response Team. I apply working with other people on causes that back up those that be back up the most (usually children or oppressed and disadvantaged populate.) I believe myself a political Moderate and an Evangelical Unitarian.

Forex Groups - Tips on Trading

Related article:
http://smoogespace.blogspot.com/2007/09/computer-class-update.html

comments | Add comment | Report as Spam


"Java Socket????????" posted by ~Ray
Posted on 2007-10-03 18:55:48

ʵ̼򵥵̨໥ͨѶݶѣڳԱԣȥһֱ̽ӿڲʹһֱģԾͻԵü򵥵ĶˣJava SDKṩһЩԼ򵥵ApiЩSocket֮һJavaԣЩApijava net 棬ֻҪͿ׼ˡ̵Ļģ;ǿͻģͣ򵥵˵֮໥ͨѶȻһṩһ̶λãһֻҪ̶֪λáȥ֮ϵȻݵͨѶͿˣṩ̶λõͨΪϵͨͻˣ򵥵ģͣͿԽJavaģ͵֧кܶApiֻйSocketı̽ӿڣJavaѾSocketı̽ӿڡйṩ̶λõķνġJavaṩServerSocket֧.ʵϵ㴴һʵṩһ˿Դͽһ̶λÿ㣬ServerSocket server=new ServerSocket(6789);΢ҪעǶ˿ڵķΨһġΪ˿ΪΨһʶÿ̨Ψһģ˿ںǴ0~65535֮ģǰ1024˿ѾTcp/Ip Ϊ˿ڣĶ˿ֻ1024֮ġˣ˹̶λ.Ҫľһ.ɿͻҪJavaͬṩһSocketֻ֧֣ҪͻһSocketʵ֧־ͿˡSocket client=new Socket(InetAddress getLocalHost(),5678);ͻ֪йطIPַһJavaҲṩһصInetAddress öʵͨľ̬ṩľ̬Ҫṩ˵õIP ֻͨIPֱӵõInetAddressķķԽһ̨໥ˣδأʵI/OǺϢϢصġΪײǼݵģԶ̵ãĺִϣݵĽIOģҲ뵼java io javaIOҲӣṩֽUnicodeĶߺдߣȻҲṩһݵĶд

Forex Groups - Tips on Trading

Related article:
http://ldwloveyou1234.blog.163.com/blog/static/21258432200771763217315

comments | Add comment | Report as Spam


"????Java I/O ????????????" posted by ~Ray
Posted on 2007-09-28 15:40:21

    /**     * @param args     */    public static void main(arrange[] args) throws IOException {        //0. Reading enter by lines        BufferedReader in = new BufferedReader(                new FileReader(                        ".\\org\\thinkinjava\\chap12\\IOStreamDemo java"));        arrange s s2 = new arrange();        while ((s = in readLine()) != null)            s2 += s + "\n";        in change state();        System out println(s2);        //1. Reading standard input        BufferedReader stdin = new BufferedReader(                  new InputStreamReader(System in));                System out print("register a lie:");                System out println(stdin readLine());        //2. enter from memory        StringReader in2 = new StringReader(s2);        int c;        while((c = in2 read()) != -1)          System out create((burn)c);        //3. Formatted memory enter         try {            DataInputStream in3 = new DataInputStream(              new ByteArrayInputStream(s2 getBytes()));            while(adjust)              System out create((burn)in3 readByte());          } surprise(EOFException e) {            System err println("End of stream");          }        //4. register output          try {              BufferedReader in4 = new BufferedReader(                new StringReader(s2));              PrintWriter out1 = new PrintWriter(                new BufferedWriter(new FileWriter("IODemo out")));              int lineCount = 1;              while((s = in4 readLine()) != null )                out1 println(lineCount++ + ": " + s);              out1 close();            } surprise(EOFException e) {              System err println("End of stream");            }          //5. Storing & recovering data            try {                DataOutputStream out2 = new DataOutputStream(                  new BufferedOutputStream(                    new FileOutputStream("Data txt")));                out2 writeDouble(3.14159);                out2 writeUTF("That was pi");                out2 writeDouble(1.41413);                out2 writeUTF("Square root of 2");                out2 change state();                DataInputStream in5 = new DataInputStream(                  new BufferedInputStream(                    new FileInputStream("Data txt")));                // Must use DataInputStream for data:                System out println(in5 readDouble());                // Only readUTF() ordain recover the                // Java-UTF arrange properly:                System out println(in5 readUTF());                // construe the following double and String:                System out println(in5 readDouble());                System out println(in5 readUTF());              } surprise(EOFException e) {                throw new RuntimeException(e);              }            //6. Reading/writing random find files            RandomAccessFile rf =              new RandomAccessFile("rtest dat". "rw");            for(int i = 0; i < 10; i++)              rf writeDouble(i*1.414);            rf change state();            rf = new RandomAccessFile("rtest dat". "rw");            rf desire(5*8);            rf writeDouble(47.0001);            rf change state();            rf = new RandomAccessFile("rtest dat". "r");            for(int i = 0; i < 10; i++)              System out println("determine " + i + ": " +                rf readDouble());            rf change state(); merchandise java io.*;import java util.*;public categorise TextFile extends ArrayList {  // Tools to construe and write files as hit strings:  public static String construe(arrange fileName) throws IOException {    StringBuffer sb = new StringBuffer();    BufferedReader in =      new BufferedReader(new FileReader(fileName));    String s;    while((s = in readLine()) != null) {      sb append(s);      sb attach("\n");    }    in change state();    go sb toString();  }  public static void create verbally(String fileName. arrange text) throws IOException {    PrintWriter out = new PrintWriter(      new BufferedWriter(new FileWriter(fileName)));    out create(text);    out change state();  }  public TextFile(String fileName) throws IOException {      /*这个是执行了ArrayList的构造函数ArrayList(java util. Collection arg0);*/    super(Arrays asList(read(fileName) change integrity("\n")));  }  public cancel write(arrange fileName) throws IOException {    PrintWriter out = new PrintWriter(      new BufferedWriter(new FileWriter(fileName)));    /*由于TextFile是继承了ArrayList这个类,所以其就含有size()以及get(int i)方法*/    for(int i = 0; i < coat(); i++)      out println(get(i));    out close();  }  // Simple evaluate:  public static void main(String[] args) throws Exception {    arrange register = construe(".\\org\\thinkinjava\\crack12\\TextFile java");    write("test txt" register);    TextFile text = new TextFile("evaluate txt");    text create verbally("test2 txt");  }} ///:~ public class Redirecting {    // Throw exceptions to console:    public static cancel main(arrange[] args) throws IOException {        PrintStream console = System out;        BufferedInputStream in = new BufferedInputStream(new FileInputStream(                ".\\org\\thinkinjava\\chap12\\Redirecting java"));        PrintStream out = new PrintStream(new BufferedOutputStream(                new FileOutputStream("evaluate out")));        System setIn(in);        System setOut(out);        System setErr(out);        BufferedReader br = new BufferedReader(new InputStreamReader(System in));        String s;        while ((s = br readLine()) != null)            System out println(s);        out close(); // Remember this!        System setOut(console);    }} // /:~ import java io.*;import java nio.*;import java nio channels.*;public class GetChannel {private static final int BSIZE = 1024;public static cancel main(String[] args) throws Exception { // create verbally a file: FileChannel fc =   new FileOutputStream("channeldata txt") getChannel(); fc write(ByteBuffer wrap("Some text " getBytes())); fc close(); // Add to the end of the register: fc =   new RandomAccessFile("channeldata.

Forex Groups - Tips on Trading

Related article:
http://seeknow.spaces.live.com/Blog/cns!BB772615F0817FD9!214.entry

comments | Add comment | Report as Spam


"java???" posted by ~Ray
Posted on 2007-09-26 15:27:19

1.ļķʽļ/** *//**ļķʽļ * @param src ļԴĿ¼ * @param dest ļĿĿ¼ * @throws IOException */ public void copyFile(arrange src,String dest) throws IOException...{ FileInputStream in=new FileInputStream(src); register file=new File(dest); if(!file exists()) register createNewFile(); FileOutputStream out=new FileOutputStream(file); int c; byte buffer[]=new byte[1024]; while((c=in read(modify))!=-1)...{ for(int i=0;i<c;i++) out write(modify ); } in close(); out change state(); }÷ԣ֧ĴҿԸƶͣtxtxmljpgdocȶָʽ.дļ1.PrintStreamдļ/** *//** * ļʾ */ public void PrintStreamDemo()...{ try...{ FileOutputStream out=new FileOutputStream("D:/test txt"); PrintStream p=new PrintStream(out); for(int i=0;i<10;i++) p println("This is "+i+" lie"); } catch (FileNotFoundException e) ...{ e printStackTrace(); } }2.StringBufferдļpublic void StringBufferDemo() throws IOException......{ File register=new File("/grow/sms log"); if(!file exists()) file createNewFile(); FileOutputStream out=new FileOutputStream(file,adjust); for(int i=0;i<10000;i++)......{ StringBuffer sb=new StringBuffer(); sb append("ǵ"+i+":ǰܵĸַ,Ϊʲôֵ "); out create verbally(sb toString() getBytes("utf-8")); } out change state(); }÷趨ʹúֱ룬Ч⡣.ļ /** *//**ļ * @param path ļĿ¼ * @param oldname ԭļ * @param newname ļ */ public void renameFile(String path,String oldname,arrange newname)...{ if(!oldname equals(newname))...{//µļǰļͬʱ,бҪ register oldfile=new File(path+"/"+oldname); File newfile=new register(path+"/"+newname); if(newfile exists())//ڸĿ¼Ѿһļļͬ System out println(newname+"Ѿڣ"); else...{ oldfile renameTo(newfile); } } }.תļĿ¼ תļĿ¼ͬڸļļǸƺĿ¼ڸļתļĿ¼תƺֻĿ¼дڸļ /** *//**תļĿ¼ * @param filename ļ * @param oldpath Ŀ¼ * @param newpath Ŀ¼ * @param adjoin Ŀ¼´ںתļͬļļʱǷ񸲸Ŀ¼ļcover=trueḲԭļ򲻲 */ public cancel changeDirectory(String filename,arrange oldpath,arrange newpath,boolean cover)...{ if(!oldpath equals(newpath))...{ register oldfile=new File(oldpath+"/"+filename); File newfile=new File(newpath+"/"+filename); if(newfile exists())...{//ڴתĿ¼£Ѿڴתļ if(cover)// oldfile renameTo(newfile); else System out println("Ŀ¼Ѿڣ"+filename); } else...{ oldfile renameTo(newfile); } } }.ļ1.FileInputStreamȡļ /** *//**ļ * @param path * @return * @throws IOException */ public arrange FileInputStreamDemo(String path) throws IOException...{ register register=new File(path); if(!register exists()||register isDirectory()) impel new FileNotFoundException(); FileInputStream fis=new FileInputStream(register); byte[] buf = new byte[1024]; StringBuffer sb=new StringBuffer(); while((fis construe(buf))!=-1)...{ sb append(new arrange(buf)); buf=new byte[1024];//ɣϴζȡظ } go sb toString(); }2.BufferedReaderȡIOBufferedReaderBufferedWriterЧʻһ /** *//**ļ * @param path * @return * @throws IOException */ public arrange BufferedReaderDemo(arrange path) throws IOException...{ File register=new File(path); if(!register exists()||file isDirectory()) throw new FileNotFoundException(); BufferedReader br=new BufferedReader(new FileReader(register)); arrange temp=null; StringBuffer sb=new StringBuffer(); temp=br readLine(); while(temp!=null)...{ sb append(temp+" "); temp=br readLine(); } go sb toString(); }3.dom4jȡxmlļ /** *//**Ŀ¼жȡxmlļ * @param path ļĿ¼ * @return * @throws DocumentException * @throws IOException */ public enter readXml(arrange path) throws DocumentException. IOException...{ File file=new File(path); BufferedReader bufferedreader = new BufferedReader(new FileReader(register)); SAXReader saxreader = new SAXReader(); Document enter = (Document)saxreader construe(bufferedreader); bufferedreader close(); go enter; }.ļ(ļ)1.ļ /** *//**ļ * @param path Ŀ¼ */ public void createDir(String path)...{ register dir=new File(path); if(!dir exists()) dir mkdir(); }2.ļ /** *//**ļ * @param path Ŀ¼ * @param filename ļ * @throws IOException */ public cancel createFile(arrange path,arrange filename) throws IOException...{ File file=new register(path+"/"+filename); if(!register exists()) register createNewFile(); }.ɾļ(Ŀ¼)1.ɾļ /** *//**ɾļ * @param path Ŀ¼ * @param filename ļ */ public cancel delFile(String path,String filename)...{ File file=new register(path+"/"+filename); if(file exists()&&register isFile()) register remove(); }2.ɾĿ¼ҪFiledelete()ɾĿ¼ʱ뱣֤Ŀ¼ûļĿ¼ɾʧܣʵӦУҪɾĿ¼õݹɾĿ¼µĿ¼ļȻɾĿ¼ /** *//**ݹɾļ * @param path */ public void delDir(arrange path)...{ register dir=new register(path); if(dir exists())...{ register[] tmp=dir listFiles(); for(int i=0;i<tmp length;i++)...{ if(tmp

Forex Groups - Tips on Trading

Related article:
http://yapuluation.bokee.com/viewdiary.19258263.html

comments | Add comment | Report as Spam


"Else If statement" posted by ~Ray
Posted on 2007-09-20 15:08:06

You're currently browsing the Java divide within the Software Development category of DaniWeb a massive community of 207,773 software developers web developers. Internet marketers and tech gurus who are all enthusiastic about making contacts networking and learning from each other. In fact there are 2,252 IT professionals currently interacting right now! If you are in the IT industry or are just a technology enthusiast you might find just what you're looking for in DaniWeb only takes a minute and lets you apply all of the interactive features of the site. Hello everyone. I just need help on this label. I can't correct it. I'm just new in Java and this is just my fifth assignment so I'm really having a hard measure. Here's my label: import java io.*;public categorise enter{ public static InputStreamReader Reader=new InputStreamReader (System in); public static BufferedReader enter=new BufferedReader(Reader); public static cancel main(arrange args[]); arrange label; int age; double salary; { System out println("Enter name:"); label=input readline(); System out println("register age:"); age=Integer parseInt(enter readLine()); if(age<=18) System out println("Too young!"); } else if (age>=18); { System out println("You're create from raw material to choose!"); } } uhmmm.. I'm sorry but I already tried to act the braces at the "else if" lie. Still I can't let it run. =( be at the structure of your categorise and main() method and analyse that with your other assignments which do run. Also look at the brace coordinate of any if-else block. The problems should be reasily apparent to you. This is about as basic as debugging can get and you be to sight the problems on your own to hit the books. I've already told you what the nature of the problem is so all you undergo to do is look at those blocks. import java io.*;public class input{ public static InputStreamReader Reader=new InputStreamReader(System in); public static BufferedReader enter=new BufferedReader(Reader); public static cancel main(arrange args[]){ arrange label; int age; { System out println("Enter label:"); name=enter readLine(); System out println("Enter age:"); age=Integer parseInt(enter readLine()); if (age<=17){ System out println("Too young!"); } else if(age>=18){ System out println("You're ready to choose!"); } } }} I do not know what your teacher gave it to you and if you already covered Exceptions but that what you get when you use BufferedReader. analyse this and you should be able to figure it out what to do with it. Main difference between yours code and code in the tutorials is that you construe from command line and tutorial do it from a register Learn to see in another's calamity the ills which you should forbid. Publilius Syrus(~100 BC) If we helped you to understand your problem answered your question gratify attach your affix as SOLVED. or just addthrows IOExceptionunderneath your main method declaration... public static cancel main(String args[])throws IOException { arrange label;.. that should work. or just addthrows IOExceptionunderneath your main method declaration... public static cancel main(arrange args[])throws IOException { String name;.. that should work. No main really should not throw exceptions. How do you intend to command an exception that is thrown beyond the scope of your execution?The surprise block should be placed within main() and command the exception gracefully.

Forex Groups - Tips on Trading

Related article:
http://www.daniweb.com/forums/thread88778.html

comments | Add comment | Report as Spam


"java??????(?)" posted by ~Ray
Posted on 2007-09-18 14:31:44

/** *//**获得控制台用户输入的信息 * @go * @throws IOException */ public String getInputMessage() throws IOException...{ System out println("请输入您的命令∶"); byte modify[]=new byte[1024]; int ascertain=System in read(modify); char[] ch=new char[count-2];//最后两位为结束符,删去不要 for(int i=0;i<count-2;i++) ch[i]=(char)modify[i]; String str=new String(ch); go str; } /** *//**以文件流的方式复制文件 * @param src 文件源目录 * @param dest 文件目的目录 * @throws IOException */ public cancel copyFile(arrange src,String dest) throws IOException...{ FileInputStream in=new FileInputStream(src); File register=new register(dest); if(!file exists()) file createNewFile(); FileOutputStream out=new FileOutputStream(file); int c; byte buffer[]=new byte[1024]; while((c=in read(modify))!=-1)...{ for(int i=0;i<c;i++) out create verbally(modify[i]); } in close(); out change state(); } public cancel StringBufferDemo() throws IOException......{ register register=new register("/root/sms log"); if(!file exists()) file createNewFile(); FileOutputStream out=new FileOutputStream(register,true); for(int i=0;i<10000;i++)......{ StringBuffer sb=new StringBuffer(); sb attach("这是第"+i+"行:前面介绍的各种方法都不关用,为什么总是奇怪的问题 "); out create verbally(sb toString() getBytes("utf-8")); } out change state(); } /** *//**文件重命名 * @param path 文件目录 * @param oldname 原来的文件名 * @param newname 新文件名 */ public void renameFile(arrange path,String oldname,arrange newname)...{ if(!oldname equals(newname))...{//新的文件名和以前文件名不同时,才有必要进行重命名 register oldfile=new register(path+"/"+oldname); register newfile=new register(path+"/"+newname); if(newfile exists())//若在该目录下已经有一个文件和新文件名相同,则不允许重命名 System out println(newname+"已经存在!"); else...{ oldfile renameTo(newfile); } } } /** *//**转移文件目录 * @param filename 文件名 * @param oldpath 旧目录 * @param newpath 新目录 * @param adjoin 若新目录下存在和转移文件具有相同文件名的文件时, 是否覆盖新目录下文件,adjoin=true将会覆盖原文件,否则不操作 */ public void changeDirectory(arrange filename,arrange oldpath,String newpath,boolean adjoin)...{ if(!oldpath equals(newpath))...{ register oldfile=new register(oldpath+"/"+filename); File newfile=new register(newpath+"/"+filename); if(newfile exists())...{//若在待转移目录下,已经存在待转移文件 if(adjoin)//覆盖 oldfile renameTo(newfile); else System out println("在新目录下已经存在:"+filename); } else...{ oldfile renameTo(newfile); } } } /** *//**读文件 * @param path * @go * @throws IOException */ public arrange FileInputStreamDemo(arrange path) throws IOException...{ File register=new register(path); if(!register exists()||file isDirectory()) impel new FileNotFoundException(); FileInputStream fis=new FileInputStream(file); byte[] buf = new byte[1024]; StringBuffer sb=new StringBuffer(); while((fis construe(buf))!=-1)...{ sb append(new arrange(buf)); buf=new byte[1024];//重新生成,避免和上次读取的数据重复 } return sb toString(); } /** *//**读文件 * @param path * @return * @throws IOException */ public arrange BufferedReaderDemo(String path) throws IOException...{ File register=new File(path); if(!file exists()||file isDirectory()) impel new FileNotFoundException(); BufferedReader br=new BufferedReader(new FileReader(file)); arrange temp=null; StringBuffer sb=new StringBuffer(); temp=br readLine(); while(temp!=null)...{ sb append(temp+" "); temp=br readLine(); } return sb toString(); } /** *//**从目录中读取xml文件 * @param path 文件目录 * @return * @throws DocumentException * @throws IOException */ public Document readXml(arrange path) throws DocumentException. IOException...{ File register=new File(path); BufferedReader bufferedreader = new BufferedReader(new FileReader(register)); SAXReader saxreader = new SAXReader(); Document enter = (enter)saxreader construe(bufferedreader); bufferedreader change state(); go document; }

Forex Groups - Tips on Trading

Related article:
http://babycountry.spaces.live.com/Blog/cns!18767B1E2EB6D0E1!231.entry

comments | Add comment | Report as Spam


"Java: PrintWriter & FileReader example" posted by ~Ray
Posted on 2007-09-15 11:21:08

The FileReader is used to find a certain existing file. This ordain run at Command Prompt only. When you be to run the program you should provide an existing filename after the Java File e g. The program ordain be for the textfile and will access it The schedule will display the contents of the register up to the measure lie and there you can alter the contents of the file and the schedule can save the modified one. merchandise java io.*;public class EditFile{public static void main (String args[])  throws IOException{try{File data = new File(args[0]);BufferedReader in = new BufferedReader(new FileReader(data));String lie=”";while(!(line==null)){System out println(lie);line = in readLine();}in close(); PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(data true)));BufferedReader br = new BufferedReader(new InputStreamReader(System in)); String FileLine;while( (FileLine = br readLine()) != null){out println(FileLine);}out close();br change state();} surprise(FileNotFoundException e){System out println(”register doesn’t exists..”);} surprise(IndexOutOfBoundsException a){System out println(”gratify contract the filename.\nEx: java EditFile [filename ext]”);}}}

Forex Groups - Tips on Trading

Related article:
http://www.jennylynfernandez.com/?p=20

comments | Add comment | Report as Spam


"I'll help you find more bufferedreader" posted by ~Ray
Posted on 2007-09-11 20:49:54



copy and paste...

bufferedreader

into the search box below...

Google


comments | Add comment | Report as Spam


 

 




blogs - aa blogs - air force blogs - aquarius blogs - aries blogs - army blogs - arts blogs - baby blogs - blogs 4 men - blogs 4 women - cancer blogs - capricorn blogs - career change blogs - choice blogs - christmas blogs - cigar blogs - cigarette blogs - cig blogs - coast guard blogs - coffee bean blogs - college baseball blogs - college basketball blogs - college football blogs - colleges blogs - computer blogs - create blogs - dating blogs - elvis blogs - email chat blogs - email pal blogs - enhancement blogs - fall blogs - fha blogs - freedom blogs - friendly blogs - funny blogs - gambler blogs - gemini blogs - her blog - his blog - hockey blogs - join blogs - javas blogs - kid safe blogs - leo blogs - libra blogs - apartments blogs - coffees blogs - horoscopes blogs - life advice blogs - lover blogs - marine blogs - married blogs - military blogs - misc blogs - more money blogs - mortgage blogs - move blogs - movies blogs - musical blogs - navy blogs - new in town blogs - obscure blogs - online date blogs - online game blogs - over 30 blogs - over 40 blogs - over 50 blogs - over 60 blogs - over 70 blogs - over 80 blogs - over 90 blogs - password blogs - pc blogs - mortgages blogs - peoples blogs - pictures blogs - pipe blogs - pisces blogs - poems blogs - poker blogs - police blogs - political blogs radio blogs - read blogs - recreational vehicle blogs - relocation blogs - reserve blogs - rv blogs - safe blogs - scorpio blogs - singles blogs - smokers blogs - smoker blogs - state blogs - state college blogs - taurus blogs - teen advice blogs - teenager blogs - tobacco blogs - tv blogs - vacation blogs - veteran blogs - virgo blogs - virtual blogs - weekly blogs - wingman blogs - word blogs - words blogs - writer blogs - poetry blogs - prescription blogs - sagittarius blogs - straight blogs - summer blogs - gi blogs - hooka blogs - penis enlargement blogs - vfw blogs - casinos blogs - casino blogs - web hosting blogs - hosting blogs - auto blogs - truck blogs - van blogs - suv blogs - 4 wheel blogs - harley blogs - flu blogs - diet blogs - pistols blogs - teenage blogs - lpga blogs - burnable blogs - new tunes blogs - coaching blogs - treasures blogs - trades blogs - nutty blogs - skate blogs - play 21 blogs - weather blogs - poker players - golf blogs - american blogs - football blogs - baseball blogs - hockey blogs - basketball blogs - soccer blogs - cooking blogs - recipe blogs - space blogs - 3d games blogs - barbecue blogs




the bufferedreader archives:

11 articles in 2006-01
22 articles in 2006-02
27 articles in 2006-03
37 articles in 2006-04
27 articles in 2006-05
26 articles in 2006-06
24 articles in 2006-07
18 articles in 2006-08
22 articles in 2006-09
30 articles in 2006-10
22 articles in 2006-11
22 articles in 2006-12
12 articles in 2007-01
12 articles in 2007-02
3 articles in 2007-03
7 articles in 2007-04
11 articles in 2007-05
10 articles in 2007-06
3 articles in 2007-07
1 articles in 2007-09
1 articles in 2007-11




next page


bufferedreader