{"id":65906,"date":"2021-07-17T04:10:03","date_gmt":"2021-07-17T08:10:03","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/opening-and-reading-files-with-java-jdk-1-0-x-java-short-notes\/"},"modified":"2021-07-17T04:10:03","modified_gmt":"2021-07-17T08:10:03","slug":"opening-and-reading-files-with-java-jdk-1-0-x-java-short-notes","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=65906","title":{"rendered":"Opening and reading files with Java JDK 1.0.x #Java Short Notes"},"content":{"rendered":"<p><pre>   1. Open the file with the File class;   2. Create a FileInputStream object using the File object;   3. Convert the FileInputStream to a BufferedInputStream to greatly increase file reading speed;   4. Convert the BufferedInputStream to a DataInputStream; the methods of DataInputStream        give a fair amount of flexibility in        reading the data.   5. Read the file until the endFile f = new File(\"mydata.txt\"); FileInputStream fis = new FileInputStream(f); BufferedInputStream bis = new BufferedInputStream(fis); DataInputStream dis = new DataInputStream(bis);  String record = null; try {    while ( (record=dis.readLine()) != null ) {       \/\/       \/\/ put your logic here to work with \"record\"       \/\/    } } catch (IOException e) {    \/\/    \/\/ put your error-handling code here    \/\/ } <\/pre>\n<\/p>\n<p> From: http:\/\/sitestree.com\/?p=4775<br \/> Categories:Java Short Notes<br \/>Tags:<br \/> Post Data:2007-12-31 19:48:19<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Open the file with the File class; 2. Create a FileInputStream object using the File object; 3. Convert the FileInputStream to a BufferedInputStream to greatly increase file reading speed; 4. Convert the BufferedInputStream to a DataInputStream; the methods of DataInputStream give a fair amount of flexibility in reading the data. 5. Read the file &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=65906\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917],"tags":[],"class_list":["post-65906","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":7550,"url":"http:\/\/bangla.sitestree.com\/?p=7550","url_meta":{"origin":65906,"position":0},"title":"\u099c\u09be\u09ad\u09be JDK 1.0.x \u098f\u09b0 \u09b8\u09be\u09b9\u09be\u09af\u09cd\u09af\u09c7 \u09ab\u09be\u0987\u09b2 \u0996\u09cb\u09b2\u09be \u098f\u09ac\u0982 \u09aa\u09dc\u09be","author":"Author-Check- Article-or-Video","date":"March 27, 2015","format":false,"excerpt":"\u099c\u09be\u09ad\u09be JDK 1.0.x \u098f\u09b0 \u09b8\u09be\u09b9\u09be\u09af\u09cd\u09af\u09c7 \u09ab\u09be\u0987\u09b2 \u0996\u09cb\u09b2\u09be \u098f\u09ac\u0982 \u09aa\u09dc\u09be ------------------------------------------------------------------ \u09e7\u0964 \u09ab\u09be\u0987\u09b2 \u0995\u09cd\u09b2\u09be\u09b8 \u0985\u09a8\u09c1\u09af\u09be\u09df\u09c0 \u09ab\u09be\u0987\u09b2 \u0996\u09c1\u09b2\u09c1\u09a8\u0964 \u09e8\u0964 \u09ab\u09be\u0987\u09b2 \u0985\u09ac\u099c\u09c7\u0995\u09cd\u099f \u09ac\u09cd\u09af\u09be\u09ac\u09b9\u09be\u09b0 \u0995\u09b0\u09c7 \u098f\u0995\u099f\u09bf FileInputStream \u09a4\u09c8\u09b0\u09bf \u0995\u09b0\u09c1\u09a8\u0964 \u09e9\u0964 FileInputStream \u0995\u09c7 BufferedInputStream \u098f \u09b0\u09c1\u09aa\u09be\u09a8\u09cd\u09a4\u09b0 \u0995\u09b0\u09c1\u09a8 \u09af\u09be \u0986\u09aa\u09a8\u09be\u09b0 \u09ab\u09be\u0987\u09b2 \u09aa\u09dc\u09be\u09b0 \u0997\u09a4\u09bf\u0995\u09c7 \u0985\u09a8\u09c7\u0995 \u09ac\u09be\u09dc\u09bf\u09df\u09c7 \u09a6\u09c7\u09ac\u09c7\u0964 \u09ea\u0964 BufferedInputStream \u0995\u09c7 DataInputStream \u0995\u09a8\u09ad\u09be\u09b0\u09cd\u099f \u0995\u09b0\u09c1\u09a8 \u09af\u09be \u0986\u09aa\u09a8\u09be\u0995\u09c7 \u09ab\u09be\u0987\u09b2 \u09aa\u09dc\u09be\u09b0\u2026","rel":"","context":"In &quot;\u099c\u09be\u09ad\u09be&quot;","block_context":{"text":"\u099c\u09be\u09ad\u09be","link":"http:\/\/bangla.sitestree.com\/?cat=266"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65846,"url":"http:\/\/bangla.sitestree.com\/?p=65846","url_meta":{"origin":65906,"position":1},"title":"SCJP: Basic Java I\/O #Java Short Notes #SCJP","author":"Sayed","date":"July 16, 2021","format":false,"excerpt":"ByteStream is the basic I\/O stream. Handles data as a stream of bytes. Does operation with byte unit and uses 8 bit. FileInputStream, FileOutputStream - can be used to copy files as byte by byte. Character Streams: FileReader and FileWriter are character streams. They treat file data as 16 bit\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":24457,"url":"http:\/\/bangla.sitestree.com\/?p=24457","url_meta":{"origin":65906,"position":2},"title":"Implement your Own Permission: Pretty Simple Java Code #Root","author":"Author-Check- Article-or-Video","date":"April 10, 2021","format":false,"excerpt":"Implementing Your Own Permission package com.gamedev.games; import java.io.*; import java.security.*; import java.util.Hashtable; import com.scoredev.scores.*; public class ExampleGame { public static void main(String args[]) throws Exception { HighScore hs = new HighScore(\"ExampleGame\"); if (args.length == 0) usage(); if (args[0].equals(\"set\")) { hs.setHighScore(Integer.parseInt(args[1])); } else if (args[0].equals(\"get\")) { System.out.println(\"score = \"+ hs.getHighScore()); }\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10343,"url":"http:\/\/bangla.sitestree.com\/?p=10343","url_meta":{"origin":65906,"position":3},"title":"Uses a FileDialog to choose the file to display","author":"","date":"August 27, 2015","format":false,"excerpt":"DisplayFile.java **************** import java.awt.*; import java.awt.event.*; import java.io.*; \/** Uses a FileDialog to choose the file to display. \u00a0*************** \u00a0 public class DisplayFile extends CloseableFrame \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 implements ActionListener { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 public static void main(String[] args) { \u00a0\u00a0\u00a0 new DisplayFile(); \u00a0 } \u00a0 private Button loadButton; \u00a0 private TextArea\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10339,"url":"http:\/\/bangla.sitestree.com\/?p=10339","url_meta":{"origin":65906,"position":4},"title":"A Frame that lets you draw circles with mouse clicks","author":"","date":"August 26, 2015","format":false,"excerpt":"SavedFrame.java **************** A Frame that lets you draw circles with mouse clicks \/\/************** import java.awt.*; import java.awt.event.*; import java.io.*; \/** A Frame that lets you draw circles with mouse clicks \u00a0*\u00a0 and then save the Frame and all circles to disk. \u00a0* public class SavedFrame extends CloseableFrame \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 implements ActionListener\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27020,"url":"http:\/\/bangla.sitestree.com\/?p=27020","url_meta":{"origin":65906,"position":5},"title":"Uses a FileDialog to choose the file to display #Programming Code Examples #Java\/J2EE\/J2ME #AWT Components","author":"Author-Check- Article-or-Video","date":"May 8, 2021","format":false,"excerpt":"DisplayFile.java **************** import java.awt.*; import java.awt.event.*; import java.io.*; \/** Uses a FileDialog to choose the file to display. *************** public class DisplayFile extends CloseableFrame implements ActionListener { public static void main(String[] args) { new DisplayFile(); } private Button loadButton; private TextArea fileArea; private FileDialog loader; public DisplayFile() { super(\"Using FileDialog\");\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65906","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=65906"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65906\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=65906"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=65906"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=65906"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}