Buffer Issue with streaming 10 MB file

Hi there,
Having a bit of a nightmare, essentially I have this code:
  private void streamBinaryData(String urlstr,String format,HttpServletResponse response)
        String ErrorStr = null;
        try{
         if(urlstr==null)           
             urlstr = "c:\\video\\hoff.flv";
         File f = new File(urlstr);             
         response.setContentType("video/x-flv");
        response.setHeader ("Content-Disposition", "filename=\"hoff.flv\"");
        Long fileSize = Long.valueOf(f.length());
        response.setContentLength(fileSize.intValue());
        InputStream in = new FileInputStream(f);
        ServletOutputStream outs = response.getOutputStream();
        int bit = 0;
        System.out.println("VIDEO STREAMER: start streaming data");
            while ((bit) != -1) {
                bit = in.read();
                outs.write(bit);
            in.close();
        System.out.println("STREAMER: Finished streaming data");
        outs.flush();
        outs.close();
        catch(Exception e){
                System.out.println("DEBUG: "+ e.toString());
  }which works just fine, but as the server that will be using this code essentially just (90%) will be the use of this servlet to stream .flv files I want to make it more productive by buffering all or some of the file in order to stream.
so essentially I have tried many times and variations around the following sub code:
        InputStream in = new FileInputStream(f);
        ServletOutputStream outs = response.getOutputStream();
        int bit = 0;
        System.out.println("VIDEO STREAMER: start streaming data");
        byte buffer = new byte[fileSize.intValue()];
        outs.write(buffer);
            in.close();
        System.out.println("STREAMER: Finished streaming data");The above pump about 1MB of a 10MB fine, but the hangs and no exception is received, or:
        InputStream in = new FileInputStream(f);
        ServletOutputStream outs = response.getOutputStream();
        System.out.println("VIDEO STREAMER: start streaming data");
        byte buffer = new byte[fileSize.intValue()];
        for(int i=0; i<buffer.length; i++)  {
             outs.write(buffer);
outs.write(buffer);
in.close();
System.out.println("STREAMER: Finished streaming data");
which will pump out around 2-6 MB of the file, with both of the code changes above I can see the file being pumped at a much faster rate, but obviously no good as it does not deliver the whole file.
I know that content length is fine, I have also tried varying the response.setBuffer(int) to larger than 8192 up to fileSize.intValue to allow a buffer to handle the whole file before outputing, all to no avail.
I have also increased the runtime RAM via '-Xmx64m'.
I am developing on a windows tomcat (with netbeans) and the production version is unix based.
Any help that anyone can offer will be greatly appreciated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Thanks for the reply.
Hi, yes sorry has missed that (typed the other 2 variations by hand), I have tried buffering part of the file & tried using a BufferedOutputStream.
Neither worked either.
so for example, I used (done before, but hell tried again anyway):
        InputStream in = new FileInputStream(f);
        ServletOutputStream outs = response.getOutputStream();
        System.out.println("VIDEO STREAMER: start streaming data");
        BufferedOutputStream bout = new BufferedOutputStream(outs);
        byte [] buffer = new byte[1024];
        int length=0;
        while( (length = in.read(buffer,0,buffer.length)) > 0)  {
            bout.write(buffer,0,length);
        }this actually does worse as I only receive around 500KB.
Checked the link you provided, useful but the implemented solution is still reading 1 byte at a time, hense far too many reads going on for when the server will be (hopefully) sending out a few files per min..
essentially it seems like the outputstream (whether raw or bufferedOutputStream) is having issues with pumping data that quickly to it !???!?!?
or it's not liking raw bytes and only really working with the bout.write(int) method, the best solution so far has been this use when I mentioned above that I would receive between 4-6 odd MB of the file, this was nice and fast, just never complete.

Similar Messages

  • Is there an issue with streaming videos direct from itunes? I

    Is there an issue with streaming videos direct from itunes? I have good wifi but films just buffer , doesn't happen on flixster on netflix , wonder if there is any tweak to watch a film uninterrupted , because it is very frustrating? Thanks

    Apple appears to be having trouble with the iTunes Store servers right now.
    (81070)

  • I have a ipad 1. I seem to be having a lot of connectivity issues. It takes a long time to load and sometimes will not load a page at all. I seem to be having issues with streaming in that it will play a song and just stop.

    I seem to be having a lot of connectivity issues my iPad. It takes a long time to load and sometimes will not load a page at all. I seem to be having issues with streaming in that it will play a song and just stop. It seems I have to turn it completely off and restart.
    Anyone had these issues?

    Settings > General > Reset > Reset network settings

  • I am having issues with streaming music from iTunes on my MacBook Pro to my audio system through AirPlay.  Works perfectly with my iPod Touch.  The AirPlay icon appears irregularly in iTunes and when selected doesn't connect.  Running latest IOS software.

    I am having issues with streaming music from iTunes on my MacBook Pro to my audio system through AirPlay.  Works perfectly with my iPod Touch.  The AirPlay icon appears irregularly in iTunes and when selected doesn't connect.  Running latest IOS software.

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Unsync all music and resync
    - Reset all settings      
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                 
    iOS: How to back up           
    - Restore to factory settings/new iOS device.
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar          
    You said:
    No, I do not want to "factory reset" my iPod. No I do not wish to do anything crazy long or hard to fix this. 
    That may be necessary, It is not what you want to do/not do but what is required to resolve your problem.

  • Issue with Opening a PDF file

    We have just completed an upgrade of one of our servers executing Reporting Services.   The upgrade was from 2005 to 2008.
    After we have rendered a report and have it saved in PDF format, we start having issues.
    If we try to open the PDF by double clicking on the file name in Windows Explorer, Adobe Reader starts, but sits unresponsive and consumes an excessive amount of CPU cycles.    It never completes the open and we have to kill the Adobe Reader process in Task Manager.
    If we start Adobe Reader, and then use the Menu to do FIle -> Open, the PDF file opens immediately.
    We have attempted both methods using several different versions of Adobe Reader.    The issue occurs on all versions prior to 9.3.
    Since we are a service organization, we are unable to force our clients to upgrade to a more current version of Adobe Reader without providing assurances that this will correct this issue.
    Has anyone else seen this type of issue with opening PDF files rendered by Reporting Services?   And if so, what is the cause and how did you correct it?
    Thanks
    Steve

    Hi there,
    Please find attached a word document which contains the error that comes up when I try to open the PDF file. This PDF was e-mailed to me from one of the Safety companies that I receive e-mails from on a regular basis. I believe I am running Windows XP and the version of Adobe is Adobe Reader X. I hope this is enough info for you.
    Janice Nadeau
    [signatue deleted by host]

  • Issues with NAS, iPhoto, RAW file format, AEBSn, Leopard

    I think I've isolated it down to a networking stack issue with Leopard, but I was hoping I could get some more thoughts/advice. I don't want to downgrade to Tiger, but I may need to! Either that or host my iPhoto library locally.
    Scenario:
    My iPhoto library was messed up. Some albums were missing and it couldn't seem to find them. Rebuilding my library was giving me errors. So, I decided to start fresh. I created a new library and began importing files. I noticed that my RAW (.CR2) files were showing glitches in them! These were major glitches, like big squares of blue or yellow and distorted pictures. I checked the original pictures, those were fine. I checked the pictures in my new iPhoto library, those files are corrupted! Not the thumbnails, but the files themselves. I opened the file in Photoshop to verify. Yup, busted.
    Attempted Solution:
    I tried downgrading to iPhoto 7.0 from 7.1.1, thinking that that might be the problem. Still having issues with the RAW files. Do I need to downgrade to iPhoto 6? I can't believe that's the answer. Even in iPhoto 7.0, the problem persists.
    Now here's the interesting thing: not all files are broken. Some files work, others don't. Some files are imported without glitches some of the time; reimporting them results in a glitch. That suggests to me that it's a networking problem.
    I'm using 802.11n to an AEBSn2 (gigabit), which has a ReadyNAS NV connected to it by gigabit ethernet. I don't think it's a hardware network thing since everything seemed to work in Tiger.. I think it's a way that Leopard handles the networking stack. Didn't they revise the underlying network stuff for Leopard?
    Help!

    Are you able to switch to 11g? I heard that helps for some people. I haven't tried it yet. Right now, I have about 7500 photos, so I want to copy everything and back it up. Once I get it backed up, I'm going to try other solutions, but it may be a few days before I get anything tested.

  • Issue with BPM-Merging 2 files.

    Hi all,
    I am facing one issue with my development object...it is a BPM scenario in which i am merging 2 files using constant correlation id...JDBC to File scenario...i am using 2 JDBC adapters at source side...the scenario is getting executed without any error and i am getting the output...but the output contain only the data in 1 file...merging is not happening and only one file data is displayed in the output...could someone help me with this issue???am i missing something here??any help will be really appreciated...
    Thanks,
    Lekshmi.

    Hi all,
    As informed in my earlier post the same scenario was working with File adapters at source side.I figured out why it was working earlier.
    Since i have generated the source files for the File adpaters i have added the name space as displayed in the mapping(highlighted in bold letters).
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
       <ns0:Message1>
          <ns1:Test1_MT xmlns:ns1="http://testing.com/Details">
             <row>
             </row>
          </ns1:Test1_MT>
       </ns0:Message1>
       <ns0:Message2>
          <ns1:Test2_MT xmlns:ns1="http://testing.com/Details">
             <row>
                <VIA_NO/>
                <VSL_NM/>
                <ATA_DTTM/>
                <PATA_DTTM/>
                <ADT_INS_DTTM/>
                <ADT_UPD_DTTM/>
             </row>
          </ns1:Test2_MT>
       </ns0:Message2>
    </ns0:Messages>
    But in the case of real time scenario data is pulled from database and the input file is created through JDBC adater i am getting the source message for mapping as :
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
       <ns0:Message1>
          <ns:Test1_MT xmlns:ns="http://testing.com/Details">
             <row>
             </row>
         </ns:Test1_MT>
       </ns0:Message1>
       <ns0:Message2>
         <ns:Test2_MT xmlns:ns="http://testing.com/Details">
             <row>
                <VIA_NO/>
                <VSL_NM/>
                <ATA_DTTM/>
                <PATA_DTTM/>
                <ADT_INS_DTTM/>
                <ADT_UPD_DTTM/>
             </row>
         </ns:Test2_MT>
       </ns0:Message2>
    </ns0:Messages>
    When i tested this message in message mapping it is giving only the first file in the output.
    Any idea how to resolve this one?
    Rgds,
    Lekshmi.

  • Issues with CS5 Illustrator .ai files

    I just recently purchased CS5 Illustrator. After creating the file as an .ai file, I am having an issue with reopening the file. I get an error. Any suggestions?

    Post in the general forum… Your question is at a very small audience here in the scripting forum… Thats all of us… not enough to throw a party…

  • Wss3 Issues with user check in files from within excel or word 2010

    I have got a user reporting that he is experiencing (and it is getting more and more often) that when a file is checked out in excel or word, he then edit it, followed by clicking check in on the File tab within either excel or word. He then gets error see
    image below.
    Just wonder if anyone has seen this before? and where do I start...?
    i have checked the site collection is about 12 GB in size, there are quite a few subsites in the area where this user is working, there are about 150 subsites, 3 levels... our wss3 version is 12.0.0.4621

    Yesterday I just had another user report the similar issue with with office complaining that the file was not checked out therefor upload (check-in) was failed.
    Please see the version and build number of MS Office
    Forgot to say, we are all on the same release and updates for MS Office as well as IE.

  • Server 2012 SMB 3.0 file cluster issues with Streaming media services 2008 R2

    So I have a file server setup with the always available feature turned off on this brand new cluster. Everything seems to function normally and I can hit files from the shares no problem.
    My issue I built a brand new 2008 R2 machine and created an on-demand publishing point to point to my 2012 file share cluster. I created a windows account for my windows media service to run as and applied read only to my video share. Media services see
    the video files on the server in the GUI so I know its got connectivity, but when I go to test locally or externally it will not play the stream at all. It complains of access even know I know that is not the issue. I have verified the setup and the ACL
    stuff is turned off on both the root and the publishing point. I can login to the Media server as my service account and play files from the share no problem. IIS media services can stream the files with no problem and yeah everything seems more like something
    possibly with SMB 3.0 and something in media services.
    I have a country rule where my data is not allowed in other countries so I have multiple video services on a domain with tunnels and what not my US Streaming services is working great but has a server 2008 R2 file cluster server. If I take that one to my
    out of the country publishing point to test it streams great as they use the same services account. If I take my out of the country file share to the US I get the same result just will not work. I have poke prodded and banged my head and since I get this result
    I have concluded it must be something with the new security of SMB 3.0.
    Does anyone have this working or tested? Also I am using the exact same video file to test all of this. Or is there secret I missed to either make smb 3.0 even more compatible or make streaming services play nice.
    Anything helps please let me know.
    Thanks,
    Adam

    I'd recommend calling in for support on this one.  Things aren't adding up.  Probably the most useful thing to do would be to do a network trace of the WMS server connecting to the remote server over SMB.

  • F110 - Issue with creation of wire file

    Hi Sap gurus,
    May be someone could guide me through this issue.  Iam using the payment program (F110) to pay the vendors. I have Bank 1  and Bank 2 which are used  for wire Payments. The ranking order is 1  for Bank 1 and Bank 2 has ranking order 2.  Business wants to use Bank 2 to pay for International vemdors.The variant in the RFFOM100 uses the house Bank of Bank 2 and its Account ID. When i run the payment program it pays the vendor from Bank 1 and also does not create the wire file as it should. How ever when i chnage the ranking of this Bank 2 to a 1 , it creates the right posting to right account and creates the wire file. What should I do if i had to pay with Bank2 and have the wire file generated? Do I have chnage the rankings all the time, or  is it something iam missing.
    Thanks
    sapsri

    Hi,
    Ranking order is created for the combination of payment method and house bank.
    In your case, create 2 payment methods for wire transfer and assing the different  payment methods to the banks, with ranking order 1 for both.
    Example: PAyment method "W" Ranking order "1" house bank 1000
                   Payment method "T"  Ranking order "1" house bank 1100
    This should resolve your issue

  • Oracle 11.1.0.7.0 Issue with Streams when using NULL value in a key field

    Hi,
    we have an issue in our replicated environment using Streams.
    We have a replicated table using the following index:
    UK_S01_TEXT_FORMAT_TBL01 SOGID
    UK_S01_TEXT_FORMAT_TBL01 INDEX_TEXT_FORMAT_ID
    UK_S01_TEXT_FORMAT_TBL01 INDEX_LANGUAGE_LABEL
    UK_S01_TEXT_FORMAT_TBL01 INDEX_TEXT_FORMAT_COUNTER
    UK_S01_TEXT_FORMAT_TBL01 INDEX_PROVIDER_ID
    UK_S01_TEXT_FORMAT_TBL01 INDEX_TARIFF_PLAN_COSP_ID
    with field INDEX_PROVIDER_ID allowing NULL values. Actually we insert empty strings in there, but as far as I understand Oracle will convert it sliently in a NULL value, which is fine to our application.
    When we apply a change on that table (either update or delete) we get errors at streams level and the transaction is not propagated.
    Local Transaction ID: 6.28.11170
    Source Commit SCN: 25397175
    Source Commit Time: Dec-03-2012 12:21:30
    Error in Message: 1
    Error Message: ORA-26787: The row with key ("INDEX_LANGUAGE_LABEL", "INDEX_PROVIDER_ID", "INDEX_TARIFF_PLAN_COSP_ID", "INDEX_TEXT_FORMAT_COUNTER", "INDEX_TEXT_FORMAT_ID", "SOGID") = (ITALIAN, , , 0, MIKE, 124) does not exist in table
    SMS.S01_TEXT_FORMAT_TBL
    ORA-01403: no data found
    message: 1
    TableName: S01_TEXT_FORMAT_TBL
    Operation Type: DELETE
    _____ Old Data _____
    SOID : 1010000008
    SOGID : 124
    INDEX_TEXT_FORMAT_ID : MIKE
    INDEX_LANGUAGE_LABEL : ITALIAN
    INDEX_TEXT_FORMAT_COUNTER : 0
    TEXT_FORMAT : Hai raggiunto i 100MB di traffico incluso nello scatto
    APPLICA_PERIOD_CRI_ID :
    INDEX_TARIFF_PLAN_COSP_ID :
    INDEX_PROVIDER_ID :
    If I force the set of primary keys to be only the NOT NULL fields, I can successfully apply the error, but since we may have them storing both NULL and NOT NULL values, this is not a solution.
    I'm wondering why the DB on one hand converts the empty string in a NULL while inserting, but it looks the Apply process onStandby is not able to do the same when looking for the record before applying the transaction.
    Thanks in advance!
    Cheers,
    Mike

    Its showing all objects the user has permission to see- why does that need to be restricted?

  • Is there an issue with modifying a prototype file with a preinstall script?

    Solaris Packaging content
    I have a prototype file in which I need to move a specific directory to somewhere else other than the BASEDIR.
    I am attempting to do this with a preinstall script by running my prototype file through sed and creating a new prototype file where specific entries that match the various regexp entries in the sed command now have a alternate path assigned to it.
    For example:
    Original prototype file entry:
    d none <directory 1>/lib 0755 root other
    Output prototype from preinstall execution:
    d none <directory 1>/lib=<directory 2>/lib 0755 root other
    However, even though I can go into /var/sadm/pkg/<PKG NAME>/install and execute the preinstall by hand properly, I get the following:
    pkgadd: ERROR: preinstall script did not complete successfully
    Any ideas here? Manually editing the prototype file before pkgmk and pkgtrans is not possible with how my package is being created due to an automated process, however I would really like to leverage the functionality of the prototype file for pkgrm's instead of moving them in a postinstall script and then removing each in a postremove script.

    I don't see any issue in downloading the static copy.  Even if you were allowed to connect to the wsdl directly or add it as a service reference in Visual Studio then you would have to manually update that reference.  In closing, you aren't losing
    any functionality by downloading the static copy.
    Thanks,
    Follow my FIM blog at: http://forefrontidm.wordpress.com/

  • Issue with faces-config.xml file

    Hi,
    I'm working on a project which needs more no. of JSF Pages and JSF Navigations,
    But when i trying to creat pages more than 25 pages,the process becoming too slow,does this
    effects the Application performance?Can any one suggest me why it happens and what are the
    limitations for creating the JSF pages.
    Does their any alternative to solve this Issue,I'm thing to create more faces-config.xml files as the
    Jsf pages increases,does this solves?
    Please suggest me.
    Thank you,
    Bandaru,

    Hi Bandaru,
    Are you trying to use the visual diagram option of faces-config? Coz i encountered difficulties when using it with many pages (more than 40) and the faces-config.oxd_faces was no longer able to support the diagram. "Solution" was to use only the overview and the sources of the faces-config. I don't know exactly but my problems were caused by the faces-config.oxd_faces and i don't think it affects performances for the application.
    For information, that was on a Jdev 10.1.3.0.4
    Regards,
    Tif

  • DNG 5.4 beta converter issues with Hasselblad H2D-39 files

    I was directed to this forum when I posted a note on the DNG converter 5.4 beta, converting to use on Photoshop CS3 (see thread http://forums.adobe.com/thread/436940?tstart=0 )
    The converter has a very interesting "fail pattern" when converting Hasselblad .3fr files:
    First file fails (error message displayed is "Unknown error", second file converts OK, 3rd fails, 4th OK, 5th fails, 6&7 OK, 8th fails..
    By about the 20th file, 5 are successfully converted in a row and then by file 30, no more failures!
    So it would seem that there is not really a problem with actually reading/processing the .3fr file content. Instead looks like some form of memory or other issue in the code??
    I have also noted a few cases of problems with the conversion itself, picture ends up totally posterized, see attached file which is unmodified out of raw -> PS  CS3:
    Finally, processing the DNG files converted still fails on Photoshop CS3 as reported earlier in this thread:
    http://forums.adobe.com/thread/421742?tstart=0
    If I open the DNG file in PS CS3 and save pretty much immediately, saving works. If I do almost any processing, the "Save as" freezes PS3 before the file/directory selection dialog starts. Only forcefully stopping Photoshop helps. Looks like there is something in the "Save as" dialogue that does not check for exceeding max memory allocated to Photoshop or similar?

    Hi,
    Thanks for responding. I thought this was the forum pointed to from the download site, was not aware of the dng forum. Though there is another post on probs with convering Hasselblad files ( http://forums.adobe.com/thread/436615?tstart=0 ), my symptoms are quite similar ("Unknown error") so I would suspect this could be related to the same prob? As I am quite keen to get rid of the Phocus software, if there is anything I can do to help you fix the bug, just send me a note.
    Thanks, Håkan
    Ian Lyons kirjoitti 31.05.2009 kello 11:30:
    If you're using the DNG converter then raising the issue on the
    appropriate
    forum might get a bit more attention
    http://forums.adobe.com/community/dng
    >

Maybe you are looking for

  • HT204053 i bought an used ipad and need to delete the former owner's apple id how and use mine?

    I bought a used iPad1 that has the former user's apple id. I have an apple id myself that i can use to purchase apps, etc. 1. However, do i need to reset the device to use my ID? I've made purchases from my laptop and need to sync them to the ipad. 2

  • Order entry user exit flags

    I have a problem that I have tracked down to the code below. In order entry through EDI, if a material is not on the customers buying list it is rejected by setting ABGRU. The problem occurs when the last 2 lines are rejected we get strange error mes

  • Hide HOTSPOT option for subtotal OR total.

    Hi All   I have used OO ABAP to display report in ALV, also I used hotspot for one of the amount column. When I do total/subtotal on amount column, hotspot option also coming for total amount also. Now I want to remove the hotspot option when I do su

  • How to dynamically find the dependent jar files on user's PC

    I've written an application to deal with JTAPI. Unfortunately the implementations by vendors are different in terms of file names. Ideally I'd like to load jars based upon what's installed, e.g. load jtapi.jar when Cisco is installed, or Escjtapia.ja

  • Server not found when trying to access our credit union.

    Our credit union address is part of our bookmarks. About half the time we get an error message that says "Server not found". It says to check the address for typos, check the network connection or make sure that Firefox is permitted to access the web