outputstream

Using PrintWriter and OutputStream

Hello again! I am creating a project with struts and I have a problem using Jasper IReports. I want to export some info into a pdf file and I keep getting the java.lang.IllegalStateException: getOutputStream() has already been call... Exception due to openning a ServletOutputStream in my code when the page already opens a PrintWriter. ...

Overloading Output operator for a class template in a namespace.

I've this program #include <iostream> #include <sstream> #include <iterator> #include <vector> #include <algorithm> using namespace std ; #if 0 namespace skg { template <class T> struct Triplet ; } template <class T> ostream& operator<< (ostream& os, const skg::Triplet<T>& p_t) ; #endif namespace skg { template <class T> struc...

Problems writing to a unix pipe through Java

Hey, I am writing to a framebuffer located at "/dev/fb0". Everything works fine until I try to write again to the pipe using an OutputStream, which hangs the program. I have resolved this by closing the output stream and then recreating it, but this seems awfully slow and blunt. Framebuffer.java public class Framebuffer extends ...

How can I convert an uncompressed InputStream into a gzip'ed InputStream efficiently?

A user uploads a large file to my website and I want to gzip the file and store it in a blob. So I have an uncompressed InputStream and the blob wants an InputStream. I know how to compress an InputStream to an Outputstream using GZIPOutputStream, but how do I go from the gzip'ed OutputStream back to the InputStream needed by the blob....

Can I get read access to the HTTP output stream in ASP.NET?

I would like to read all content that's been written to the output stream. I'm attempting to do this using an HTTP module, and it seems like the obvious timing would be when handling the PreSendRequestContent event. However, if the output stream seems to be set to write-only, as I can't read using a StreamReader. Is there a way I read a...

Response.Stream output (a PDF) lost by Adobe Reader

In an ASP.NET application, I'm using iTextSharp (PdfStamper, mostly) to fill in some content on a PDF and send it to the user. The following code is inside an OnClick event: PdfReader r = new PdfReader( new RandomAccessFileOrArray(Request.MapPath(compatiblePdf)), null ); ps = new PdfStamper(r, Response.OutputStream); AcroFields af =...

Writing data to InputStream of grep program invoked in java

I'm trying to process data obtained from a run of diff to an instance of GNU grep in a java program. I've managed to get the output of diff using the Process object's outputStream, but I'm currently having programs sending this data to the standard input of grep (through another Process object created in Java). Running Grep with the inpu...

Is there a way to make PHP progressively output as the script executes?

So I'm writing a disposable script for my own personal single use and I want to be able see how the process is going. Basically I'm processing a couple of thousand media releases and sending them to our new CMS. So I don't hammer the CMS, I'm making the script sleep for a couple of seconds after every 5 requests. I would like - as the ...

Two OutputStream's instead of one?

I am dealing with a commerical Java API that exposes only the following logging configuration: cplex.setOut(OutputStream arg0); I would like to have logging to two streams: a file and the console. Is it possible? ...

How do I check if output stream of a socket is closed?

I have this code: public void post(String message) { output.close(); final String mess = message; (new Thread() { public void run() { while (true) { try { output.println(mess); System.out.println("The following message was successfully sent:"); ...

Trying to write a loop that uses an OutputStream to write to a text file.

I'm not a java programmer, I'm a VB programmer. I am doing this as part of an assignment, however, I'm not asking for help on something assignment related. I'd like to figure out how to get the OutputStreamWriter to work properly in this instance. I just want to capture the values I'm generating and place them into a text document. T...

No xml output on page

I am trying to output xml on my aspx page. But it returns no result. The aspx page: <%@ Page Language="C#" AutoEventWireup="false" CodeBehind="Sitemap.aspx.cs" Inherits="Servicebyen.Presentation.Web.Sitemap" %> The code behinde: protected void Page_Load(object sender, EventArgs e) { Response.Clear(); Response.ContentType = ...

Java: Is my input.readObject() getting truncated on either write or read?

I'm building a system to exchange encoded messages, call it bank and client. The first messages that I need to exchange are long Strings. They appear to be truncated either in the write or read, but I'm not sure how to figure out where. Read: client = new Socket(InetAddress.getByName(bankServer), 12345); displayMessage("Connected to:...

How to convert an InputStream to a DataHandler?

I'm working on a java web application in which files will be stored in a database. Originally we retrieved files already in the DB by simply calling getBytes on our result set: byte[] bytes = resultSet.getBytes(1); ... This byte array was then converted into a DataHandler using the obvious constructor: dataHandler=new DataHandler(byt...

How do you redirect a standard stream of a C++ routine wrapped with SWIG and exposed to Python?

Is it possible to control the standard streams of C++ code in python? The code is wrapped with SWIG and then exposed to Python where I call one of its functions. I am getting all kinds of unwanted messages coming from C++ code and I want to suppress them either by not using the output stream or by redirecting it to a bit bucket, e.g. de...

Android - Persist file when app closes.

I am creating a file in my Android application as follows: HEADINGSTRING = new String("Android Debugging " + "\n" "XML test Debugging"); } public void setUpLogging(Context context){ Log.d("LOGGING", "Setting up logging....."); try { // catches IOException below FileOutputStream fOut = context.o...

Problem with POSTing XML data to an API using Java

I'm having problem with sending XML-data using HTTP POST to an API. If I send well formatted XML, I get an error message: Server Exception: Cannot access a closed Stream If the XML isn't well formatted, I get HTTP 500. And if I just send an empty string instead of a string with XML, I get back an error message: EMPTY REQUEST. I ...

How to properly extend Java FilterOutputStream class?

I would like to roughly monitor the progress of a file upload. I know that I can override the MultipartEntity and make the writeTo(OutputStream out) method write to a FilterOutputStream class that I created to wrap the default InputStream. For full details on how I did that, see my answer here. However, upon closer inspection this coun...

java writeInt from php,

hey all i am trying to make a data output stream in php to write back primitive data types to a java application i created a class that write the data to an array (write it same as java do , copy from java code) and finally i am writing back the array to the client. feels like its not working well for example the writeInt metho...

Need Help And Ideas In Solving A Collection Problem

Hi Guys, I have already posted a question today. This question is about the same project but unrelated. I am developing an application for the Lego NXT Mindstorm robot. I have two robots and a GUI running on a PC. In leJOS NXJ you can only use one input reader. This means that you can't connect the PC to two robots directly and let th...