Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

reading an html  RSS feed

 
Raj Kumar Bindal
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am reading an html in jsp through input Stream.While reading, i want to make changes in the contents and after those changes,i need to display to browser.But, i am finding it very difficult to take all bytes of the file somewhere,so planning to take that in a byte array.After,that i need to perform some find and replace operations on that array and then write that to browser using out.write().

1. I am not able to make byte array of size file length.because file.length() returns long and byte bytearray = new byte[file.length] is giving compilation error.I don't want to typecast long to int as contents may get truncated.

2.I am not able to perform replace operation on byte array.

Can anyone suggest something.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suggestion: ALL operations such as you are attempting should be done in a servlet because JSP has many built in assumptions. A servlet will give you control of the output stream without these assumptions.

Bill
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!