0
votes
0answers
20 views

Using delimiter in java Scanner class to read a comma seperated file [migrated]

I am trying to assign values in a file using a comma as a delimiter. The problem arises after the first line, because there is no comma at the end of the first line, so the Scanner is reading the last ...
17
votes
4answers
554 views

How bad is it calling println() often than concatenating strings together and calling it once?

I know output to the console is a costly operation. In the interest of code readability sometimes it is nice to call a function to output text twice, rather than having a long string of text as an ...
1
vote
0answers
76 views

Using streams as method parameters and/or return types

So let's say I have a 'Transformer' interface that can transform one file-type to another. Let's say I also wish to use streams to provide the data to the Transformer. Which is the approach that is ...
1
vote
3answers
314 views

Disk I/Os incurred by readLine () in Java

Does readLine() Java function used with BufferedReader cause one disk I/O per call? If yes, is there any way to read specific number of lines, say n, from a text file causing only one disk I/O? ...
5
votes
1answer
150 views

Name convention for Reader and Writer [closed]

I'm trying to name a component that will be capable of both reading from an InputStream (file or otherwise), and writing to an OutputStream; thus serving both as a Reader and as Writer. So far the ...
2
votes
1answer
185 views

Where do you use Java Channels?

I have only used Java Channels and BufferedOutputStream and the input counter part for reading and writing simple integers and some strings here and there to the file. However I do not understand the ...
0
votes
1answer
2k views

How are Java ByteBuffer's limit and position variable's updated?

There are two scenarios: writing and reading Writing: Whenever I write something to the ByteBuffer by calling its put(byte[]) method the position variable is incremented as: current position + size of ...
1
vote
3answers
1k views

What is preferred for file I/O in Java?

Of the three BufferedReader/Writer Binary Streams Channels which is more preferred in real life for file I/O in Java and why? I prefer channels for binary data to be put into file or read from ...
3
votes
1answer
1k views

How to read from a database, and write to a file asynchronously / non blocking way in Java

I'm trying to modify a serial program that reads from a database, and writes results to a file, this is done in a blocking way and I think we can get performance boost of there is a memory buffer and ...
2
votes
5answers
3k views

Sharing buffer between multiple threads

I had a job process that was executing a lot of IO to read and write temporary files. Now I want to (need to) reduce the quantity of IO executions. So I want to create a sort of circular buffer ...