inputstream

iPhone. Establishing a binary data stream with an HTTP server.

How do I establish an input stream over HTTP for the iPhone? My project is to incrementally pull binary data from an HTTP server to the iPhone. The pattern is to pull some data - this is a scientific app - analyze it for a while, pull more data. Rince, and repeat. This project is a port of a desktop Java app which relies on InputStream ...

Write a binary downloaded file to disk in Java

Hello, I have a software that allow to write add-on in javascript files (.js) that allow to use Java function (I don't know if this is common, I never saw java call in javascript file before) I need to download a binary file from a webserver and write it to the hard drive. I tried the following code: baseencoder = new org.apache.commo...

Problem with kbhit()[and getch()] for Linux.

while(ch != 'q') { printf("looping\n"); sleep(1); if(kbhit()) { ch = readch(); printf("you hit %c\n",ch); } } This code gives me a blocking getch() like functionality. I am trying to use this code to capture up down arrow keys. Added: Trying to capture key codes of up arrow gives me 3 chars 27, 91 and 65. Using i...

How can I check if an InputStream is empty without reading from it?

I want to know if an InputStreamn is empty, but without using the methods read(). Is there a way to know if it's empty without reading from it? ...

Multiple read from an InputStream at different rates

I'm about to load an online content (say an audio file). If I just open a connection to the remote file (for example by use of new URL().openStream()) and pass the remote InputStream to the audio player, it reads gradually from the network. If audio player library do not ask InputStream for more data, it reads nothing from the network, a...

Java-Sockets: InputStream.read() vs BufferedReader.read()

Hello I'm reading from a Socket's InputStream. Because I'm parsing the incoming data on the fly, I'm required to read character by character. Does BufferedReader.read() the same thing as InputStream.read() does ? (assuming that BufferedReader has been constructed with the InputStream as base) Is it more efficient to use InputStream.re...

Connecting an input stream to an outputstream

I saw some similar, but not-quite-what-i-need threads. I have a server, which will basically take input from a client, client A, and forward it, byte for byte, to another client, client B. I'd like to connect my inputstream of client A with my output stream of client B. Is that possible? What are ways to do that? Also, these clients...

Using cin.get() to grab a line of text, then using it in a loop to display that line?

Ok, so I came across this code snippet in my textbook that's supposed to echo every other character a user types in. Now, I understand the every other character part, but I'm having difficulty with the use of cin.get(). I understand why the first cin.get() is there, but why is it also inside the loop? I'm guessing I'm not fully grasping ...

Grails, getting InputStream from Controller (or even Servlet)

I'm trying to get inputStream from request, but it's always empty. Any idea how to get the contents of it? I'm trying to make a DataInputStream from it. ...

Visual Basic (Visual Studio 2005) redirect inputstream to process

Hi, I've been searching around the net for roughly three hours now w/o getting forward. I don't know VB very well, but I need to create a wrapper program for any executable that logs the arguments, all input, output and err information: My wrapper is called: e.g. someApp.exe arg1 arg2 Logs to someApp.log: arg1 arg2 Calls original execu...

In C++, can you manually set the failbit of a stream? How?

I am overloading the input stream operator for use with a Time class and would like to manually set the failbit of the input stream if the input doesn't match my expected time format (hh:mm). Can this be done? How? Thanks! ...

Access to Perl's empty angle "<>" operator from an actual filehandle?

I like to use the nifty perl feature where reading from the empty angle operator <> magically gives your program UNIX filter semantics, but I'd like to be able to access this feature through an actual filehandle (or IO::Handle object, or similar), so that I can do things like pass it into subroutines and such. Is there any way to do this...

InputStreamReader.markSupported is false

Hello, I need to “un-read” characters from an InputStreamReader. For that purpose I wanted to use mark and reset but markSupported returns false for the InputStreamReader class, since it doesn’t maintain an internal buffer and/or queue of characters. I know about BufferedInputStream and PushbackInputStream but neither is appropriate he...

How to log request inputstream with HttpModule, then reset InputStream position.

I am trying to log the contents of an http request, using an IHttpModule like so: public class LoggingModule : IHttpModule { public void Init(HttpApplication context) { context.BeginRequest += ContextBeginRequest; } private void ContextBeginRequest(object sender, EventArgs e) { var request = ((HttpAp...

starting vlc player in java

Hey! I tried to start vlc player in Java, but somehow it did not word. Any other Prog I tried worked. Plz have a look at my code: try { Runtime.getRuntime().exec("K:\\...\\vlc.exe"); } catch (Exception ex) { System.out.println(ex); } Where is the problem starting videoLAN Player? ...

how to catch blank input with scanner class in java

I am using the scanner class to capture user input from the command line (strings only), as an alternative to my previous question. The following seems to work fine, except the blank lines are not caught as they should by the second conditional. For example when I press enter, this should be captured as a blank line and the second condi...

Java Project Modules - use InputStream/OutputStream or .tmpFile/byte[]

Hi all, I found myself passing InputStream/OutputStream objects around my application modules. I'm wondering if it's better to - save the content to disk and pass something like a Resource between the various methods calls - use a byte[] array instead of having to deal with streams everytime. What's your approach in these situatio...

How do I convert an InputStream to a String in Java?

Suppose I have an InputStream that contains text data, and I want to convert this to a String (for example, so I can write the contents of the stream to a log file). What is the easiest way to take the InputStream and convert it to a String? public String convertStreamToString(InputStream is) { // ??? } ...

reading excel cell contents as Java InputStream

this code reads contents of cell of excel file into a string String theCell_00=rs.getCell(j,i).getContents(); is there any method using which the contents of excel cell are read as Java InputStream i need to read excel cell content and pass the contents to InputStream argument of this function public void encrypt(InputStream in, Out...

Eclipse throwing ClassNotFoundException despite me having added the proper Apache POI .jar File ?

I'm using a servlet to upload .xls (Excel Spreadsheets) files to the server. I'm using the Apache FileUpload API for the upload portion of the business logic, to ensure weather this part is working, I have successfully attempted uploading a .txt file to the Servlet after which -- the Apache FileUpload API, from the servlet side gives me ...