How can I read from a file line by line?

Hi!
Could someone post some code or explain how can I read from a file, and want I to read a line each time. How can I go to line number N?
Thanks

hi,
u can try this:
try     {
      // open text file
      BufferedReader in = new BufferedReader(new FileReader(fileName));
      String line=in.readLine();
      while((line=in.readLine()) != null) {
      System.out.println(line);
      }The go to line number N i m not so sure.
Cheers
Jerry

Similar Messages

  • How can one  read a Excel File and Upload into Table using Pl/SQL Code.

    How can one read a Excel File and Upload into Table using Pl/SQL Code.
    1. Excel File is on My PC.
    2. And I want to write a Stored Procedure or Package to do that.
    3. DataBase is on Other Server. Client-Server Environment.
    4. I am Using Toad or PlSql developer tool.

    If you would like to create a package/procedure in order to solve this problem consider using the UTL_FILE in built package, here are a few steps to get you going:
    1. Get your DBA to create directory object in oracle using the following command:
    create directory TEST_DIR as ‘directory_path’;
    Note: This directory is on the server.
    2. Grant read,write on directory directory_object_name to username;
    You can find out the directory_object_name value from dba_directories view if you are using the system user account.
    3. Logon as the user as mentioned above.
    Sample code read plain text file code, you can modify this code to suit your need (i.e. read a csv file)
    function getData(p_filename in varchar2,
    p_filepath in varchar2
    ) RETURN VARCHAR2 is
    input_file utl_file.file_type;
    --declare a buffer to read text data
    input_buffer varchar2(4000);
    begin
    --using the UTL_FILE in built package
    input_file := utl_file.fopen(p_filepath, p_filename, 'R');
    utl_file.get_line(input_file, input_buffer);
    --debug
    --dbms_output.put_line(input_buffer);
    utl_file.fclose(input_file);
    --return data
    return input_buffer;
    end;
    Hope this helps.

  • How can I read the bootstrap files and extract the fragment-URLs and fragment-numbers in plain text?

    How can I read the bootstrap files of any HDS Live stream and extract the fragment-URLs and fragment-numbers in plain text?
    Could it be that it is some kind of compressed format in the bootstrap? Can I uncompress it wirh  f4fpackager.exe? Could not find any download for f4fpackager.exe. I would prefere less code to do so. Is there something in Java of JavaScript, that can extract the fragment-numbers?
    Thank you!

    Doesn't sound too hard to me. Your class User (the convention says to capitalize class names) will have an ArrayList or Vector in it to represent the queue, and a method to store a Packet object into the List. An array or ArrayList or Vector will hold the 10 user objects. You will find the right user object from packet.user_id and call the method.
    Please try to write some code yourself. You won't learn anything from having someone else write it for you. Look at sample code using ArrayList and Vector, there's plenty out there. Post in the forum again if your code turns out not to behave.

  • How can i read local excel file into internal table in webdynpro for abap a

    Could someone tell me how How can i read local excel file into an internal table in webdynpro for abap application.
    thank u for your reply

    Deep,
    File manuplations...............................
    1. At the presentation level:
    ->GUI_UPLOAD
    ->GUI_DOWNLOAD
    ->CL_GUI_FRONTEND
    2. At the application server level:
    ->OPEN DATASET : open a file in the application server for reading or writing.
    ->READ DATASET : used to read from a file on the application server that has been opened for reading
    -> TRANSFER DATASET : writing data to a file.
    -> CLOSE DATASET : closes the file
    -> DELETE DATASET : delete file
    If file is on the local PC,use the function module GUI_UPLOAD to upload it into an internal table by passing the given parameters......
    call function 'GUI_UPLOAD'
    exporting
    filename = p_file
    filetype = 'ASC'
    has_field_separator = '#'
    tables
    data_tab = t_data
    p_file : excel file path.
    t_data : internal table
    <b>reward points if useful.</b>
    regards,
    Vinod Samuel.

  • How can I read the EXCEL file while Program is running in background.

    Hi all Expert,
    How can I read the EXCEL file while Program is running in background.
    Thanks

    you need to place ur excel file on application server and follow this thread: Reading an Excel file from the application server?
    loots of information if you can search forum.. thanks

  • I backed up my bookmarks to an external drive, rebuilt my system, and now when I try to restore from that file, I get "unsupported file type" How can I restore from this file?

    I backed up my bookmarks to an external drive, rebuilt my system, and now when I try to restore from that file, I get "unsupported file type" How can I restore from this file?

    Make sure that the backup file with the bookmarks has the correct file extension: .html for a HTML backup and .json for a JSON backup.<br />
    You can check that via the right-click context menu of that file and open the Properties.<br />
    If you are not sure about the file type then you can open the file in Firefox via "File > Open File"<br />
    A JSON backup will show as one long text line without line breaks and a HTML backup as a web page with clickable links.<br />
    A JSON backup starts with: {"title":"","id":1,"dateAdded":<br />
    An HTML backup starts with: <nowiki><!DOCTYPE NETSCAPE-Bookmark-file-1></nowiki>
    You may need to add quotes ("") around the name to rename the file to the correct file extension.
    See also:
    * http://kb.mozillazine.org/Backing_up_and_restoring_bookmarks_-_Firefox

  • Can't Read from Source File

    Hi Guys
    I'm using PPr CS5 on Win7 64bit.
    I'm not sure if this is strictly for here but can I pick your brains please? I edited in PPr and exported three versions of the same video to AVI (mainly different intros and titles) and they all play fine. I back up my movies to an external disk but one of them always creates an error in the back-up "Can't Read from Source File". The file sizes are 5.3gb for the offending movie and 8.3 for the other two.
    I know the answer is to re-export the movie but I'm just trying to get a bit of a handle what could have caused this problem in the first place and if this is a common problem?
    Any views?
    Regards,
    Graham

    That doesn't help much.  What exactly are you doing when you get the error message?
    Are you trying to open a PP project which contains the file?
    Are you trying to play a sequence which has clips from that file?
    Are you trying to play it in a media player?
    Are you trying to import the file into PP?

  • How can I print from Dreamwaever File/Print no longer seems to work on MAc

    How can I print from Dreamwaever File/Print no longer seems to work on MAc

    The Print Code function has been removed from DWCC (not exactly sure why).
    You can help get it back by submitting a request here: https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

  • How can I read a Excel file?

    How can I read an Excel file and compare if the cells type are numeric or not??
    i hope you can can give me a hand..
    thanks

    If you want to use plsql try utl_file supplied package to read the excel file -> http://psoug.org/reference/utl_file.html
    And you can use a function like this to understand if the column is number or not ;
    CREATE OR REPLACE FUNCTION is_number (
    char_in VARCHAR2)
    RETURN BOOLEAN
    IS
    n NUMBER;
    BEGIN
    n := TO_NUMBER(char_in);
    RETURN TRUE;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN FALSE;
    END is_number;
    DECLARE
    x BOOLEAN;
    BEGIN
    IF is_number('ABC') THEN
    dbms_output.put_line('TRUE');
    ELSE
    dbms_output.put_line('FALSE');
    END IF;
    END;
    /

  • How can I read an excel file .xls from an forms 6i

    Hi
    I have forms6i and webutil don t work with this version, can I read an excel file from forms6i.
    Thank u

    Hi hosoriol,
    You can refer an excel as an external table first using the steps below and then you can start reading from it.
    If you want to update the excel file then create an view and create instead of triggers for it.
    Steps
    h3. 1.[Create an external table for the excel file |http://www.adp-gmbh.ch/ora/misc/ext_table.html|Click here to view detailed description]
    h4. 1. Create a directory in Oracle where you have kept the xls file
    create or replace directory ext_dir as '/home/rene/ext_dir';h4. 2. grant read, write on directory ext_dir to scott;
    h4. 3. creating the external table
    create table ext_table_csv (
                                                i   Number,
                                                n   Varchar2(20),
                                                m   Varchar2(20)
                     organization external (
                                                     type   oracle_loader
                                                     default directory ext_dir
                                                    access parameters (
                                                                                 records delimited  by newline
                                                                                 fields  terminated by ','
                                                                                  missing field values are null
                                                   location ('file.csv')
                     reject limit unlimited;
    Note_
    If you want to update the excel file then create a view and then create the instead of triggers to do the update, delete or insert.[Creating views on external tables | http://www.dba-oracle.com/oracle_news/2005_9_1_updating_external_tables.htm]
    h3. 2. Use the data block wizard and connect to the corresponding schema and create a database block.
    Kindly click Correct or Helpful if it helps Thanks :-)

  • Help: Servlet can't read from properties file

    I am working on a web application running in Tomcat on Linux.My java source file reads some parameters from a properties file (data.properties)in the same directory. This works well in a simple application. However, if it is used in the Tomcat environment, it can't be read by a servlet file (LoginServlet.java). I put both the "LoginServlet.class" and "data.properties" in the following directory: /webapps/myapp/WEB-INF/classes. When I run the web application in Tomcat, the error is "data.properties not found". What is the problem? Do I need to modify my "web.xml" and/or Tomcat's "server.xml"? If so, how to modify them?
    This web application contains a lot of serlets. So I don't want to hardcode the parameters into the servlet codes.
    Any info will be appreciated. Thanks in advance!:)

    Putting the properties file in webapps/myapp may or may not help.
    My assumption is that you are trying to open the file by brute force, with something like
    InputStream propis = new FileInputStream ("data.properties");
    Properties props = new Properties ( );
    props.load (propis);
    What you want is to have the class loader find a file in the same place as the class file, and give you back an input stream reading from that file, which you can then pass to the Properties.load(InputStream) method. This is called a "resource," and the way to do it is:
    InputStream propis = getServletContext().getResourceAsStream("data.properties");
    // remaining code as above
    This will cause the class loader for the servlet context (a/k/a the Web application) to find the file in the same manner as it might find a class, but instead of treating it as compiled JVM code, and loading it, it simply passes you back an InputStream from which you do whatever you want.
    Cheers!
    Jerry Oberle
    perl -e 'printf "mailto%cg%s%cearthlink%cnet\n", 58, "oberle", 64, 46;'

  • IN Premiere Pro CC how can I group copy all files in time line to another part of the time line

    How can I group copy all files from one part of the timeline to another part

    From the Premiere Pro manual (I believe track targeting matters, too.  That is, the targeted tracks only are copied): 
    Copy command enhanced to operate on a range in a sequence
    The existing Copy command (Edit > Copy, Ctrl+C (Windows), Command+C (Mac OS)) is enhanced when used in the Timeline panel. If there are no clips or keyframes selected, and an In Point or Out Point is set, then the range of time between the In point and Out point is copied to the clipboard.

  • Data reading and writing problem? how to set " Read from Measurment File express.vi​" 's readout datasize?

    Dear all,
    I want to use Labview to process a data.
    Now I have a array in a text file.
    this array is very very big. which is at least row*col = 6 * 100000;
    the column size always 6,
    but the row size is ramdom, some times is very big, like bigger than 65535,
    when I use "read from measurement file express.vi" to read this file, the array I could get always 6*5339, I don't know why. the column size is always 5339.
    and then I delete the 1st row of the array and then write into a txt file via "write measurement file express. vi", it takes a very long time. almost computer has no response. after a while, no file was creat to record the data.
    is there an efficient way to process such big data file and store the processed file into a new file
    thank you very much
    Jack
    Message Edited by weichengatech on 03-09-2006 12:00 AM

    Hello,
    There’s no real efficient way to read the file if you don’t
    know exactly how many rows of data you have. 
    Your going to just have to read a row at a time and add the results to
    the end of an array (granted for the clever programmers there are some more
    efficient ways to do this than just with ‘build array’).  I would start by asking you how much
    information you know about the file and what the exact structure of it is (i.e.
    is it a binary file, a tab delimited file, or a LVM file)?  Could you provide a screenshot of the code
    you are running? If you provide a little more information on the file structure
    we might be able to contribute some additional information.
    Look forward to hearing back from you-
    Travis M
    LabVIEW R&D
    National Instruments

  • How can I read a binary file stream with many data type, as with AcqKnowledge physio binary data file?

    I would like to read in and write physiological data files which were saved by BioPac�s AcqKnowledge 3.8.1 software, in conjunction with their MP150 acquisition system. To start with, I�d like to write a converter from different physiodata file format into the AcqKnowledge binary file format for version 3.5 � 3.7 (including 3.7.3). It will allow us to read different file format into an analysis package which can only read in file written by AcqKnowledge version 3.5 � 3.7 (including 3.7.3).
    I attempted to write a reader following the Application Note AS156 entitled �AcqKnowledge File Format for PC with Windows� (see http://biopac.com/AppNotes/ app156Fi
    leFormat/FileFormat.htm ). Note the link for the Mac File format is very instructive too - it is presented in a different style and might make sense to some people with C library like look (http://biopac.com/AppNotes/ app155macffmt/macff.htm).
    I guess the problem I had was that I could not manage to read all the different byte data stream with File.vi. This is easy in C but I did not get very far in LabView 7.0. Also, I was a little unsure which LabView data types correspond to int, char , short, long, double, byte, RGB and Rect. And, since it is for PC I am also assuming the data to be written as �little endian� integer, and thus I also used byte swap vi.
    Two samples *.acq binary files are attach to this post to the list. Demo.acq is for version 3.7-3.7.2, while SCR_EKGtest1b.acq was recorded and saved with AcqKnowledge 3.8.1, which version number is 41.
    I would be grateful if you someone could explain how to handle such binary file stream with LabView and send an example to i
    llustrate it.
    Many thanks in advance for your help.
    Donat-Pierre
    Attachments:
    Demo.acq ‏248 KB
    SCR_EKG_test1b.acq ‏97 KB

    The reading of double is also straight forward : just use a dble float wired to the type cast node, after inverting the string (indian conversion).
    See the attached example.
    The measure of skin thickness is based on OCT (optical coherent tomography = interferometry) : an optical fiber system send and received light emitted to/back from the skin at a few centimeter distance. A profile of skin structure is then computed from the optical signal.
    CC
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Read_AK_time_info.vi.zip ‏9 KB

  • How can I read a binary file stream with many data type, as with AcqKnowled​ge physio binary data file?

    I would like to read in and write physiological data which was saved by Biopac�s AcqKnowledge 3.8.1 software, in conjunction with their MP150 acquisition system. To start with, I�d like to write a converter from different physiodata file format into the AcqKnowledge binary file format for version 3.5 � 3.7 (including 3.7.3). It will allow us to read different file format into an analysis package which can only read in file written by AcqKnowledge version 3.5 � 3.7 (including 3.7.3).
    I attempted to write a reader following the Application Note AS156 entitled �AcqKnowledge File Format for PC with Windows� (see http://biopac.com/AppNotes/app156FileFormat/FileFo​rmat.h
    tm ). Note the link for the Mac File format is very instructive too - it is presented in a different style and might make sense to some people with C library like look (http://biopac.com/AppNotes/app155macffmt/macff.ht​m) .
    I guess the problem I had was that I could not manage to read all the different byte data stream with File.vi. This is easy in C but I did not get very far in LabView 7.0. Also, because it is for PC I am assuming the data to be written as �little endian� integer, and thus I also used byte swap vi.
    I would be grateful if you someone could explain how to handle such binary file stream with LabView and send an example to illustrate it.
    Many thanks in advance for your help.
    Donat-Pierre

    One more step...
    short are U16 integer
    double are double precision float
    bool seem to be 2 bytes (= U16)
    char are string (variable length)
    rgb are U16 integer, with high order byte = 0
    rect should be 4 x U16 (top, left, bottom, right)
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

Maybe you are looking for

  • How to enter numbers in Arabic font in the fields

    Hi Everyone, I installed Adobe Reader 10.0.1 multi-Language and I am able to enter Arabic alphabet in the fields, but when I enter numbers in the fileds, it is English. I don't have this issue in MS-Word. i.e., both letters and numbers depend on my k

  • SSL VPN Failed to validate server certificate (cannot access https)

    Hi all, I have the next problem. I've configured in an UC520 a SSL VPN. I can access properly and I can see the labels, but I only can access urls which are http, not https: I can access the default ip of the uc520 (192.168.1.10) but When I try to ge

  • I can't download my Dark Knight digital copy.

    When I downloaed it for the first time it said that I have downloaded 1.67GB out of 1.67GB but the blue bar was still moving like it was still downloading, I went to my movies and couldn't play it. I then exited itunes to try again and I tried again

  • Some datasources wrong in Info provider after refresh

    Hi I know there is a lot of discussion about refreshes and data sources etc. but I still cant fix some of my datasources that display in the infoprovider area of RSA1 after a refresh and the logical system name change. If i drill down on some of our

  • Connecting from UNIX

    I need to connect to oracle from UNIX by a script. I need the script to prompt for a variable and that variable to be used for dml in sql statment but not able to do so.. Script 1 will be something like this #!/bin/bash USER=$1 PASSWD=$2 DB=$3 exec >