Getting unusual behavior using a BufferedInputStream on a 5 GB file

I have a utility that reads the first 1000 records of a file, the middle 1000 records of a file, and the last 1000 records of a file, to check for data integrity. It has worked like a champ for years on thousands of fairly large files, but has recently been behaving badly on files around 5 GB.
I use a BufferedInputStream with a 8192 buffer size to read the data.
I calculate the line number of the middle 1000 records. After processing the 1st 1000 records, I count the number of LF characters until I hit the beginning of the middle 1000 records. I have to process around 2.7 gigabytes before I find the byte I want
If the buffer has 8192 bytes in it, and I find the byte I want at position 6251, a subsequent read(_bigByteArr, 0, 8192) only returns 1941 bytes.
This is different behavior than with files < 4GB. On smaller files, the subsequent read(_bigByteArr, 0, 8192) returns the full 8192 bytes.
I'm thinking I'm hitting some internal limit (2147483647?). Has anyone else encountered this behavior, or have any ideas for work-arounds?

Thanks! I looked into using DataInputStream.readFully, but it would have been a little clumsy to implement, so I created a new read method that works:
     *     Wrapper around low-level read.
     *     this is needed because bi.read(bigByteArr,0,_maxBytes) does not
     *     guarantee that _maxBytes will be returned.
     private int read() throws IOException
          int bytesRead=0;
          int curByte=0;
          curByte = (int) _bi.read();
          if (curByte==-1) {
               bytesRead=-1;
          }//if
          else {
               bytesRead++;
               _bigByteArr[0]= (byte) curByte;
               for (int i = 1;i<_maxBytes;i++) {
                    curByte = (int) _bi.read();
                    if (curByte==-1) {
                         _bufOnLastChunk=true;
                         break;
                    }//if
                    _bigByteArr= (byte) curByte;
                    bytesRead++;
               }//for
          }//else
          //this was probably already flagged, but if equal to _maxBytes, need to flag
          if (bytesRead==_numBytes) {
               _bufOnLastChunk=true;
          }//if
          return bytesRead;
     }//read
Thanks again for your response and advise!

