Buffer




import java.io.*;

public class Main {

    
    public static void main(String[] args) throws IOException{

      
        FileInputStream in = null;
        InputStreamReader inchar=null;
        BufferedReader bufferchar=null;

        try {
            in = new FileInputStream("myfile1.txt");

           inchar = new InputStreamReader(in,"UTF8");

           bufferchar= new BufferedReader(inchar);

        System.out.println("Text from file ");

        //Reads a single character.
        System.out.println(inchar.read());

          
            
            
        } finally {
            
                inchar.close();
            

        }
    }

}

Buffer is region in memory that saves data temporary.It makes faster reading data.Now my question is how many characters can be saved in Buffer?

-how many characters can be saved in Buffer?
[URL=“http://download.oracle.com/javase/1.4.2/docs/api/java/io/BufferedReader.html”]The buffer size may be specified, or the default size may be used. The default is large enough for most purposes.

What is the default size?
Answer

This is my 600th post in this forum.I appreciate your help and other friends.I learned many things in this forum.Thank you very much!:slight_smile: