3,272 questions
0
votes
1
answer
139
views
Reading from System.in in multiple threads
I have the following problem:
method1 that keeps reading from System.in and sending it via Socket
method2 that only reads from System.in when a error occurs in it
When I have a problem in method2, I ...
0
votes
1
answer
95
views
Second call to "get" method of Supplier is empty
For the below code, if I make a second call to supplier with "get" method, the count is zero.
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import ...
0
votes
2
answers
97
views
I'm trying to draw a 2d tile map from a .txt file in java but it is only using one of the tiles accross the map and not using whats in the .txt file
I'm following a java 2d game tutorial from ryisnow on youtube. https://www.youtube.com/watch?v=ugzxCcpoSdE
I was able to display each tile on its own but I don't know why the .txt isnt working
here is ...
0
votes
1
answer
99
views
How to use threadLocalReader with BufferedReader in Jmeter?
I have a text file (.txt) and am opening the file using JSR223 Sampler under once only controller like:
BufferedReader br = new BufferedReader(new FileReader(filePath)
vars.putObject("br",br)...
1
vote
1
answer
344
views
Can one just read buffered bytes in io.BufferedReader?
In Python, the io.BufferedReader class has various methods to read bytes from a stream, using an internal buffer. The read method may make various read calls to the underlying raw stream, the peek ...
1
vote
1
answer
158
views
Command Prompt seems to not echo System.in characters when using BufferedReader.ready() method
I'm building an application for a university project. While building the TUI that must use directly the terminal to receive input and display it. I wanted to achieve the following, not block the main ...
1
vote
0
answers
55
views
Memory issue when transfering large csv file to database
I am trying to read a 30GB CSV file with 60 columns and over 78 million rows into an H2 database on disk.
H2 url:
jdbc:h2:file:./data/datasource
Simplified code I am using to transfer the file:
import ...
0
votes
1
answer
194
views
How to pass a PIL.Image as an Image stream to ComputerVisionClient read_in_stream
I'm working on a python service where I have an image provided as a PIL Image.
I'm wanting to pass this image to Azure Vision using a ComputerVisionClient.
My setup is correct as I can pass in local ...
0
votes
2
answers
35
views
Read a csv archive on a array
I'm trying to read a archive csv with name, company, city, states, address, number, complement, neighborhood, cep and country, with a array like this:
`String path = "/home/arthur/Documentos/fe....
1
vote
1
answer
146
views
Exit inner loop only when EOF (Ctrl+D) is given via standard input
My program has a main while loop as the main logic, with an inner while loop for running the logic of the "command function". When inside the inner while loop, I want EOF (Ctrl + D) to exit ...
0
votes
0
answers
59
views
Unable to get BufferedReader to advance past the use of a Scanner object in an external java file
I am trying to write a program that acts as an automatic grader that will
run a student's java file
write it's output to a text file
test that text file against another text file with the desired ...
0
votes
1
answer
828
views
Get image buffer from formData
Im making a form with Next 14 using server actions and integrating some WYSIWYG text editor (ReactQuill). Im getting the form values in the server side but I dont know how to get the buffer value of ...
0
votes
1
answer
38
views
using process builder to get the stream of this process
I'm using a common solution which is using the BufferedReader class in order to get the the input stream but it seems that if I can see the command console opening with the application running, I ...
0
votes
2
answers
42
views
How can i read out a predefined txt file to make an array out of it later? (Android Studio)
i watched many yt videos and tried for hours to get this right but i have no idea how it works. My goal is to have a saved .txt file and read out an array from it. The simplest way i found ist this ...
0
votes
1
answer
2k
views
Runing Python script in Java return python exit code 9009 (Couldn't lunch python)
Problem&& what Im doing
I have written a Python script that checks the ports of the computer in search for a specific reader using it's Windows hardware ID and returns True or False ...
0
votes
2
answers
221
views
Counting the correct number of line breaks in a text file
I'm working through the first exercise in John Crickett's coding challenges, which is to create a wc clone that counts the number of lines, bytes, words and characters in a text file. I'm on Step 4, ...
0
votes
0
answers
144
views
Python os.fdopen() gives OSError: [Errno 9] Bad file descriptor
I am trying to test out a virtual serial connection in python with individual funtions for each test.
'''
Testing Virtual Serial Port Connections
'''
import os
import sys
import time
import serial
...
0
votes
1
answer
116
views
When using a Java Scanner, is there ever a need to wrap the InputStream argument into an InputStreamReader? And then into a BufferedReader?
With reference to this and this Q&A's, given that Java's Scanner supports both character encoding as well as buffering, is there ever a need to wrap the InputStream into a InputStreamReader, ...
0
votes
1
answer
109
views
Integer.parseInt() throws NumberFormatException for some numbers read using BufferedReader from one file but not another
I am trying to read numbers from a text file.
The first lines of metro.txt contain:
376 933
0000 Abbesses
0001 Alexandre Dumas
Whereas the first few lines of testnum.txt contain:
444 555
6666 flowers
...
0
votes
0
answers
42
views
How to Read a png File Stored Within an Exported jar in Eclipse
I have watched several videos and visited every stackoverflow thread I could find about reading files from within a jar and none of the methods I have found worked for me.
My most recent attempt was ...
-2
votes
4
answers
80
views
Extracting SQL from a .txt
I'm trying to extract values from a text file. The content of the file is as follows:
Cliente
1, 'Aarón', 'Rivero', 'Gómez', 'Almería', 100
2, 'Adela', 'Salas', 'Díaz', 'Granada', 200
3, 'Adolfo', '...
-2
votes
1
answer
177
views
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 18 out of bounds for length 18 [closed]
class CSVFileParser {
ArrayList<String[]> convertCSVToArrayList(String filePath) {
String line = "";
ArrayList<String[]> rows = new ArrayList<>();
...
0
votes
1
answer
123
views
JavaFX build crashes when trying to read from file
I am doing a midterm where we have to make a GUI grocery list. The professor is asking us to make the list into a .txt file and read from that file. There is also a delete section and delete all which ...
0
votes
2
answers
94
views
Problem inputting values from CSV file into ArrayList
I am trying to build a terminal mode application that allows a user to input certain attributes as a filtered search of Toyota vehicles released in the 80s. This is an assignment for a class so there ...
-1
votes
1
answer
84
views
Why checking isEmpty each row during BufferedReader makes a difference in Java reading file line by line
I have a piece of code reading a file. The content of the file is just an id for each line. Nothing special. However, I'm not sure why each style of this code produces different results.
The content ...
-2
votes
1
answer
565
views
Put a mutable buffer of u8 into BufReader.read()
Follows on from this partial answer to my question there.
I'm basically trying to understand how a particular manifestation of BufReader works, which is not std::io::BufReader.
The puzzling thing is ...
0
votes
1
answer
89
views
Reading from a file using BufferedReader is giving garbage byte values in the String byte array like negative bytes
I am trying to read contents from an srt file and I am using Java's BufferedReader to read the file line by line. The content from the srt file is:
2
00:00:40,665 --> 00:00:44,806
<i>♪ Nants ...
2
votes
0
answers
79
views
BufferedReader on top of BufferedInputStream VS BufferedReader on top of FileInputStream
Is there any performance gain if we have:
BufferedReader reader = new BufferedReader(new InputStreamReader(new BufferedInputStream(new FileInputStream("SOME_FILE")), StandardCharsets.UTF_8))
...
0
votes
0
answers
24
views
Duplicate carriage return when using read() of BufferedReader [duplicate]
When using read() from BufferedReader, when I press enter after typing input, the first input is taken but the next input statement is also executed, before I can type input for the next statement.
...
-1
votes
1
answer
67
views
java: illegal start of expression - method parameters
I use method for create and retrieves the list of entries with existing file using the instance.
My goal is to mute all actions performed by check Counter into several independent methods exemple ...
-1
votes
1
answer
276
views
Pytumblr - TypeError: expected str, bytes or os.PathLike object, not BufferedReader
This error happens and I do not know why, it links back to the posting function. I originally thought it was because I used the wrong variable for the access to my Tumblr blog, but the same error ...
-1
votes
2
answers
47
views
Convert 2 text line of integers into 2D array [closed]
I have some text lines like this
14 14 14 14
32 32 32 32
I want to convert into 2D array with BufferReader. Any help?
0
votes
2
answers
112
views
Convert text line of integers into array of integers in fastest way
I have a small homeworks, I need to convert text line of integers contains 10,000 numbers. I have tried this code below:
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int[] ...
0
votes
1
answer
162
views
ausearch command and JAVA issue - RedHat 9
I was triying to lunch some commands from JAVA to my RedHat server, this is the code that im testing:
public synchronized String lunchLinuxCommand() {
try {
log.info("init ...
1
vote
1
answer
499
views
How to make par_bridge() work for a BufReader?
I wanted to use rayon's par_bridge() to parallelize an Iterator, but I could not because of the error "the method par_bridge exists for struct MyReader, but its trait bounds were not satisfied ...
0
votes
4
answers
722
views
How can I get Buffered Reader to read only certain lines of a csv txt file?
I'm writing a java program for a school project that reads in data about covid-19 from a csv text file which has data in the following format:(date, state, fips code, # of cases, # of deaths). The ...
0
votes
1
answer
1k
views
System.NotSupportedException when trying to read response body in .NET 7
I am trying to log the response body of an HTTP request in a .NET 7 application, but I keep getting a System.NotSupportedException when I try to read from the response body stream. Here is the code I ...
0
votes
2
answers
103
views
Read from multiple inputstream with one blocking call
I have multiple InputStream, and I want to read without polling. My actual code:
BufferedReader p = new BufferedReader(new InputStreamReader(k.getInputStream()));
BufferedReader p2 = new ...
0
votes
0
answers
42
views
Is it better to write a custom input class or use BufferReader directly for INPUT in Java?
When I mention "better", it means the program will reduce its use of memory, or the program will run faster.
In competetive coding, we seek better IO and reduce time and space complexity to ...
-1
votes
3
answers
107
views
there is an "endless loop" how ı can fix it
this code is creating a loop , The variable named "Number of students" is constantly increasing. I couldn't find where the problem is.
{1.14,1.49,1.54,1.86,2.04,2.19,2.86,3.02,3.16} when I ...
0
votes
0
answers
151
views
how can I read from txt file into AVL tree in java? error FileNotFoundException
new java developer.
this code isn't working. it keeps generating this error: java.io.FileNotFoundException: file1.txt (No such file or directory) even though the file is in the same folder (src) as ...
0
votes
0
answers
50
views
Can I write only in certain lines in a file with BufferdWriter without overwrite others?
I want to save a highscore in a database, but if an sql-exeption is thrown I want to temporary save the data in a file. The game has diffent modes and for each there is a highscore. I would like to ...
1
vote
0
answers
74
views
Running R script from Java using Runtime rt = Runtime.getRuntime(), RScript, and Buffered reader seems to hang before finishing
I am running an R script from java using RScript and Runtime.getRuntime() as shown in the code below. The code seems to stop part way through (the code stops writing output). If I run the script ...
0
votes
0
answers
42
views
Read from File to Listview
I tried to fetch data from a .txt using buffered Reader etc.
But I just don't get the data into my listview.
Writing works, but not reading.
It doesn't show any errors.
Would appreciate it, if ...
2
votes
1
answer
85
views
BufferedReader linked to System.in does not stop reading upon reaching specified character
I'm working through an example program provided in the Book "Java A Beginnner's Guide (9th Ed.)" by Herbert Schildt. The example reads:
The following program demonstrates read() by reading ...
1
vote
0
answers
102
views
Code to read file prints extra characters
This code reads a text file character by character.
It prints the line number, character number, and the character using different functions.
The nextChar() function correctly changes the line and ...
1
vote
1
answer
87
views
How to know when to use byteStream for reading data and when to use charStream for reading data from a file?
I am trying to understand if I need to read data from different types of files (.properties file, json file, text file etc) or from console, which java class should I use and why exactly.
Some classes ...
0
votes
2
answers
2k
views
I am getting a NullPointerException when calling String.length() on a string during BufferedReading that should not be null
I am using a method with a BufferedReader with FileReader to read a file. The file consists of several lines of items separated by multiple white spaces. I am looping through the each line of the file ...
-2
votes
1
answer
42
views
1. How to avoid NZEC error in java? 2. Is this the correct way to take inputs for test cases
!(https://i.sstatic.net/UpHxf.png)
When I run the code on my Eclipse IDE , it reads the input properly through the console but when I try to submit the code on SPOJ , the compiler throws NZEC error
I ...
0
votes
0
answers
244
views
How to extract every line from a stdOut in Kotlin
I'm trying to get all the console outputs from a stream that in this case, the stream is from a Python console. This is a part of a library that I'm doing on GitHub; in it you can find all the code.
I ...