io

Java file input and output

I have the below method which is meant to append information to a file but I get the error below. In the method I use parts of robocode API which inherits from java.io.InputStream All the permissions on the files and folders seem fine and the file does exist static public void logInfo(String info) { RobocodeFileWriter in;...

How to design a "web spider" with state in Haskell?

I am learning Haskell after years of OOP. I am writing a dumb web spider with few functions and state. I am not sure how to do it right in FP world. In OOP world this spider could be designed like this (by usage): Browser b = new Browser() b.goto(“http://www.google.com/”) String firstLink = b.getLinks()[0] b.goto(firstLink) print(b....

output as part of input stream

Is there a way to output some text and allow a user to edit and submit as System.in? Obviously System.out.print is not editable... Eg. system outputs: Hallo user edits to: Hello system echos: Hello ...

Read one string at a time from a file in C

How do I read input one string at a time to call another function in C. I thought this would work, but my output hangs: #define BUFFMT "%255" #define LINE_LEN 256 #define START_COUNT 1 // filename is declared in the main file elsewhere. I know the file opens since I tried an //old method I use to read one line at time using fgets, bu...

What 0 returned by InputStream.read() means? How to handle this?

What 0 (number of bytes read) returned by InputStream.read means? How to handle this situation? Update: I mean read(byte[] b) or read(byte[] b, int off, int len) methods which return number of bytes read. ...

C++ ">>" and "<<" IO in C# ?

Is there a C# library that provides the functionality of ">>" and "<<" for IO in C++? It was really convenient for console apps. Granted not a lot of console apps are in C#, but some of us use it for them. I know about Console.Read[Line]|Write[Line] and Streams|FileStream|StreamReader|StreamWriter thats not part of the question. I dont...

Saving MP3 playlist to file

Hello. I am making my own crude MP3 player, and I now have a JList with which I have populated a number of files in the form of MP3 objects (displayed on frame using DefaultListModel). I would now like to have the oppurtunity to save this JList to a file on disk. How would I go about doing this? I'm very new with programming and Java,...

Reading the content of a PDA directory while sync with ActiveSync

Hi, I have a project in which I would need to copy files found within a PDA (in my case, it's a MC3000 if that makes any difference). I have ActiveSync installed and it create the syncronisation folder for me just fine. However, I would like to be able to read the content of the PDA not only in its MyDocument Folder so I can't use this ...

Get FILE* from fstream

Possible Duplicate: Getting a FILE* from a std::fstream Is there a way to obtain a FILE* from an a iostream derived class? Particularly from an fstream? ...

MySQL innodb seeks vs. contiguous reads tradeoff

Would mysql (innodb) support a higher rate (queries per second) of queries like (A) or (B)? (A) SELECT * FROM t1 WHERE pkey BETWEEN 2000 and 2001 AND x > 300 In (A), the primary key selects a range of 800 rows. "x" is unindexed. there's one range lookup and 1 contiguous read of length 200kb. (B) (SELECT * FROM t1 WHERE pkey BETWEEN 20...

Java: How do I pipe InputStream to standard out?

Is there an easy (therefore quick) way to accomplish this? Basically just take some input stream, could be something like a socket.getInputStream(), and have the stream's buffer autmoatically redirect to standard out? ...

How do I access a network drive through the usual System.IO classes?

My software handles multiple operations on files, and I have now finished writing the related functions, using the System.IO classes. I now need to add support for network drives. Using a mapping works very well (although Directory.GetFiles is a bit low, and I don't know why), but I'd now like to be able to deal directly with paths such...

Java: Proper Network IO handling?

The problem I am having is that when I use an InputStream to read bytes, it blocks until the connection is finished. EG: InputStream is = socket.getInputStream(); byte[] buffer = new byte[20000]; while (is.read(buffer) != -1) { System.out.println("reading"); } System.out.println("socke...

Discussion with a sub-process, using Ruby with IO and threading

Hi everyone, I am trying to use IO.popen in order to put (with .puts method) and to get (with .gets method) messages from a process to its sub-process. I am not very experimented and I have a question about. Having the following code, I have an error because it is not possible to write in a closed stream. class Interface def initia...

Is there a concise way to create an InputSupplier for an InputStream in Google Guava?

There are a few factory methods in Google Guava to create InputSuppliers, e.g. from a byte[]: ByteStreams.newInputStreamSupplier(bytes); Or from a File: Files.newInputStreamSupplier(file); Is there a similar way to to create an InputSupplier for a given InputStream? That is, a way that's more concise than an anonymous class: new...

Java File I/O - Text File - how to edit something?

If I have a a textfile say file.txt and it contains random words like: fruit:apple fruit:orange fruit:grape In java, if i wanted to change the second line to read fruit:pear how could i do it? I know how to append onto the end of a txt file like so: BufferedWriter wrtr = new BufferedWriter(new FileWriter(file.txt, true)); wrtr.write(...

Java: Send BufferedImage through Socket with a low bitdepth

Hi, The title says enough I think. I have a full quality BufferedImage and I want to send it through an OutputStream with a low bitdepth. I don't want an algorithm to change pixel by pixel the quality, so it is still a full-quality. So, the goal is to write the image (with the full resolution, full size) through the OuputStream which t...

How to create a file in java without a extension

Is it possible in java to create a file without extension ...

How to perfrom Cross-Platform Asynchronous File I/O in C++

I am writing an application needs to use large audio multi-samples, usually around 50 mb in size. One file contains approximately 80 individual short sound recordings, which can get played back by my application at any time. For this reason all the audio data gets loaded into memory for quick access. However, when loading one of these f...

How many files can i have opened at once?

On a typical OS how many files can i have opened at once using standard C disc IO? I tried to read some constant that should tell it, but on Windows XP 32 bit that was a measly 20 or something. It seemed to work fine with over 30 though, but i haven't tested it extensively. I need about 400 files opened at once at max, so if most moder...