Similar Messages

  • AOL mail gets smaller periodically, used to be able to go to File/Zoom/reset. This bar is gone. Help

    There was a toolbar in the upper right of my screen before I installed the new Firefox upgrade today, 3/24/11
    Intermittently, my AOL mail list would become small (I do not have AOL installed but use the browser to get there)
    I would go to File, then Zoom, then Reset and the mail would enlarge again
    How can i get that toolbar back?

    Neal,
    I am in the same predicament. I would essentially like to accomplish the same deal, as seen below. . . (from another forum that went unanswered.)
    I use iCal (1.5.5/ 2.0.3) currently but own Entourage (11.2.1) as well. I have clients that I service on a weekly or biweekly basis whose appointments are in my iCal; I call and remind them the day before. The majority of these people are great about checking email. I would like to set up an automated email reminder which is sent to them for each appointment, two days in advance that does not contain an .ics file. Many times my clients' email app has junked the message due to the small attachment. Others don't want to open a file when they don't know what it is.
    Predetermined timed stamped/Automated iCal events are possible aren't they?! If not, do I have to move over to :dreaded Entourage?

  • UNUSUAL BEHAVIOR

    I have noticed some very unusual behavior with my iPhone4 lately.While charging the phone, the screen changes from the main screen to my contacts, or, to my camera, etc. This has also happened a few times when I was holding the phone in my hand...but not touching anything. I just did a reset...hopefully that will correct it. Anyone else having this issue?

    user646292 wrote:
    OK...here is the code...
    returns 14000 and change....the table doesnt matter as I can use any table name and get the same results. If there was an error with the code itself, you would think it would be reflected in the select.Not true. For some kinds of bad code Oracle does make assumptions. A comparison over two different datatypes is an example for such "bad" code.
    Oracle has to do conversion from one datatype to the other.
    Here are rules that are used:
    >
    The following rules govern the direction in which Oracle Database makes implicit datatype conversions:
    1) During INSERT and UPDATE operations, Oracle converts the value to the datatype of the affected column.
    2) During SELECT FROM operations, Oracle converts the data from the column to the type of the target variable.
    Let's now look at your code
    yearmonth BETWEEN 20075 AND 20077I assume that yearmonth is a string column.
    Inside a select Oracle would compare like this (rule 2)
    to_number(yearmonth) BETWEEN 20075 AND 20077Inside an insert Oracle would compare like this (rule 1)
    yearmonth BETWEEN to_char(20075) AND to_char(20077)Not sure if this really explains the difference you have, but I would search for problems along those lines. It might also depend on the database version.
    Could also be a different column that causes the error.
    Edited by: Sven W. on Oct 16, 2008 2:27 PM
    Edited by: Sven W. on Oct 16, 2008 2:30 PM

  • Unusual behavior in account

    Skype billed my PayPal account 7 times in the last 2 days to Auto-Recharge my account.  If I hadn't checked my email account today, I would not have noticed!  Couldn't they even detect unusual behavior if someone's account is being charged 7 times in 2 days?   They refunded the money but say I have to contact the police and only the police can contact Skype's fraud department.  I have no rights to the information they have about whoever hacked into my account. 

    eholbrook wrote:
    Skype billed my PayPal account 7 times in the last 2 days to Auto-Recharge my account.  If I hadn't checked my email account today, I would not have noticed!  Couldn't they even detect unusual behavior if someone's account is being charged 7 times in 2 days?   They refunded the money but say I have to contact the police and only the police can contact Skype's fraud department.  I have no rights to the information they have about whoever hacked into my account. 
    for more information and possibly more specific intructions, you may indeed need to get in touch with the customer service;
    How to Contact Skype Customer Service
    IF YOU FOUND OUR POST USEFUL THEN PLEASE GIVE "KUDOS". IF IT HELPED TO FIX YOUR ISSUE PLEASE MARK IT AS A "SOLUTION" TO HELP OTHERS. THANKS!
    ALTERNATIVE SKYPE DOWNLOAD LINKS | HOW TO RECORD SKYPE VIDEO CALLS | HOW TO HANDLE SUSPICIOS CALLS AND MESSAGES
    SEE MORE TIPS, TRICKS, TUTORIALS AND UPDATES in
    | skypefordummies.blogspot.com | 

  • HT1338 mac book pro gets unusually hot

    Mac book pro gets unusually hot. Its only a year old . Anybody out there have s suggestion ?

    I have just been to the Genius Bar with this question, among others. They recommended that I download "SMCFancontrol", also recommended above by EyeHeartDesign. It's available free at http://www.versiontracker.com/dyn/moreinfo/macosx/31029. Like iStatPro it monitors temperatures, but it also allows you to set a faster default fan speed and a target max temperature.
    At the Genius Bar I was also advised to clean out the vents with compressed air and to make sure that I am not blocking the vents while I use the computer.
    We'll see if this all works, as it has been running hotter than usual lately. I was afraid that components were getting fried, but was assured that the other issue this computer has (keyboard and trackpad stop working) is unrelated. Looks good so far - with fans at the new default of 4000 rpm, temp is 40º C.

  • 'Get URL' Behavior not working in IE?

    Hi, I've never had issues with adding a simple link to a
    button. However, with IE7 my Get URL behavior won't seem to work in
    IE. I'm including the new AC_Active_Content.js now that spits out
    with the published files and it still doesn't seem to work.
    Please confirm what code I should be using for a button link
    and where it should go (action or behavior?)
    Anybody know what's up?
    Thanks

    Thanks. I was actually wondering the differences between AS2
    and 3. I guess that's one of them.
    Anyway, that worked. I just used AS2 and put this into the
    Action window:
    on (release) {
    getURL("
    http://www.url.com");
    Thanks a lot for the help.

  • Trouble with my ipod getting hot when useing instagram app and also problems with my ipod closeing and returning to home screen unexpectedly?

    when i'm useing my ipod and i'm useing the instagram app. I feel my ipod starting to get really hot. i am also having problems useing app and them all a sudden closing on me and ipod will return to the home screen

    It is not unusual for the to get worm when using some apps.
    For the app problem see:
    iOS: Troubleshooting applications purchased from the App Store

  • Full text not getting displayed while using RSRT

    Hi,
    I am facing issue while downloading data using RSRT in BI system.
    When I go to RSRT and execute a report the output doesn't display full text for a characteristic. i.e. the characteristic has a size of 60 characters, but only 30 chars ( approx) are being displayed as report output in RSRT.
    COuld anyone here please help me in getting the full text using RSRT transaction?
    I am not using Bex here for the reason that the output has more than 1.8 lac records and hence I get an error while using Bex
    WHen I try to execute this report using Bex for a small selection I could see full text there.
    And there is no text master data maintained for this characteristic.
    Thanks in advance for your replies.

    Hi,
    As you said you have 1.8 Lac records, There is no point in increasing the size to maximum number possible i.e 65K .
    You have following three options to satisfy your requirement.:
    1.    Usage of  web reporting for export of more than 65k rows. According the note: 1127156 - Safety belt: Result set is too large, in BW version 7.x it I possible to set parameters that would allow such a massive export of data.
    2.    Functionality of OpenHubs. Data can be placed directly into the files (e.g. in CSV format) on application server. Be careful here OpenHubs are specially licensed and by using it there are additional fees.
    3.    Coding of custom ABAP report which runs BW query and gets all its output and saves it in the flat files.
    Please let me know if this info is helpful.
    Regards,
    Krishna Tangudu

  • I have a MacBook Pro and just added an airport express to listen to my iTunes on my stereo. How do I get Firefox to use my AX when I use Grooveshark or Pandora?

    i have a MacBook Pro and just added an airport express to listen to my iTunes on my stereo. How do I get Firefox to use my AX when I use Grooveshark or Pandora?

    If the purchases are all from the same account then you can share the content by authorizing each device.
    If you have separate accounts then you have to be authorized to use the content purchased from another account.
    MJ

  • I am changing from Word to Pages. I have created my custom template with all my styles etc and that is what comes up when I go for a New Document. Fine. How do I get it to use the same Custom Template when I use Pages to open a Word document?

    I am changing from Word to Pages. I have created my custom template with all my styles etc and that is what comes up when I go for a New Document. Fine. How do I get it to use the same Custom Template when I use Pages to open a Word document?

    The template is a document in itself, it is not applied to an existing document whether it is a Pages document or a Word document converted to a Pages document.
    You would need to either copy and paste content, using existing styles, or apply the styles to the converted Word document.
    You can Import the Styles from an existing document and those imported Styles can be used to override the current document's styles:
    Menu > Format > Import Styles
    The process is simplified if the styles use the same names, otherwise you will need to delete the style you don't want and replace it with the one that you do want when asked, then the substitution is pretty straightforward.
    Peter

  • How to get multiple values using HttpSession.getAttribute(java.lang.String)

    Hey Guys
    I'm trying to find a way to get multiple values using the following method
    HttpSession.getAttribute(java.lang.String)
    Here's the scenerio. Its a already written application and now i'm trying to make some changes. earlier in the jsp page a combo box was used and value was retrieved in the servlet using the getAttribute method of Session. Now I'm using a html multiple selection list and have to retrieve all the values selected in the list in the servlet. Can anyone please suggest me how to do that. HTTPRequest class has a method getParameterValues which will let me do that but i have to do is using HTTPSession.
    Thanks for your time to read this

    I'm not sure what you are trying to do. You can only use session.getAttribute to retrieve something that has already been stored in the session with a previous setAttribute. If you need to store multiple values under one attribute name using setAttribute, you can store an array, or an ArrayList or whatever type of Collection you want. The request.getParameterValues method is the only way you can retrieve form parameters than can have multiple values. If the servlet hasn't already processed these parameters and put them into the session for you, you have to use request.getParameterValues.

  • I created a new apple id for my iphone and ipad which work great and allow me to access Icloud. on my macbook air can't get it to use my new apple id for icloud. Help?

    I created a new apple id for my iphone and ipad which work great and allow me to access Icloud. on my macbook air  I can't get it to use my new apple id for icloud. It keeps going back to my old apple id and doesn't afford me to alter it. I use system preferences-icloud and it just wants to verify the old apple id but doesn't afford me the opportunity to delete teh account or edit it like the iphone5 and ipad. Help?

    Welcome to the Apple Community.
    You need to use the sign out option on the left side.

  • I cannot get to or use my home pc for a while and am staying with a friend for the foreseeable and am using their pc to write this. How do I access my itunes account on their pc. Thanks Karen

    I cannot get to or use my home pc for some time and am staying at a firends and using their pc to write this. I need to access my itunes account and music on their pc. How do I do this. Thanks

    An easy route would be to use the iTunes Match service such that all your Songs are available anywhere over the internet via iCloud.  Once complete you can create an account on your friends PC, download iTunes and sign-in to the iTunes Store with your Apple Id, start iTunes Match and it will provide access to all your Songs.
    Not quite so good, is simply to follow the steps on your friends PC as above, however, instead of iTunes Match simply access the 'purchased' songs area from the iTunes Store home page that will give you access to all your purchases without iTunes Match.
    IMPORTANT:  Apple only like to see a single Apple Id associated with one device - so if your friend already has an active Apple Id account on the PC, it would be wise to use an alternate machine.  Apple has a 90 day lock out associated with switching Apple Ids on a common device.

  • How to get multiple records using fn-bea:execute-sql()

    Hi,
    I created Proxy service(ALSB3.0) to get records from DB table. I have used Xquery function(fn-bea:execute-sql()). Using simple SQL query I got single record, but my table having multiple records. Please suggest how to get multiple records using fn-bea:execute-sql() and how to assign them in ALSB variable.
    Regards,
    Nagaraju
    Edited by: user10373980 on Sep 29, 2008 6:11 AM

    Hi,
    Am facing the same issue stated above that I couldnt get all the records in the table that am querying in the Proxyservice.
    For example:
    fn-bea:execute-sql('EsbDataSource', 'student', 'select Name from StudentList' ) is the query that am using to fetch the records from the table called StudentList which contains more than one records like
    Id Name
    01 XXX
    02 YYY
    03 ZZZ
    I tried to assign the result of the above query in a variable and while trying to log the variable, I can see the below
    <student>
    <Name>XXX</Name>
    </student>
    I want to have all the records from my table in xml format but it's not coming up. I get the value only from the first row of my table.
    Please suggest.
    regards,
    Venkat

  • How do I get imovie to use Photoshop Elements 12 as external editor?

    How do I get imovie to use Photoshop Elements 12 as external editor? I am making a movie slide show with music from my Caribbean vacation photos and adding text captions to photos in PS Elements 12. I can also add some effects to photos like edge blur although I like iphotos effects better but iphoto doesn't seem to do text. The finished PS Elements photo doesn't seem to want to be shared by iphoto which is what imovie uses...
    I am still learning to use PS Elements 12 for Mac (had PSE 7 for WinVista but wasn't proficient) and Mac and it's programs are new to me. I switch between my old Dell which is still amped for graphics and the new Mac mini. I started to use Movie Maker to do my vacation project but read that imovie was better but so far it doesn't seem to have as broad of file useage when it comes to imovie and photo files.
    Hmmmmm??? What to do?

    You simply need to create your stills with Photoshop Elements, save them in a suitable format (.jpg, .png, .tiff are all acceptable) then drag and drop them into your iMovie timeline.  You don't have to use iPhoto.
    Geoff.

Maybe you are looking for