目前分類:Java (59)
- Feb 15 Wed 2012 10:27
Java - How many files in the directory
- Feb 13 Mon 2012 14:00
java - meta character
A meta-character is a characater that has special meaning to a computer program.
for example , in the regular expression engine:
- Feb 12 Sun 2012 12:42
Java - Sequential File and Stream
A sequential file contains records organized by the order where they are entered ,
the length of records and the order of records are fixed.
- Jan 21 Sat 2012 19:11
Java - set cookie
We need to use URLConnection class or HttpURLConnection class to set cookie.
The example is as below:
- Jan 21 Sat 2012 18:37
java - set URL connection time and URL read time
When we crawl the content from the URL , sometimes the process will become zombie and the task will
be stoped by some internet connection reason.
- Jan 19 Thu 2012 10:33
Java - create directory
In File class , there is a method , mkdir() , which can be used to create directory.
The example is as below:
boolean success = (new File("directoryName")).mkdir();
if (!success)
{
System.out.println("Directory create failed!!");
}
In File class , it also has another method , mkdirs() , we can use this method if we want to create hierarchical directory .
for example:
This example will create two directory , one is datasets directory , and the other is class_2 directory.
String classNum = "datasets\\class_"+2;
- Jan 18 Wed 2012 23:15
Java - return high dimensional array
How to retrun a two dimensional array ,
It is very simple in Java , we just need to set the return type as the same as the array tyep.
- Jan 18 Wed 2012 21:39
Java - Hashtable array
- Jan 18 Wed 2012 12:35
java - How to determine that a character is ascii ?
The range of ascii is from 0 to 255 ,
so a character is out of this range , we can say that this character is not a ascii.
- Jan 15 Sun 2012 23:41
Java - How to create a javadoc
javadoc is a tool in the jdk folder , it can help us transform the comment which was in program
to a documentation which was html style .
- Jan 15 Sun 2012 20:46
Java - How to create package and Jar
When we write many program , we also need to manage these program in order to avoid confuse.
Java has provide two method for us to manage these program , Package and Jar.
- Jan 13 Fri 2012 12:56
Java - 取string的每一個字
- Jan 08 Sun 2012 16:41
Java - set Classpath
- Dec 29 Thu 2011 14:01
Java - Delete the file
- Dec 29 Thu 2011 13:59
Java - get File size
The method , length() , of File class can be used to get the file size.
File f = new File(fileName);
- Dec 29 Thu 2011 13:28
Java - redirect from file to StdOut
The System.out will be changed to test file after the instruction , System.setOut(new PrintStream("test")) ,
is executed.
- Dec 29 Thu 2011 13:06
Java - Read file name of a directory
We can use File class to open a folder and read the file name of this folder.
and the method , list() , will return an array of strings naming the files in the directory.
- Dec 26 Mon 2011 22:23
Java - Sent parameter by POST method
Sometimes , we may want to sent parameter by POST method ,
the following example can help us achieve this purpose.
- Dec 26 Mon 2011 22:15
Java - Transmit data by socket
- Dec 21 Wed 2011 17:14
Java - Queue
public class QueueTest