Input/Output of data to/from a system. This usually implies file storage or network communication, but may also mean interaction with a user through a user interface.

learn more… | top users | synonyms

0
votes
2answers
34 views

Which 'InputStream' subtype is used by 'Socket' type object here?

In the below server socket program, byte stream object is used to read data from client, as mentioned - InputStream in = socket.getInputStream(); public class SingleThreadTCPServer{ ...
1
vote
1answer
41 views

Query on java I/O BufferedOutputStream write() method

Below is the code that is written using byte stream non-buffer class FileInputStream and FileOutputStream with the usage of explicit user buffers. public class FileCopyUserBuffer{ public static ...
17
votes
3answers
1k views

Why do we have to mention the data type of the variable in C

Usually in C, we have to tell the computer the type of data in variable declaration. E.g. in the following program, I want to print the sum of two floating point numbers X and Y. ...
3
votes
4answers
325 views

Why do we have to tell printf() the type of data in C?

Let's consider this C code: #include <stdio.h> main() { int x=5; printf("x is "); printf("%d",5); } In this, when we wrote int x=5; we told the computer that x is an integer. The ...
1
vote
1answer
49 views

Who is responsible for stream positioning?

The samples in question are c#, but it applies to any language. If you have a function which reads content from a stream. Who should be responsible for ensuring that the stream position is correct ...
3
votes
6answers
748 views

How can IO cause side effects in Functional Programming? [duplicate]

Whenever I read about Haskell, I find that IO can cause side effects. But I do not understand how it would do it? Do we mean that we are writing to a file from one lazy sequence and another lazy ...
2
votes
1answer
276 views

Benefits of Java ByteArrayInputStream vs byte array?

I have a scenario where my Java process will be receiving a stream of binary data: public class DataHandler { public void handleData(DATA data) { // TODO: Do something with data } } ...
1
vote
1answer
186 views

Design Pattern: A single class with multiple purposes, or multiple extended classes each with their own purpose in PHP

I'm working on a PHP framework called Carbon CMS. This framework will be used as base to build larger web applications on top of it. This framework should provide all kinds of interfaces such as ...
-2
votes
1answer
84 views

HDD Failure Paranoia [closed]

HDD Failure Paranoia I tend to make small programs for myself. Whenever I make an application I use a database application like MS Access or MySQL. I can CRUD my data as I want. No problem in ...
17
votes
4answers
650 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
2answers
121 views

The destination of cout messages in a GUI program

I've been building some classes and functions in a static library which has the familiar printing of text messages to stdout: cout << "Hello World!" << endl; I've been developing this ...
1
vote
1answer
94 views

How does I/O work for large graph databases?

I should preface this by saying that I'm mostly a front end web developer, trained as a musician, but over the past few years I've been getting more and more into computer science. So one idea I have ...
4
votes
2answers
216 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 ...
4
votes
2answers
160 views

What is a stream, and how does it work?

Like a data stream in general, this can be an I/O stream or memory stream or a file stream or what not. I understand that it's some sort of stream of bytes, that you can read to parse very large ...
1
vote
1answer
62 views

What is the best way to handle dynamic content?

So we run a site where there are elements of the interface that could potentially be changed at any moment in the backend. Specifically we run a web service where certain functions are loaded ...
3
votes
4answers
137 views

Structuring an input file [closed]

I am in the process of structuring a small program to perform some hydraulic analysis of pipe flow. As I am envisioning this, the program will read an input file, store the input parameters in a ...
0
votes
1answer
345 views

Comparing performance of different C++ self-made tree data structures

I have two tree data-structures that I made in C++ , and they give a response for range queries/point queries in that program. I am using Ubuntu. I need help in understanding the way to compare the ...
5
votes
3answers
342 views

Generic and type safe I/O model in any language

I am looking for an I/O model, in any programming language, that is generic and type safe. By genericity, I mean there should not be separate functions for performing the same operations on different ...
1
vote
2answers
386 views

Python reading from stdin while doing other tasks

I am trying to write a system log parser. It will receive messages from the FreeBsd syslog daemon through stdin. It will use those messages to determine if an ip should be banned or not. The problem ...
1
vote
3answers
157 views

Is it better to save output from command in memory and store later or save in a temporary file and then move to final location?

I hope this is not off topic. I have to save output from a command to file, but only if length of this output is positive. I've thought about two solutions: save output to a python variable, check ...
1
vote
3answers
392 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? ...
0
votes
1answer
2k views

I/O interface for portable library

I'm writing a new .NET portable library that can read a file format, and file I/O is not available for portable libraries. The article "How to Make Portable Class Libraries Work for You" states that ...
4
votes
1answer
199 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
105 views

creating simple states for a stateless input

Given an input device (basically a keyboard) that reports keyup and keydown, how may I most efficiently store and retrieve information about which keys are currently depressed? My first thought was a ...
1
vote
1answer
505 views

Using assembly to write to a file

I am working with a trading application (reading data from the exchange) which generates a bucket load of data on a per second basis. We have different "log-levels" but even the minimal log-level ...
1
vote
1answer
74 views

Need some input on storing stdin, stdout, stderr information for debugging

I am working with a legacy system that is not too bad, but I thought of making some improvements to it, and I wanted to solicit your feedback to help me make good decisions. The platform is Linix ...
9
votes
1answer
366 views

Model-View-Controller (MVC) Which component handles save/load operations?

In a traditional MVC application, which component (model, view, or controller) is responsible for reading/writing the model to/from disk?
16
votes
5answers
2k views

At what point is asynchronous reading of disk I/O more efficient than synchronous?

Assuming there is some bit of code that reads files for multiple consumers, and the files are of any arbitrary size: At what size does it become more efficient to read the file asynchronously? Or to ...
2
votes
1answer
191 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 ...
1
vote
1answer
3k 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
2k 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 ...
2
votes
1answer
62 views

Reading data from file and const

Is it sane to let a read method on a file object to be const? For example size_t read(void* buffer,size_t length) const; The read method does not change the contents of the file, but updates the ...
40
votes
5answers
3k views

Critique of the IO monad being viewed as a state monad operating on the world

The IO monad in Haskell is often explained as a state monad where the state is the world. So a value of type IO a monad is viewed as something like worldState -> (a, worldState). Some time ago I ...
3
votes
2answers
1k views

Abstracting a zip as a filesystem - C++ [closed]

I would like to access in read and write mode to a zip without decompressing it on disk: what options do I have? I need to perform the usual IO actions reserved for a filesystem like reading, writing ...
5
votes
2answers
465 views

Design pattern for an automated mechanical test bench

Background I have a test fixture with a number of communication/data acquisition devices on it that is used as an end of line test for a product. Because of all the various sensors used in the ...
0
votes
3answers
223 views

Reading input all together or in steps?

For many programming quizzes we are given a bunch of input lines and we have to process each input , do some computation and output the result. My question is what is the best way to optimize the ...
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 ...
3
votes
5answers
4k 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 ...