Results 1 to 1 of 1
Thread: JSP- Binary output stream
-
JSP- Binary output stream
The example below shows how to open a binary output stream from a JSP.
Java Code:<%@ page import="java.io.*" %> <%@ page import="java.net.*" %> <%@page contentType="image/gif" %><% OutputStream o = response.getOutputStream(); InputStream is = new URL("http://myserver/myimage.gif").getInputStream(); byte[] buf = new byte[32 * 1024]; // 32k buffer int nRead = 0; while( (nRead=is.read(buf)) != -1 ) { o.write(buf, 0, nRead); } o.flush(); o.close();// *important* to ensure no more jsp output return; %>
Similar Threads
-
binary search
By tranceluv in forum New To JavaReplies: 10Last Post: 01-14-2008, 07:13 PM -
Binbot Binary Newsreader 1.1.1
By JavaBean in forum Java SoftwareReplies: 0Last Post: 11-02-2007, 03:24 PM -
java.lang.NumberFormatException: For input stream:jav
By osval in forum New To JavaReplies: 2Last Post: 08-07-2007, 03:50 PM -
stream redirection
By Ed in forum New To JavaReplies: 1Last Post: 07-02-2007, 04:34 PM -
video stream
By Alan in forum Advanced JavaReplies: 2Last Post: 05-17-2007, 08:12 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks