Tag: CTI Flush without NEC UID Create stream encoding request
Property |
Method |
Get root directory |
Request.getservletcontext (). Getrealpath ("/"); |
Create a Directory |
File file= new File (path); If (!file.exists ()) { File.mkdirs (); } |
Write file |
File file =new files (" path "); OutputStreamWriter osw =new outputstreamwriter (new fileoutputstream (file, "append"), "character encoding"); Osw.write ("write content"); Osw.flush (); Osw.close (); |
Read file |
File file =new files (" path "); InputStreamReader isr=new inputstreamreader (new fileinputstream (file), "character encoding"); Stringbuider sb= New Stringbuider (); While (isr.ready ()) { Sb.append (char) isr.read ()); } Isr.close (); |
Delete file |
File file =new file (" path ");//there is no quotation mark File.delete (); |
static technology |
URL url =new url (" htpp://www.rsseasy.com "); HttpURLConnection connection = (httpurlconnection) url.openconnection (); BufferedReader in =new bufferedreader (new inputstreanreader (connection.getinputstream (), "utf-8")); StringBuffer buffer =new stringbuffer (); String line = ""; While ((line=in.readline ())!=null) { Buffer.append (line); } File file =new file ("path"); Outputstreamwrite osw =new outputstreamwrite (new fileoutputstream (file,file), "utf-8"); Osw.write (buffer.tostring ()); Osw.flush (); Osw.close (); |
D
JSP file System