Snippets tagged “bufferedreader”
8 snippets use this tag.
- Get the POST request body from HttpServletRequestJava
To get the POST request body from an HttpServletRequest object in Java, you can use the getReader method of the ServletRequest interface to read the request body as a BufferedReader and then use the readLine method to read the data as a string.
- How can I read a large text file line by line using Java?Java
To read a large text file line by line in Java, you can use a BufferedReader and pass it a FileReader object to read the file. Here's an example of how you can do this:
- How do I read / convert an InputStream into a String in Java?Java
There are several ways to read an InputStream and convert it to a String in Java. One way is to use the BufferedReader and InputStreamReader classes to read the InputStream line by line, and use a StringBuilder to construct the final String:
- How to read text file from classpath in Java?Java
To read a text file from the classpath in Java, you can use the getResourceAsStream method of the ClassLoader class to get an InputStream for the file, and then use a BufferedReader to read the contents of the file.
- HttpServletRequest get JSON POST dataJava
To get JSON POST data from an HttpServletRequest object in Java, you can use the getReader method of the ServletRequest interface to read the request body as a BufferedReader and then use the readLine method to read the data as a string.
- Java: How to read a text fileJava
To read a text file in Java, you can use the BufferedReader class from the java.io package.
- Number of lines in a file in JavaJava
To get the number of lines in a file in Java, you can use the BufferedReader class and read the file line by line until the end of the file is reached.
- Reading a plain text file in JavaJava
This code opens the file "filename.txt" and reads it line by line. Each line is printed to the console until the end of the file is reached.