InputStreamReader: reads too much?

i read text from an InputStreamReader:
int count;
char[] chars = new char[2048];
while ((count = isr.read(chars, 0, chars.length)) != -1) {
    textArea.append(new String(chars));
}and noticed that too much text is read! I i increase chars (e.g. 4096 bytes), more additional text is read. It seems, that the read() method for the last call does not clear 'chars' and therefore has additional (old) characters in the 'chars' buffer(?). how can this be avoided?
(note: I need to read from inputstreamreader, not e.g. from a BufferedReader, as ProgressMonitorInputStream can't be used with Readers.)

well, again: of course, it appends the complete array
chars[] but it doesn't clear the contents before each
read! a workaround would be:
int count;
char[] chars = new char[2048];
while ((count = isr.read(chars, 0, chars.length)) !=
-1) {
textArea.append(new String(chars));
chars = new char[2048]; //fix: clear content for
for next read
}to not have the content of the previous read in the
chars[] array. but this should be done by the read()
method in the first place.No, the approach should be -
int count;
char[] chars = new char[2048];
while ((count = isr.read(chars, 0, chars.length)) != -1) {
textArea.append(new String(chars, 0, count));
Roger

Similar Messages

  • Can you please put me in touch with the support  for the trial copy of adobe acrobat XI pro which I had tried out on March 15 for 30 days. I have  been trying to cancel since the cost is too much and Acrobat Reader is OK for me. I can't find uninstaller.

    Can you please put me in touch with the support  for the trial copy of adobe acrobat XI pro which I had tried out on March 15 for 30 days. I have  been trying to cancel since the cost is too much and Acrobat Reader is OK for me. I can't find uninstaller.
    I have had to erase my disk since then with trouble with Apple Store not recognising my machine and the reload from Time Machine has given complications . Can you please cancel my trial and return my Trial money.

    If you paid for what you used then it was not a trial.
    Look thru the following links and use the chat option if required for your situation:
    Cancel your membership or subscription | Creative Cloud
    https://helpx.adobe.com/x-productkb/policy-pricing/cancel-membership-subscription.html
    https://forums.adobe.com/thread/1703848
    Chat support - For the link below click the Still Need Help? option in the blue area at the bottom and choose the chat option...
    Creative Cloud support (all Creative Cloud customer service issues)
    http://helpx.adobe.com/x-productkb/global/service-ccm.html ( http://adobe.ly/19llvMN )
    Phone support | Orders, returns exchanges
    http://helpx.adobe.com/x-productkb/global/phone-support-orders.html

  • Archive Delete job taking too much time - STXH Sequential Read

    Hello,
    We have been running Archive sessions in our production system in last couple of months. We use SARA and selecting the appropriate variants for WRITE, DELETE and STORAGE options.
    Currently we use the Archive object FI_DOCUMNT and the write job is finished as per the normal time (5 hrs based on the selection criteria). After that normally the delete job is used to complete in 1hr or less than 2hrs always (in last 3 months).
    But in last few days the delete job is taking too much to complete (around 8 - 10hrs) when I monitor the system found that the Sequential Read for table STXH is taking too much time to read and it seems this is the cause.
    Could you please provide a solution for the same, so that the job will run faster as earlier.
    Thanks for your time
    Shyl

    Hi Juan,
    After the statistics run the performance is quite good. Now the job getting finished as expected.
    Thanks. Problem solved
    Shyl

  • Too much to ask? Windows 8 epub reader + Adobe DRM...

    Hello all,
    Is it just too much to ask to read an Adobe DRM protected epub document in a nice metro-friendly Windows 8 interface (which Adobe Digital Editions most certainly is not)?
    I have spent hours today looking for that little Holy Grail The only Windows applications I could find that would open Adobe DRM epubs (in addition to Adobe Digital Editions, of course) was Neosoar and Copia, neither of which qualify as a nice metro-friendly interface. Don't get me wrong, lots of nice Windows epub readers out there e.g. Freda, Kobo, Calibre but they'll be damned if they're going to interface with Adobe DRM!
    I've bought the book; I just want to read it without fighting Adobe DRM at every turn. Any light on the horizon?
    David.
    ...and what about Microsoft Reader? Did they even mean to publish that? My ear wax provides more utility than that app.

    Hello all,
    Is it just too much to ask to read an Adobe DRM protected epub document in a nice metro-friendly Windows 8 interface (which Adobe Digital Editions most certainly is not)?
    I have spent hours today looking for that little Holy Grail The only Windows applications I could find that would open Adobe DRM epubs (in addition to Adobe Digital Editions, of course) was Neosoar and Copia, neither of which qualify as a nice metro-friendly interface. Don't get me wrong, lots of nice Windows epub readers out there e.g. Freda, Kobo, Calibre but they'll be damned if they're going to interface with Adobe DRM!
    I've bought the book; I just want to read it without fighting Adobe DRM at every turn. Any light on the horizon?
    David.
    ...and what about Microsoft Reader? Did they even mean to publish that? My ear wax provides more utility than that app.

  • I own CS 5Premium. Reading the FAQs, it seems I am eligible to upgrade to CS 6 but I can't find the upgrade to purchase and download. I can't upgrade to CC because $49 per month is too much for me -- I don't use this product for work. The $29 offer seems

    I own CS 5 Design Premium. Reading the FAQs, it seems I am eligible to upgrade to CS 6 but I can't find the upgrade to purchase and download. I can't upgrade to CC because $49 per month is too much for me -- I don't use this product for work. The $29 offer seems reasonable but $49 is way too much. I don't need the majority of the programs included in CC, but subscribing to just three of them will cost way more. Really not sure what to do here :-(

    Thanks Ned. I did find this page, however it isn't an upgrade. I have been purchasing Adobe products for years so that I could just pay the upgrade price for current products. With the current system, I would be paying much more than I would for an upgrade. For example, I have been using my version of CS for at least three years. The upgrade cost me $750 so that comes out to around $21 per month. I guess I have no options as far as upgrading except for paying for the overpriced CC. Oh well, time to start looking for alternatives. It was just so convenient to have the same programs at home that I use at work.

  • I scratched the numbers too much on a itunes card and i cannot read it what do i do?

    I scratched the numbers too much on a itunes card and i cannot read it what do i do?

    See if you can recieve a refund. Do the best you can to make out the number/letters.
    -MightEMouse

  • Malicious or not? Message popped up: Mozilla security found (something like too much, forget exact word) activity on your computer so it will do a fast scan of system file. With OK button.

    I was looking at youtube.com, which always tells me my browser is not supported and recommends I download Firefox, but that is what I was using, so I went to Firefox to check for updates. (I think I also had freecycle.org open.) Then this message popped up in a new page: Mozilla security found (something like "too much", forget exact word) activity on your computer so it will do a fast scan of system file. There was an OK button. The page address was: http://update17.stegner.ce.ms/index.php?Q7Lhl9ShbRxGJXpkM1VLSi4ZE8H4pTedoVPySgeppM3VpC+thEspcFG7qxHgn1pdsC2h5ygPGWI3t5hXqMzL9EQaZZ3J1e3CKXgCb0Qp. I did not click OK but copied the link and closed the window which closed the internet. I have never seen this before and would like to know if it is really Mozilla or possibly something malicious. Thank you.

    Good catch. That almost certainly is an invitation to download malware.
    There are a lot of infected web sites pushing "fake antivirus" software. If you have any doubts about whether your system might have become infected, you can supplement your regular security software with these two highly regarded scanners:
    Malwarebytes Anti-malware : http://www.malwarebytes.org/mbam.php
    SUPERAntiSpyware : http://www.superantispyware.com/

  • Sites Taking too much time to open and shows error

    hi, 
    i've setup sharepoint 2013 environement correctly and created a site collection everything was working fine but suddenly now when i am trying to open that site collection or central admin site it's taking too much time to open a page but most of the time
    does not open any page or central admin site and shows following error
    event i go to logs folder under 15 hive but nothing useful found please tell me why it takes about 10-12 minutes to open a site or any page and then shows above shown error. 

    This usually happens if you are low on hardware requirements.  Check whether your machine confirms with the required software and hardware requirements.
    https://technet.microsoft.com/en-us/library/cc262485.aspx
    http://sharepoint.stackexchange.com/questions/58370/minimum-real-world-system-requirements-for-sharepoint-2013
    Please remember to up-vote or mark the reply as answer if you find it helpful.

  • Error message (Because a USB device was drawing too much power)

    Hi Everyone,
    Bought recently a new macbook pro 13 inch with Retina display with 120 GB flash drive.
    Connected a non-apple CD drive to my macbook and after that started receiving this message: "Because a USB device was drawing too much power from your computer, one or more of your USB devices have been disabled."
    initially I was receiving this message after I switch on my macbook but now after every 30 seconds this message pops up although I never connected anything to my macbook through its USB ports.
    Will highly appreciate for your help on how to get rid of this problem.
    Regards
    Homayun

    Try resetting the SMC
    Shut down the computer.
    Plug in the MagSafe power adapter to a power source, connecting it to the Mac if its not already connected.
    On the built-in keyboard, press the (left side) Shift-Control-Option keys and the power button at the same time.
    Release all the keys and the power button at the same time.
    Press the power button to turn on the computer. 
    Note: The LED on the MagSafe power adapter may change states or temporarily turn off when you reset the SMC.

  • Can too much memory lead to a kernel panic on a MacBook Pro? specs 2.4GHz intel core i7 16GB DDR3 RAM   late2011..My laptop began suffering from kernel panics 3 mos ago first noticed using public wifi. Gone thru apple support all the way to engineers

    Can too much RAM memory in a late 2011 model macbook pro lead to kernel panic? That is what I was told by a senior supervisor from apple support who troubleshot this issue.First noticed this problem in Dec 2014 while using a private wifi at a relative's home. Did not occur again until Feb1 using a public wifi at a hotel. Never happened on my private wifi network until last night  attempting to use airplay. ( have used airplay before without issue). Late 2011 MacBook Pro running 10.9.5; 2.4 GHz Intel core i7, 16 GB DDR3,AMD Radeon HD 6770m 1024 MB graphic card.  The laptop came with 8GB RAM and I installed 8 GB about 2 years ago for some reason I cannot remember... probably because I thought the system was slowing down a little. I know that sounds silly. I do not run multiple programs at a time except I leave 6-8 website tabs open simultaneously. I don't photo or video edit.  I would describe my use as "light"  based on reading these blogs.I had purchased apple support and spent hours on the phone with them in early Feb moving up through support  and senior support to sending logs to the "engineers." Of course lots of things were done some of which I am sorry to report I cannot recall their technical definitions. Deleted  3rd party apps/programs; re-worked start up menu; re-installed operating system; reset " this, that and the other" using acrobatic simultaneous key strokes both in and out of safe mode..Anyway the results from the engineers came back and they suggested that if it happened again I was to remove the 8GB of RAM I had installed as the system was getting confused as to which chip to use.( that is my interpretation of what was said..prob dumbed down for me)...Anyway 1 day after these pronouncements came down I read that Apple had agreed to fix  graphics cards in some late model 2011 MBPs. I felt this was unlikely to be the issue  given all that had been done including an extended hardware test but called the Senior Support Supervisor I was working with to ask him to make sure. He never phoned me back. Should I go to the trouble of removing 8GB of RAM from my laptop? Of course I will try it as the alternative is a new computer.Blogs read that this model can support 16GB but Apple didn't test for it. Senior Supervisor claims this is my trouble.  Does that make sense?  Not to me....but it is clear to all my level of knowledge.  Can a malfunctioning graphics card be missed by an extended hardware test? I appreciate comments.

    The RAM needs specs as shown below.
    Maximum Memory
    16 GB (Actual) 8 GB (Apple)
    Memory Slots
    2 - 204-pin PC-10600 (1333 MHz) DDR3 SO-DIMM

  • White MacBook takes too much time to boot up

    Hi there.
    I got the topcase(keyboard) of my MacBook repaired. (White MacBook 2006) and after that it takes nearly 7 up to 10 seconds after pressing the power button that I first see apple logo and it boots up.
    I'm not sure but seems like that detecting the hardwares take too much time .
    any solution?
    PS: I'm running Snow Leopard(10.6.2)

    macbig wrote:
    OK, 32 seconds is not good. I don't think it has anything to do with a keyboard repair. You need to try a little maintenance: Reset Pram - http://docs.info.apple.com/article.html?artnum=2238
    Repair Permissions - http://support.apple.com/kb/HT1452
    Run Disk Utility >applications>utilities>disk utilities>verify disk
    How much free space do you have on your HD: Right click on HD icon and select "get info" in the drop down menu (if you don't have right click capabilities, highlight your HD icon, go file in the Apple menu, and select "get info" in the drop down menu. Let us know your results.
    Yes PRAM was the the problem, I've already tried it from this thread http://discussions.apple.com/thread.jspa?threadID=2303507&tstart=0
    by the way thank you .

  • SCRIPT5007: Unable to get property 'top' of undefined or null and too much recursion

    I am not sure about placing two questions into one post, but here it goes:
    The error above  "SCRIPT5007: Unable to get property 'top' of undefined or null" is coming from this function:
    Code: 
    $(function () { //this is the way to run your code at the DOM Ready event  $('a').click(function () { $('html, body').animate({ scrollTop: $($(this).attr('href')).offset().top }, 1500); return false; });  });
    This is the effected code I believe that is causing the problem:
    Code: 
    scrollTop: $($(this).attr('href')).offset().top
    the error occurs when I click on a "clear" button in my form. My website is one long page and that function allows my navigation to slide up and down the site. Without it, everytime you click a nav, it jumps to that anchor.
    For the 2nd problem, the too much recursion, the problem lies within here:
    Code: 
    function () { if ($.isReady) return; imReady = true; $.each($.includeStates, function (url, state) { if (!state) return imReady = false }); if (imReady) { $.readyOld.apply($, arguments) } else { setTimeout(arguments.callee, 10) } }
    where the error is actually coming from the 2nd "function" script. This is part of the browser compatibility script for mozilla/opera at the top of the index page. Any help would be great. Thanks.

    Ahh I apologize. I simply was posting to JavaScript forums in hopes of
    finding a solution. Sorry for the mixup.

  • HT4106 How do I use a midi keyboard on GarageBand with my iPad? When I try it says the device cannot be used as it requires too much power.  However, I have given the midi it's own power source.

    How do I use a midi keyboard as an input device on garageband? Its an oxygen 61 board.  I'm using an iPad camera connection kit and a separate power source for the midi but each time it says it cannot use the midi as it requires too much power. 

    I have the same problem with my iPad and 61. Sometimes it says device not supported and sometimes it rants about power - any solutions anyone ?

  • MacBook pro 13" mid 2010 "USB drawing too much power" HELP

    Hi, my MacBook Pro keeps coming up with a window about 30 after start up saying "USB drawing too much power" and none if the USB ports work neither does the iSight camera (green light is constantly on) and the headphone jack won't work! I have tried re installing OSX but it hasn't worked! Apart from an SMC reset and a PRAM what else can I try? Absolutely nothing is plugged in not a single cable or keyboard or mouse just my MacBook on its own, is it definitely a software problem or am I going to have to get apple to repair the hardware because I do not have that much money to replace a logic board and get apple to replace it themselves. Thanks in advance!

    I hope it works for you ...

  • Taking too much time to load application

    Hi,
    I have deployed a j2ee application on oracle 10g version 10.1.2.0.2. But the application is taking too much time to load. After loading ,everything works fast.
    I have another 10g server (same version) in which the same application is loading very fast.
    When I checked the apache error logs found this :-
    [Thu Apr 26 09:17:31 2007] [warn] [client 10.1.20.9] oc4j_socket_recvfull timed out
    [Thu Apr 26 09:17:31 2007] [error] [client 10.1.20.9] [ecid: 89128867058,1] (4)Interrupted system call: MOD_OC4J_0038: Receiving data from oc4j exceeded the configured "Timeout" value and the error code is 4.
    [Thu Apr 26 09:17:31 2007] [error] [client 10.1.20.9] [ecid: 89128867058,1] MOD_OC4J_0054: Failed to call network routine to receive an ajp13 message from oc4j.
    [Thu Apr 26 09:17:31 2007] [error] [client 10.1.20.9] [ecid: 89128867058,1] MOD_OC4J_0033: Failed to receive an ajp13 message from oc4j.
    [Thu Apr 26 09:17:31 2007] [warn] [client 10.1.20.9] [ecid: 89128867058,1] MOD_OC4J_0078: Network connection errors happened to host: lawdb.keralalawsect.org and port: 12501 while receiving the first response from oc4j. This request is recoverable.
    [Thu Apr 26 09:17:31 2007] [error] [client 10.1.20.9] [ecid: 89128867058,1] MOD_OC4J_0121: Failed to service request with network worker: home_15 and it is not recoverable.
    [Thu Apr 26 09:17:31 2007] [error] [client 10.1.20.9] [ecid: 89128867058,1] MOD_OC4J_0013: Failed to call destination: home's service() to service the request.
    [Thu Apr 26 11:36:36 2007] [notice] FastCGI: process manager initialized (pid 21177)
    [Thu Apr 26 11:36:37 2007] [notice] Oracle-Application-Server-10g/10.1.2.0.2 Oracle-HTTP-Server configured -- resuming normal operations
    [Thu Apr 26 11:36:37 2007] [notice] Accept mutex: fcntl (Default: sysvsem)
    [Thu Apr 26 11:36:37 2007] [warn] long lost child came home! (pid 9124)
    [Thu Apr 26 11:39:51 2007] [error] [client 10.1.20.9] [ecid: 80547835731,1] MOD_OC4J_0015: recv() returns 0. There has no message available to be received and oc4j has gracefully (orderly) closed the connection.
    [Thu Apr 26 11:39:51 2007] [error] [client 10.1.20.9] [ecid: 80547835731,1] MOD_OC4J_0054: Failed to call network routine to receive an ajp13 message from oc4j.
    [Thu Apr 26 11:39:51 2007] [error] [client 10.1.20.9] [ecid: 80547835731,1] MOD_OC4J_0033: Failed to receive an ajp13 message from oc4j.
    [Thu Apr 26 11:39:51 2007] [warn] [client 10.1.20.9] [ecid: 80547835731,1] MOD_OC4J_0078: Network connection errors happened to host: lawdb.keralalawsect.org and port: 12501 while receiving the first response from oc4j. This request is recoverable.
    [Thu Apr 26 11:39:51 2007] [warn] [client 10.1.20.9] [ecid: 80547835731,1] MOD_OC4J_0184: Failed to find an oc4j process for destination: home
    [Thu Apr 26 11:39:51 2007] [error] [client 10.1.20.9] [ecid: 80547835731,1] MOD_OC4J_0145: There is no oc4j process (for destination: home) available to service request.
    [Thu Apr 26 11:39:51 2007] [error] [client 10.1.20.9] [ecid: 80547835731,1] MOD_OC4J_0119: Failed to get an oc4j process for destination: home
    [Thu Apr 26 11:39:51 2007] [error] [client 10.1.20.9] [ecid: 80547835731,1] MOD_OC4J_0013: Failed to call destination: home's service() to service the request.
    [Thu Apr 26 11:46:33 2007] [notice] FastCGI: process manager initialized (pid 21726)
    [Thu Apr 26 11:46:34 2007] [notice] Oracle-Application-Server-10g/10.1.2.0.2 Oracle-HTTP-Server configured -- resuming normal operations
    [Thu Apr 26 11:46:34 2007] [notice] Accept mutex: fcntl (Default: sysvsem)
    [Thu Apr 26 11:46:34 2007] [warn] long lost child came home! (pid 21182)
    [Thu Apr 26 11:53:32 2007] [warn] [client 10.1.20.9] oc4j_socket_recvfull timed out
    [Thu Apr 26 11:53:32 2007] [error] [client 10.1.20.9] [ecid: 89138452752,1] (4)Interrupted system call: MOD_OC4J_0038: Receiving data from oc4j exceeded the configured "Timeout" value and the error code is 4.
    [Thu Apr 26 11:53:32 2007] [error] [client 10.1.20.9] [ecid: 89138452752,1] MOD_OC4J_0054: Failed to call network routine to receive an ajp13 message from oc4j.
    [Thu Apr 26 11:53:32 2007] [error] [client 10.1.20.9] [ecid: 89138452752,1] MOD_OC4J_0033: Failed to receive an ajp13 message from oc4j.
    [Thu Apr 26 11:53:32 2007] [warn] [client 10.1.20.9] [ecid: 89138452752,1] MOD_OC4J_0078: Network connection errors happened to host: lawdb.keralalawsect.org and port: 12501 while receiving the first response from oc4j. This request is recoverable.
    [Thu Apr 26 11:53:32 2007] [error] [client 10.1.20.9] [ecid: 89138452752,1] MOD_OC4J_0121: Failed to service request with network worker: home_15 and it is not recoverable.
    [Thu Apr 26 11:53:32 2007] [error] [client 10.1.20.9] [ecid: 89138452752,1] MOD_OC4J_0013: Failed to call destination: home's service() to service the request.
    Please HELP ME...

    Hi this is what the solution given by your link
    A.1.6 Connection Timeouts Through a Stateful Firewall Affect System Performance
    Problem
    To improve performance the mod_oc4j component in each Oracle HTTP Server process maintains open TCP connections to the AJP port within each OC4J instance it sends requests to.
    In situations where a firewall exists between OHS and OC4J, packages sent via AJP are rejected if the connections can be idle for periods in excess of the inactivity timeout of stateful firewalls.
    However, the AJP socket is not closed; as long as the socket remains open, the worker thread is tied to it and is never returned to the thread pool. OC4J will continue to create more threads, and will eventually exhaust system resources.
    Solution
    The OHS TCP connection must be kept "alive" to avoid firewall timeout issues. This can be accomplished using a combination of OC4J configuration parameters and Apache runtime properties.
    Set the following parameters in the httpd.conf or mod_oc4j.conf configuration files. Note that the value of Oc4jConnTimeout sets the length of inactivity, in seconds, before the session is considered inactive.
    Oc4jUserKeepalive on
    Oc4jConnTimeout 12000 (or a similar value)
    Also set the following AJP property at OC4J startup to enable OC4J to close AJP sockets in the event that a connection between OHS and OC4J is dropped due to a firewall timeout:
    ajp.keepalive=true
    For example:
    java -Dajp.keepalive=true -jar oc4j.jar
    Please tell me where or which file i should put the option
    java -Dajp.keepalive=true -jar oc4j.jar ??????/

Maybe you are looking for