How to process other task when reading the data from a file?

Hello,
I met a problem. I created a GUI to control the audio data processing. When the "Start" button is pressed, a block of data is read from the audio file and processed, then loop.But other buttons or method cannot be operated in that procession until all data is processed.
How to let the other methods work under that circumstance? Should I use multiple threads?
The relative code:
SourceDataLine line;
boolean stop = false;
// When press "Start" button, the following method is invoked:
public void play(){
line.start();
int bytesRead = 0;
byte[] dataBuf = new byte[7500];
while (bytesRead != -1& !stop)
try
bytesRead = audioInputStream.read(dataBuf, 0, dataBuf.length);
catch (IOException e)
e.printStackTrace();
if (bytesRead >= 0)
int bytesWritten = line.write(dataBuf, 0, bytesRead);
line.drain();
// When press "stop" button, this method is invoked.
public void stop(){
stop = true;
line.stop();
// When press "***" button, the following button is invoked:
public void ***(){
Many thanks.Looking forward to getting your answer.

You have to use a seperate thread :
Wheb you press the start button, you have to make sure a seperate thread is started :
Thread runner = new Thread(){
public void run(){
//Here comes your code which reads the file
runner.start();
KR,
Jan

Similar Messages

  • How to read the data from a file in another computer with user name and password login

    How to read read the data from a file in anohter computer which need to login with user name and password?

    duplicate post:  http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2061478
    duplicate post:  http://forums.ni.com/t5/LabVIEW/do-need-to-enter-the-user-name-and-password-when-TCP-ip/m-p/2061612
    duplicate post   http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2060682

  • How to read the data from Excel file and Store in XML file using java

    Hi All,
    I got a problem with Excel file.
    My problem is how to read the data from Excel file and Store in XML file using java excel api.
    For getting the data from Excel file what are all the steps i need to follow to get the correct result.
    Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
    Thanks & Regards,
    Sreenu,
    [email protected],
    india,

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • Reading the data from excel file which is in application server.

    Hi,
    Iam trying to read the data from excel file which is in application server.
    I tried using the function module ALSM_EXCEL_TO_INTERNAL_TABLE. But it didn't work.
    I tried just reading using open data set and read data set it is giving junk characters.
    Please suggest me if you have any solution.
    Best Regards,
    Brahma Reddy

    Hi Narendra,
    Please see the below code I have written
    OPEN DATASET pa_sfile for INPUT in text mode ENCODING  DEFAULT MESSAGE wf_mess.
    CHECK sy-subrc = 0.
    DO.
    READ DATASET pa_sfile INTO wf_string.
    IF sy-subrc <> 0.
    EXIT.
    else.
    split wf_string at wl_# into wf_field1 wf_field2 wa_upload-field3
    wa_upload-field4 wa_upload-field5 wa_upload-field6 wa_upload-field7 wa_upload-field8
    wa_upload-field9 wa_upload-field10 wa_upload-field11 wa_upload-field12 wa_upload-field13
    wa_upload-field14 wa_upload-field15 wa_upload-field16 wa_upload-field17 wa_upload-field18
    wa_upload-field19 wa_upload-field20 wa_upload-field21 wa_upload-field22 wa_upload-field23
    wa_upload-field24 wa_upload-field25 wa_upload-field26 wa_upload-field27 wa_upload-field28
    wa_upload-field29 wa_upload-field30 wa_upload-field31 wa_upload-field32 wa_upload-field33
    wa_upload-field34 wa_upload-field35 wa_upload-field36 .
    wa_upload-field1 = wf_field1.
    wa_upload-field2 = wf_field2.
    append wa_upload to int_upload.
    clear wa_upload.
    ENDIF.
    ENDDO.
    CLOSE DATASET pa_sfile.
    Please note Iam using ECC5.0 and it is not allowing me to declare wl_# as x as in your code.
    Also if Iam using text mode I should use extension encoding etc.( Where as not in your case).
    Please suggest me any other way.
    Thanks for your help,
    Brahma Reddy

  • How to read the data from excel file and store into the table?

    Hi All,
    I have table with BLOB datatype contains a excel file. I have to read that data from excel and store into one table with all the fields in excel.
    All the excel fields and my table columns are same.
    Can you share with me how can acheive this using LOB's?
    Thanks

    Hi OraSuirya,
    you can try with external tables .
    syntax as follows
    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;
    For this you need to create directory
    Directory Creation syntax:
    create or replace directory ext_dir as 'D:\oracle\user_dir\ext_dir';
    grant read, write on directory ext_dir to <User>;
    please paste the excel file in the particular directory .
    I hope this will help you.
    Please correct me if I am wrong anywhere .
    Thanks,
    Tippu.

  • How to avoid the split problem when uploading the data from csv file

    Dear Friends,
                  I have to upload data from the .csv file to my custom table , i have found a problem when uploading the data .
    i am using the code as below , please suggest me what i have to do in this regard
          SPLIT wa_raw_csv  AT ',' INTO
                    wa_empdata_csv-status
                     wa_empdata_csv-userid
                     wa_empdata_csv-username
                     wa_empdata_csv-Title
                     wa_empdata_csv-department.
    APPEND wa_empdata_csv TO  itab.
    in the flat file i can see for one of the record for the field Title  as
    Director, Finance - NAR............there by through my code the  wa_empdata_csv-Title is getting splited data as "Director, and  Department field is getting Finance - NAR" , i can see that even though  " Director, Finance - NAR"  is one word it is getting split .
    .......which is the problem iam facing.Please could any body let me know how in this case i should handle in my code that this word
    "Director,Finance - NAR"   wil not be split into two words.
    Thanks & Records
    Madhuri

    Hi Madhuri,
    Best way to avoid such problem is to use TAB delimited file instead of comma separated data. Generally TAB does not appear in data.
    If you are generating the file, use tab instead of comma.
    If you cannot modify the format of file and data length in file is fixed character, you will need to define the structure and then move data in fixed length structure.
    Regards,
    Mohaiyuddin

  • Reading the data from 2 files and writing it into the 3rd file?

    Hi,
    I am reading datas from 2 files Say,
    Example1.txt Example2.txt
    Ashok ^data1^data2^data3
    Babu ^data1^data2^data3
    Chenthil ^data1^data2^data3
    Danny ^data1^data2^data3
    I want those data's to be written in a 3rd file. Say,
    Example3.txt
    Ashok^ data1^data2^data3
    Babu^ data1^data2^data3
    Chenthil^ data1^data2^data3
    Danny^ data1^data2^data3
    So that i can tokenize it with a delimeter(^) and get the values. Here how to append the datas in this form in Example3.txt. Eventhough u use FileWriter with append "true" as a parameter how they will apend like the Example3.txt file? Please do provide an answer for this..Since this is very urgent to be delivered...Expecting postive response.
    Thanx,
    JavaCrazyLover

    import java.io.*;
    import java.util.*;
    public class en
    public static void main(String args[]) throws IOException     
    {int data,data1,offset,offset1;
              FileOutputStream fos1=new FileOutputStream("c:/example3.txt");
              FileInputStream fis=new FileInputStream("c:/example1.txt");
              FileInputStream fis1=new FileInputStream("c:/example2.txt");
    while((data=fis.read())!=-1) 
         fos1.write(data);
    while((data=fis1.read())!=-1) 
    fos1.write(data);
    fis.close();
    fis1.close();
    fos1.close();
    }first create those 3 files in c:

  • How to read the data from XML file and insert into oracle DB

    Hi All,
    I have below require ment.
    I will receive data in the XML file. then i need to read that data and insert into oracle tables. please let me know how this can be handled.
    Many Thanks.

    Sounds a lot like this question, only with less details.
    how to read data from XML  variable and insert into table variable
    We can only help if you provide us details to help as we cannot see what you are doing and only know what you tell us.  Plenty of examples abound on the forums that cover the topics you seek as well.

  • I need the detail about how to read the data from spreadsheet file. but the file should not created by labview.

    i face some difficulties here. the datas are encrypted...... how to get correct data ..........

    Excel files are in a propriertary microsoft format. A LabVIEW "spreadsheet" file is a file containing an ASCII table with tabs separating columns and linefeeds separating rows. They are not ther same!
    If you use "write to spreadsheet file" and name the file *.xls, this does NOT make it an excel file, it just tells the operating system to open it with excel if you double-click it. Excel is smart enough to notice that it is not really an excel file and does its best to convert it transparently. The same does not work in reverse.
    You have several options:
    You can use excel to export your data to something LabVIEW can read. Try e.g. tab delimited text.
    You can use e.g. activeX to read an excel file, see: http://zone.ni.com/devzone/cda/epd/p/id/3409
    Search for excel in your example finder for more possibilites.
    LabVIEW Champion . Do more with less code and in less time .

  • How can i read the data from attached file?

    using javamail i receiving a mail with attachment
    but unable to read the content of the file
    Plz help me out
    thanks in advance

    The answer is in the JavaMail FAQ.

  • How do i use Java to read the data in XML files?

    Hi,
    I'm rather interested in using XML in my javacodes, as i think it will be of more OO.
    I want to make use of XML in my javacodes,
    but i don't know how to start doing it, so i hope someone would be able to enlighten me on this,
    =)
    Some examples would be perfect

    Humm interesting...well here is the link to Sun's tutorial on how to use maipulate an XML document using Java's jaxp api.I hope this will give u a hint.
    http://java.sun.com/xml/tutorial_intro.html
    Khalid

  • Populate a table reading the data from a TXT file

    how can I populate a table reading the data from a TXT file?
    thanks

    Hey Kevin!
    Using FORMS.TEXT_IO to bulk load data from a file strikes me as re-inventing the wheel. It is just about justifiable in a self-service environment, but I regard the EXTERNAL TABLE is a better solution for that situation as well.
    The same applies to UTL_FILE. I think the ability to read text with UTL_FILE is primarily intended for read file-based configuration or file manipulation/processing rather than data loading.
    Re-writing a text file into SQL statements is too much like hard work (even with an editor that supports macro definition and regular expressions) for no real benefit. You lose all the bulk load peformance you would get from SQL*Loader. But for QAD I'd probably let you off with it.
    You missed out one obvious alternative: using Java to turn the contents of an XML file into a CLOB and inserting it into a table which is read by a PL/SQL procedure that parses the XML records and insert the retrieved data into a table.
    Stay lucky, APC

  • Error when reading the data of infoprovider

    Hello,
    I have a problem when excecuting the transaction 'listcube' on a specific infocube. It occurs an error message which complains problem when reading the data of the infoprovider. The message text sounds as follows:
    Error reading the data of InfoProvider ZDPPTGR1
    Message no. DBMAN305
    Diagnosis
    Errors occurred while reading a VirtualProvider outside the BI system. Check whether the previous error messages contain any information about the possible cause of this error.
    It is possible that the error message cannot be displayed because the error message class does not exist in the BI system. If this is the case, only the name of the error class and the message number are displayed. View the error message text in the specified error class in the source system of the VirtualProvider.
    Procedure
    Since the error is not necessarily in the BI system, there is no specific procedure for resolving it. With VirtualProviders, problems often occur with the connection to the remote system; these can lead to system termination. If the code for the VirtualProvider is not from SAP, contact the relevant contact person to help resolve the issue.
    If an SQL error is listed in the previous message, see the procedure for SQL errors.
    Has anybody experience with solving this problem? It sounds like a bigger problem - can somebody confirm this? Or is it a problem which is easy to solve?
    Thanks for answering!
    Kind regards
    Heinz

    Hi,
    Please follow the below threads. They are similar to the error you are facing and they may help you with the issue ::
    Remote cube - uncaught exception
    DBMAN350 Error reading MultiCube data over aggregate
    Error reading the data of InfoProvider 0TCT_VC01
    Regards,
    Arpit

  • I use LabVIEW 7.1 but I have some problem when, I use LabVEW to read the data from serial communication

    I use LabVIEW 7.1 but I have some problem when, I use LabVEW to read the data from serial communication.
    I use LabVIEW to read the data from serial communication then, i open the example (.vi) from Serial Communication - Advanced Serial Write and Read  from LabVIEW Example. BUT it have some error message that : Error - 1073807202 occured  at property node in visa configure serial port (instr).vi -> advance serial write and read .vi
    this error code is undefined. no one has provide a description for this code, or you might have wired a number that is not an error code to the error code input.
    I don't know why? please help me. thank you.

    When I copy that code into "Explain Error" I get: "VISA:  (Hex 0xBFFF009E) A code library required by VISA could not be located or loaded."
    You may have a bad install of VISA or the wrong version of VISA loaded. Try re-installing VISA. You can get the latest version from the NI support site: http://digital.ni.com/softlib.nsf/webcategories/85256410006C055586256BBB002C0E91?opendocument&node=1....
    Also ensure that you are not pointing the example towards a serial port that does not exist.
    Please let us know what you find and what gets this working for you.
         Rob

  • Reading the data from the BufferReader????

    Hi,
    When i read the data from the BufferReader Like:-
    // Reading the data
    sbAppendBuf.append("<!--"+openingTag+"\r\n");
    BufferedReader readercopyRightInput= new BufferedReader(new FileReader(copyRightFile));
    while ((filecopyRightData=readercopyRightInput.readLine()) != null) {
    sbAppendBuf.append(filecopyRightData+"\r\n");
    sbAppendBuf.append(closingTag+"-->"+"\r\n");
    I am getting an extra new line character before the Closing Tag. Where the output is like:-
    <!--<opentag>
    <<contents>>
    // Extra space before the closeTag
    </closetag> -->
    How the extra space is coming i am not so sure where "\r" is needed for the proper alignment.So it is needed.
    Please do provide a solution for this..
    Thanks,
    JavaLover

    Here the snippet of my code:-
    sbAppendBuf.append("<!--"+openingTag);
    BufferedReader readercopyRightInput= new BufferedReader(new FileReader(copyRightFile));
    while ((filecopyRightData=readercopyRightInput.readLine()) != null) {
    sbAppendBuf.append(filecopyRightData+"\r\n");
    sbAppendBuf.append(closingTag+"-->"+"\r\n");
    Thanks,
    Java Lover

Maybe you are looking for

  • My iPad won't open apps without crashing

    Hi, My iPad mini (1st gen) keeps crashing as soon as I open apps. I've tried resetting and turning on and off but this doesn't do anything. I'm trying to restore but iTunes say I can't  because "Find my iPad" is turned on and tells me to turn it off

  • How do I delete my iCloud account on my iPad when there is no 'delete' option

    My iPad iCloud account does not have a 'delete' option though my iPhone does. How canI delete the account on my iPad so that I can set u a new Apple ID?

  • My headphone jack is stuck in my ipod and broke off. What do I do to get it out?

    My ipod touch 4th Gen was working fine until I dropped it and the headphones broke off completely at the tip, so the jack is completely stuck, and I cant get it out with tweezers or anything. I might take it to the Apple store, but would they be able

  • Link with table CAWN and MSEG

    Hi Friend how can i link with clasification fields(CAWN-ATWRT) with meterial document no(MSEG-MBLNR) in MM in the transaction migo. Thanks and Regards D Tarun Kumar Edited by: Devalla Tarun Kr. on Sep 9, 2008 2:29 PM

  • Problem with populating ROWSET

    Hi , I have a problem with ROWSET. I have a table with 6 columns and approximately more than 200 records. I reterive them in a ResultSet and resultset gets populated. But I populate Rowset with that ResultSet then it hangs for atleast 1 minuate and t