How can we read some bytes from every line of the file

How can we read some bytes from the every line of the file moving on to the next line
without using the read line

Actualiy readLine() takes more execution time
for reading a part of line if we can do so without
readLine() we can save some time...Well, if you knew, beforehand, the length of each line, you could use RandomAccessFile and its seek method, but, since you don't, you would have to read the rest of the line character-by-character, checking to see if it is a newline, in order to place the "cursor" at the beginning of the next line in order to read the next few characters you want.
So, as you can see, you will need to read the entire line anyway (and if you do it yourself you also have to do the checking yourself considering all three possible end-of-line sequences), so you just as well use readLine().
Some people may suggest Scanner and it's nextLine() method, but that also needs to read the rest of line (as evidenced by the fact that it returns it), so that is no different than the readLine() (or read it yourself) solution.

Similar Messages

  • How can i select some row from multiple row in the same group of data

    I want to select some row from multiple row in the same group of data.
    ColumnA        
    Column B
    1                  OK
    1                   NG
    2                   NG
    2                          NG
    3                          OK
    3                          OK
    I want the row of group of
    ColumnA if  ColumnB contain even 'NG'
    row , select only one row which  Column B = 'NG'
    the result i want = 
    ColumnA         Column B
    1                         NG
    2                   NG
    3                          OK
    Thank you

    That's some awful explanation, but I think this is what you were driving at:
    DECLARE @forumTable TABLE (a INT, b CHAR(2))
    INSERT INTO @forumTable (a, b)
    VALUES
    (1, 'OK'),(1, 'NG'),
    (2, 'NG'),(2, 'NG'),
    (3, 'OK'),(3, 'OK')
    SELECT f.a, MIN(COALESCE(f2.b,f.b)) AS b
    FROM @forumTable f
    LEFT OUTER JOIN @forumTable f2
    ON f.a = f2.a
    AND f.b <> f2.b
    GROUP BY f.a

  • How can I move some track from music folder to the podcast or audiobook?

    I have a lot of audiobook in my hard drive.When I add these files to library,they place in the music section.How can I move Them to the audiobook section?
    I've tried to chenge their genre to the Podcasts or Books,but there is nothing happened.

    So, if she purchased a song from iTunes in her library, I will also have to purchase the same song to add to my library?

  • My daughter and I each have iTunes libraries on the same computer, how can I move some songs from one library to the other?

    My daughter and I each have iTunes libraries on the same computer, how can songs from one library be moved to the other?

    So, if she purchased a song from iTunes in her library, I will also have to purchase the same song to add to my library?

  • How can i  read a image from a oracle DB?

    How can i read a image from a oracle DB?
    Because in the DB a have a field that is a picture that i would like to show in a jpanel.....but this field is in oracle DB only has strange caracters ..... so Do i have to read this field like a input stream?....
    Could some body help me please?
    Thanks...
    Mary

    Well I suppose the picture is stored in a blob. If that is so this is some code I have used to load a picture to a panel. Hope you find it usefull.
    PreparedStatement retreive = db.createPreparedStatement("select bl from test where ln = ?");
    Blob bl;
    try{
    retreive.setBigDecimal(1, new BigDecimal(jTFln.getText()));
    ResultSet rs = retreive.executeQuery();
    if (!rs.next())
    System.out.println("Empty Result Set");
    bl = rs.getBlob("bl");
    if (bl == null) {
    System.out.println("Null Blob");
    return;
    InputStream is = bl.getBinaryStream();
    int imageLength = (int) bl.length();
    System.out.println(imageLength);
    System.out.println(bl.length());
    byte[] imageData = new byte [imageLength];
    is.read(imageData, 0, imageLength);
    image1 = new ImageIcon(imageData);
    photo = new JPanel() {
    public void paint(Graphics g){
    g.setColor(Color.lightGray);
    g.drawImage(image1.getImage(), 0, 0, this);
    } catch (BadLocationException ble){
    ble.printStackTrace();
    } catch (SQLException sqle){
    sqle.printStackTrace();
    } catch (IOException ioe){
    ioe.printStackTrace();
    }

  • How can I delete some music from my iCloud but not from my iTunes in my computer? please??

    how can I delete some music from my iCloud but not from my iTunes in my computer? please??

    iCloud doesn't store your music.

  • How can i delete some books from ibook?

    How can i delete some books from ibook? It says: this book can't be opened. The book is corrupt. I can't open and I can't delete it

    I was unable to delete a book sample from my iPhone 5s running iOS 7.  This seems to be what worked for me.  I went to the Library and clicked "edit" in upper right side of the screen.  I then tapped one time on the book I wanted to remove and a blue check appeared at the bottom right corner of that book (presumably you could tap several at a time)  Anyway, when the blue check is on the book, you will see in the upper left of the screen the word "Delete" (mine was in red) I clicked that and then a confirming dialog came up from the bottom of the screen with the choices of "delete" or "cancel".  I chose "delete" and the book was gone.  Hope this helps.

  • How can I save some pics from my Mac onto my Ipod touch?

    How can I save some pics from my Mac to my Ipod Touch ?

    Syncing photos with iTunes is explained here: http://support.apple.com/kb/HT4236
    You'll have to choose the photos you want to sync in the photo pane in iTunes with your phone connected, then apply sync.

  • How can I remove some themes from Keynote??

    How can I remove some themes from Keynote??

    What a co-incidence... I just deleted those same goodies. They were in /Library/Application Support/Keynote-folder on my machine. I just deleted the whole folder, cause there seemed to be nothing more but those downloaded files. And Keynote worked great afterwards. There seemed to be another folder for iWork09, which is not to be removed.

  • How can i Read a book from my Mac (digital editions) to my iPad 2

    How can i Read a book from my Mac (in digital editions) to my iPad 2

    iPad's aren't supported by ADE.  Some folks have been able to use iTunes to
    do the transfers, and others have used Bluefire reader.
    ===================

  • How can I transfer some photos from PE11 to be saved on my new IPad?

    How can I transfer some photos from PE11 to be saved on my new IPad? I know I can use Adobe Revel but that relies on an Internet connection. The person I wish to show the photos do not have internet connection.

    You can use iTunes on your local computer to transfer photos:
    http://www.howstuffworks.com/tablets/transfer-pictures-to-ipad.htm

  • How can i share some apps from my macbook pro to iMac on different IP?

    how can i share some apps from my macbook pro to iMac on different IP?

    sign into same id on both computers in the app store
    see this
    http://support.apple.com/kb/HT2519
    Peace, Clyde

  • How can I transfer some songs from my ipod to my itunes library although they are not purchased from itunes store?

    How can I transfer some songs from my ipod to my itunes library although they are not purchased from itunes store?

    By using one of third-party programs discussed in this previous discussion:
    Best iPod to PC

  • HOW CAN I READ A BOOK FROM MY IPAD/IBOOK ONTO MY TV

    HOW CAN I READ A BOOK FROM MY IPAD/IBOOK ON MY TV SCREEN?

    Apple TV: How to use AirPlay Mirroring
    Troubleshooting AirPlay and AirPlay Mirroring
    OR
    You can use the Apple Digital AV Adapter or VGA Adapter to share the display of your iOS device to a compatible TV, projector, or other external display.

  • How can I read a comment from an lvm?

    Hello,
    I created an lvm using the Write to Measurement File express vi and I added a comment.
    To simplify it the line of the lvm created was:
    5 test
    where 5 is a random value and test the comment I input.
    My question is how can I read this comment.
    When I use the Read Measurement File express vi, the comment output
    returns empty.
    Thank you.
    Solved!
    Go to Solution.

    Hi epik78,
    I am not sure how you are adding your comment to the file, but when I made the simple VI below, I was able to see the comment that I input to the .lvm file in the comment indicator of the Read From Measurement File.
    Regards,
    Stephen S.
    Message Edited by Stephen_S. on 02-25-2009 03:18 PM
    National Instruments
    Applications Engineering
    Attachments:
    lvm comment.JPG ‏26 KB

Maybe you are looking for