This content has been marked as final. Show 7 replies
Use a BufferedStream or a BufferedReader as you prefer.
I have no idea what limit you are on about or what any of this has to do with any charset in particular or unicode and I rather think you don't know either.
So try a buffered in of some sort and then if you are having problems come back and post whatever error message and whatever exact problem you are having.
Here i'm reading as byte reader or otherwise for
i don't have anything else to read as someother array. For first argument i think it takes only character. I'm getting this error.......
String strUnicode = new String(ch,"UTF-8");
can u provide me code for this....
java.lang.NegativeArraySizeException com.myapp.struts.ReportSummaryAction.execute(ReportSummaryAction.java:57) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
is bad news. You are casting a long into a byte so you're losing 7 bytes worth of valuable information.
byte len = (byte) ff.length(); byte ch = new byte[len];
This is a little better.
int len = (int) ff.length(); byte ch = new byte[len];
i've put ur code it is working for some limit say 50 characters. But when i give more than that it shows the same error. When there is a text file with say 100 characters unicode in it. I want to read those character and display it on jsp page. When the contents of the unicode file more than 100 characters it is giving me the some error.... or sometimes it truncates the other charcters and show the remaining characters...
can u provide me a code for this..... still i'm getting error..... it's an abstract class, only method i've to implement..
//InputStreamReader public InputStreamReader(InputStream in, String charsetName) throws UnsupportedEncodingException //Create an InputStreamReader that uses the named charset.