Trang 2 của 2 Đầu tiênĐầu tiên 12
Kết quả 11 đến 15 của 15
  1. #11
    Ngày tham gia
    May 2015
    Bài viết
    5
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>nop bai (move your mouse to reveal the content)</noscript>

    nop bai (open)
    nop bai (close)

    </div>
    <div class="quotecontent">
    <div class="bbcm_spoiler_noscript"><blockquote>


    Mã nguồn PHP:
    [color=#000000]
    import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]bufferedreader[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]filereader[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]filewriter[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]ioexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]inputstreamreader[/color][color=#007700]; public class [/color][color=#0000bb]coppyfile [/color][color=#007700]{ @[/color][color=#0000bb]suppresswarnings[/color][color=#007700]([/color][color=#dd0000]"resource"[/color][color=#007700]) public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) [/color][color=#0000bb]throws ioexception [/color][color=#007700]{ [/color][color=#ff8000]//copy file input.txt sang file output.txt su dung cach doc van ban //doc file [/color][color=#0000bb]bufferedreader br [/color][color=#007700]= new [/color][color=#0000bb]bufferedreader[/color][color=#007700](new [/color][color=#0000bb]inputstreamreader[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700])); [/color][color=#0000bb]filewriter fw[/color][color=#007700]; [/color][color=#0000bb]string tenfile[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập đường dẫn file:"[/color][color=#007700]); [/color][color=#0000bb]tenfile [/color][color=#007700]= [/color][color=#0000bb]br[/color][color=#007700].[/color][color=#0000bb]readline[/color][color=#007700](); [/color][color=#0000bb]filereader fr [/color][color=#007700]= new [/color][color=#0000bb]filereader[/color][color=#007700]([/color][color=#0000bb]tenfile[/color][color=#007700]); [/color][color=#0000bb]bufferedreader b [/color][color=#007700]= new [/color][color=#0000bb]bufferedreader[/color][color=#007700]([/color][color=#0000bb]fr[/color][color=#007700]); [/color][color=#0000bb]string s[/color][color=#007700]; [/color][color=#ff8000]//doc tung dong van ban [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập đường dẫn file luu:"[/color][color=#007700]); [/color][color=#0000bb]tenfile [/color][color=#007700]= [/color][color=#0000bb]br[/color][color=#007700].[/color][color=#0000bb]readline[/color][color=#007700](); [/color][color=#0000bb]fw [/color][color=#007700]= new [/color][color=#0000bb]filewriter[/color][color=#007700]([/color][color=#0000bb]tenfile[/color][color=#007700]); while(([/color][color=#0000bb]s [/color][color=#007700]= [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]readline[/color][color=#007700]()) != [/color][color=#0000bb]null[/color][color=#007700]) { [/color][color=#0000bb]s [/color][color=#007700]= [/color][color=#0000bb]s [/color][color=#007700]+ [/color][color=#dd0000]"
    "[/color][color=#007700]; [/color][color=#0000bb]fw[/color][color=#007700].[/color][color=#0000bb]write[/color][color=#007700]([/color][color=#0000bb]s[/color][color=#007700]); } [/color][color=#ff8000]//ghi file [/color][color=#0000bb]fw[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); }}[/color] 
    </blockquote></div>
    </div>
    </div>

  2. #12
    Ngày tham gia
    Jul 2015
    Bài viết
    61
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>

    show spoiler
    hide spoiler

    </div>
    <div class="quotecontent">
    <div class="bbcm_spoiler_noscript"><blockquote>


    Mã:
    ackage $31docghidlieudungluongkytu;
     
     
     
     
    import java.io.bufferedreader;
    import java.io.filereader;
    import java.io.filewriter;
    import java.io.ioexception;
     
     
     
     
    public class baitap {
    public static void main(string[] args) {
    try{
    filereader fr=new filereader("d:\\vy2301.txt");
    bufferedreader br=new bufferedreader(fr);
    filewriter fw=new filewriter("d:\\vynhat.txt");
    string s;
    while((s=br.readline())!=null){
    fw.write(s);
    system.out.println(s);
    }
    fr.close();
    fw.close();
    }catch(ioexception e1){
    system.out.println(e1);
    }
    }
    }
    </blockquote></div>
    </div>
    </div>

  3. #13
    Ngày tham gia
    Mar 2015
    Bài viết
    0
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>bai31 -doc ghi file dung luong ki tu trong java (move your mouse to reveal the content)</noscript>

    bai31 -doc ghi file dung luong ki tu trong java (open)
    bai31 -doc ghi file dung luong ki tu trong java (close)

    </div>
    <div class="quotecontent">
    <div class="bbcm_spoiler_noscript"><blockquote>


    Mã nguồn PHP:
    [color=#000000]
    bai31package baitapvenha[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]bufferedreader[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]filenotfoundexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]filereader[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]filewriter[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]ioexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];[/color][color=#ff8000]/*** viết chương trình copy nội dung file "input.txt" sang file "output.txt" sử* dụng cách đọc ghi văn bản! bạn nào làm xong cố gắng bớt chút ít thời gian* đăng lên cho các bạn khác cùng tham khảo nhé!*/[/color][color=#007700]public class [/color][color=#0000bb]bai31 [/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) [/color][color=#0000bb]throws ioexception [/color][color=#007700]{ [/color][color=#0000bb]scanner sc [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]string part1[/color][color=#007700], [/color][color=#0000bb]part2[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap duong dan file nguon ( start = :\\\\...\\*.*)"[/color][color=#007700]); [/color][color=#0000bb]part1 [/color][color=#007700]= [/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap duong dan file dich ( start = :\\\\...\\*.*)"[/color][color=#007700]); [/color][color=#0000bb]part2 [/color][color=#007700]= [/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#ff8000]/*part1 = "e:\\thongtinsv.txt"; part2 = "d:\\thongtinghilai.txt"; */ [/color][color=#0000bb]bai31 test [/color][color=#007700]= new [/color][color=#0000bb]bai31[/color][color=#007700](); [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]copyfile[/color][color=#007700]([/color][color=#0000bb]part1[/color][color=#007700], [/color][color=#0000bb]part2[/color][color=#007700]); } public [/color][color=#0000bb]void copyfile[/color][color=#007700]([/color][color=#0000bb]string part1[/color][color=#007700], [/color][color=#0000bb]string part2[/color][color=#007700]) [/color][color=#0000bb]throws ioexception [/color][color=#007700]{ [/color][color=#0000bb]filereader fr[/color][color=#007700]; [/color][color=#0000bb]filewriter fw [/color][color=#007700]= [/color][color=#0000bb]null[/color][color=#007700]; try { [/color][color=#0000bb]fr [/color][color=#007700]= new [/color][color=#0000bb]filereader[/color][color=#007700]([/color][color=#0000bb]part1[/color][color=#007700]); [/color][color=#0000bb]fw [/color][color=#007700]= new [/color][color=#0000bb]filewriter[/color][color=#007700]([/color][color=#0000bb]part2[/color][color=#007700]); [/color][color=#0000bb]bufferedreader br [/color][color=#007700]= new [/color][color=#0000bb]bufferedreader[/color][color=#007700]([/color][color=#0000bb]fr[/color][color=#007700]); [/color][color=#0000bb]string str[/color][color=#007700]; [/color][color=#ff8000]// doc tung dong van ban [/color][color=#007700]while (([/color][color=#0000bb]str [/color][color=#007700]= [/color][color=#0000bb]br[/color][color=#007700].[/color][color=#0000bb]readline[/color][color=#007700]()) != [/color][color=#0000bb]null[/color][color=#007700]) { [/color][color=#0000bb]str [/color][color=#007700]= [/color][color=#0000bb]str [/color][color=#007700]+ [/color][color=#dd0000]" "[/color][color=#007700]; [/color][color=#0000bb]fw[/color][color=#007700].[/color][color=#0000bb]write[/color][color=#007700]([/color][color=#0000bb]str[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]str[/color][color=#007700]); } } catch ([/color][color=#0000bb]filenotfoundexception e[/color][color=#007700]) { [/color][color=#ff8000]// todo auto-generated catch block [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"error: " [/color][color=#007700]+ [/color][color=#0000bb]e[/color][color=#007700]); } [/color][color=#0000bb]fw[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); }}[/color] 
    </blockquote></div>
    </div>
    </div>

  4. #14
    Ngày tham gia
    Apr 2015
    Bài viết
    2
    Trích dẫn Gửi bởi bqthanh94_cntt

    Mã nguồn PHP:
    [color=#000000]
    import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]bufferedreader[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]filewriter[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]fileinputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]filereader[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]ioexception[/color][color=#007700];class [/color][color=#0000bb]copy[/color][color=#007700]{ public [/color][color=#0000bb]void read[/color][color=#007700]()[/color][color=#0000bb]throws ioexception[/color][color=#007700]{ [/color][color=#0000bb]bufferedreader buff[/color][color=#007700]; [/color][color=#0000bb]filewriter f[/color][color=#007700]; [/color][color=#0000bb]fileinputstream ff[/color][color=#007700]; try{ [/color][color=#0000bb]f[/color][color=#007700]=new [/color][color=#0000bb]filewriter[/color][color=#007700]([/color][color=#dd0000]"g:\\java\\output.txt"[/color][color=#007700]); [/color][color=#0000bb]buff[/color][color=#007700]=new [/color][color=#0000bb]bufferedreader[/color][color=#007700](new [/color][color=#0000bb]filereader[/color][color=#007700]([/color][color=#dd0000]"g:\\java\\input.txt"[/color][color=#007700])); }catch([/color][color=#0000bb]ioexception e[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"error open file"[/color][color=#007700]); return; } [/color][color=#0000bb]string s[/color][color=#007700]; try{ while(([/color][color=#0000bb]s[/color][color=#007700]=[/color][color=#0000bb]buff[/color][color=#007700].[/color][color=#0000bb]readline[/color][color=#007700]())!=[/color][color=#0000bb]null[/color][color=#007700]){ [/color][color=#0000bb]f[/color][color=#007700].[/color][color=#0000bb]write[/color][color=#007700]([/color][color=#0000bb]s[/color][color=#007700]); } }catch([/color][color=#0000bb]ioexception e[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"error reading file"[/color][color=#007700]); } [/color][color=#0000bb]f[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); }}public class [/color][color=#0000bb]read_vanban [/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) [/color][color=#0000bb]throws ioexception [/color][color=#007700]{ [/color][color=#0000bb]copy c[/color][color=#007700]=new [/color][color=#0000bb]copy[/color][color=#007700](); [/color][color=#0000bb]c[/color][color=#007700].[/color][color=#0000bb]read[/color][color=#007700](); }}[/color] 
    mình lưu file dưới dạng văn bản tiếng việt, sau đó đọc vào file output thì nó có những kí tự lạ, mấy bạn giúp với
    bạn chỉnh utf-8 trong eclipse đi

  5. #15
    Ngày tham gia
    Jan 2015
    Bài viết
    0
    // mong mọi người đóng góp ý kiến để mình hoàn thiện hơn


    Mã nguồn PHP:
    [color=#000000]
    import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]bufferedreader[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]filereader[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]filewriter[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]inputstreamreader[/color][color=#007700]; [/color][color=#ff8000]/*** created by whynotme on 16/03/2015.*/[/color][color=#007700]public class [/color][color=#0000bb]readwriteread [/color][color=#007700]{ public static [/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]readfile[/color][color=#007700]([/color][color=#0000bb]string url[/color][color=#007700]) { [/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]s [/color][color=#007700]= new [/color][color=#0000bb]string[/color][color=#007700][[/color][color=#0000bb]10[/color][color=#007700]]; [/color][color=#0000bb]int index [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; try { [/color][color=#0000bb]filereader fr [/color][color=#007700]= new [/color][color=#0000bb]filereader[/color][color=#007700]([/color][color=#0000bb]url[/color][color=#007700]); [/color][color=#0000bb]bufferedreader br [/color][color=#007700]= new [/color][color=#0000bb]bufferedreader[/color][color=#007700]([/color][color=#0000bb]fr[/color][color=#007700]); while (([/color][color=#0000bb]s[/color][color=#007700][[/color][color=#0000bb]index[/color][color=#007700]] = [/color][color=#0000bb]br[/color][color=#007700].[/color][color=#0000bb]readline[/color][color=#007700]()) != [/color][color=#0000bb]null[/color][color=#007700]) { [/color][color=#0000bb]index[/color][color=#007700]++; } } catch ([/color][color=#0000bb]exception e[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]e[/color][color=#007700]); } return [/color][color=#0000bb]s[/color][color=#007700]; } public static [/color][color=#0000bb]void writefile[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]url[/color][color=#007700], [/color][color=#0000bb]string link[/color][color=#007700]) { [/color][color=#0000bb]filewriter fw[/color][color=#007700]; [/color][color=#0000bb]bufferedreader br [/color][color=#007700]= new [/color][color=#0000bb]bufferedreader[/color][color=#007700](new [/color][color=#0000bb]inputstreamreader[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700])); try { [/color][color=#0000bb]fw [/color][color=#007700]= new [/color][color=#0000bb]filewriter[/color][color=#007700]([/color][color=#0000bb]link[/color][color=#007700]); for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]url[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { if ([/color][color=#0000bb]url[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] != [/color][color=#0000bb]null[/color][color=#007700]) { [/color][color=#0000bb]fw[/color][color=#007700].[/color][color=#0000bb]write[/color][color=#007700]([/color][color=#0000bb]url[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]); } } [/color][color=#0000bb]fw[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); } catch ([/color][color=#0000bb]exception e[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]e[/color][color=#007700]); } } public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) { [/color][color=#0000bb]string intputfile [/color][color=#007700]= [/color][color=#dd0000]"e:\\input.txt"[/color][color=#007700]; [/color][color=#0000bb]string outfile [/color][color=#007700]= [/color][color=#dd0000]"e:\\output.txt"[/color][color=#007700]; [/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]file [/color][color=#007700]= [/color][color=#0000bb]readfile[/color][color=#007700]([/color][color=#0000bb]intputfile[/color][color=#007700]); [/color][color=#0000bb]writefile[/color][color=#007700]([/color][color=#0000bb]file[/color][color=#007700], [/color][color=#0000bb]outfile[/color][color=#007700]); }}[/color] 

Trang 2 của 2 Đầu tiênĐầu tiên 12

Quyền viết bài

  • Bạn Không thể gửi Chủ đề mới
  • Bạn Không thể Gửi trả lời
  • Bạn Không thể Gửi file đính kèm
  • Bạn Không thể Sửa bài viết của mình
  •