• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Image Servlets

Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some code that writes Images to a screen, but the images come up looking really bad. There must be a mistake in my code, see anything?

private void GIF(String f, HttpServletResponse res)

OutputStream out = res.getOutputStream();
System.out.println("################" + res.getOutputStream());

BufferedReader br = new BufferedReader(new FileReader(f));

BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(out));

char[] cbuf = new char[1024]; // read/write 1024 bytes at a time..
int len;

while ((len = br.read(cbuf, 0, 1023)) > 0)

catch(Exception e)

System.out.println("Problem rendering image" + e);
Get me the mayor's office! I need to tell her about this tiny ad:
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic