Putting data read from a StreamTokenizer into an array.

I need to put the data that I have read from a file using a streamtokenizer into an array, so that I can use it later on in my program.
If anyone can help I would be grateful!!

Here's a link that should help. It even includes an example:
http://java.sun.com/docs/books/jls/first_edition/html/javaio.doc14.html

Similar Messages

  • Moving data string from a jtextarea into an array

    i was looking for some advice. how would i be able to take chunks of text on a paragraph by paragraph basis and enter them into an array. which would result in paragraph1 in array 0, and so on. is this possible to do? i have never really used straing arrays before, and if anyone knows of any online tutorials it would be a great help
    thank u

    here you go, forgive the gui, very sloppy looking, press the Click me button to store the jtextarea data into the array and show output button to see what the value stored in the array is. there are 2 classes:
    class MyMain {
          public static void main(String args[]){
              MyMain main = new MyMain();
              main.createIt();
          public void createIt() {
              MyFrame frame = new MyFrame();
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    class MyFrame extends JFrame {
          String[] myString = new String[1];
          JTextArea textArea = new JTextArea();
          JButton myButton = new JButton("Click me");
          JButton outButton = new JButton("Show output");
          MyFrame() {
              myButton.addActionListener(new ButtonListener());
              outButton.addActionListener(new OutListener());
              getContentPane().setLayout(new GridLayout(1,3));
              getContentPane().add(myButton);
              getContentPane().add(textArea);
              getContentPane().add(outButton);
              setVisible(true);
          class ButtonListener implements ActionListener{
              public void actionPerformed(ActionEvent e){
                  myString[0] = textArea.getText();
          class OutListener implements ActionListener{
              public void actionPerformed(ActionEvent e) {
                  System.out.println(myString[0]);
    }

  • I-photo:  I used 2 cameras to take pictures on a trip --- i have put the pictures from both cameras into an album --- when i click on view and then sort by date, the pictures do not sort by date --- any ideas on how to get the pics sorted by date?

    I-photo:  I used 2 cameras to take pictures on a trip --- i have put the pictures from both cameras into an album --- when i click on view and then sort by date, the pictures do not sort by date --- any ideas on how to get the pics sorted by date?

    Select all the photos that you need to change, then click the "Photos" menu and choose "Adjust Date and Time".
    If you add a year, it will adjust all the photos that you selected by adding a year (so if you accidentally select one of the photos that already has "2012", that will change to "2013"). 

  • How to store the data coming from network analyser into a text or excel file

    Hii everyone
    I'm using Agilent 8719ET network analyser and wish to store the data coming from netowrk analyser into a text file/ excel file.
    Presently I'm able to get the data on Labview graph using GPIB . Can anyone suggest how to go ahead after collect data sub vi. How can the data be stored into a file apart from showing on the graph?
    Attached is the vi for kind consideration...
    Looking for help
    Regards
    Rohit
    Attachments:
    Agilent 87XX Series Exceed Max Meas.vi ‏43 KB

    First let me say that your code really looks pretty good. The data handling could be made more efficient by calculating the number of datapoints that are going to be in the completed dataset and preallocating the entire array -- but depending upon your answer to my questions, the logic in the lower shift register may be going away - so we won't worry about that right now.
    The thing I need to know before addressing the data storage question is: Each time you call "Collect and Display Data.vi", how many element are in the array? Are you reading single data points, or a group of data? (BTW: if the answer to that question is obvious based on the way the other VIs are setup, I don't have the drivers so I can't tell what the setup values are.) Second, how fast does the loop iterate? Are we talking msec per loop?, seconds? fortnights?
    The issues here are two-fold: how much data? and how fast is it coming? The answer to these will tell you how to save the data.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How to read from and write into the same file from multiple threads?

    I need to read from and write into a same file multiple threads.
    How can we do that without any data contamination.
    Can u please provide coding for this type of task.
    Thanks in advance.

    Assuming you are using RandomAccessFile, you can use the locking functionality in the Java NIO library to lock sections of a file that you are reading/writing from each thread (or process).
    If you can't use NIO, and all your threads are in the same application, you can create your own in-process locking mechanism that each thread uses prior to accessing the file. That would take some development, and the OS already has the capability, so using NIO is the best way to go if you can use JDK 1.4 or higher.
    - K
    I need to read from and write into a same file
    multiple threads.
    How can we do that without any data contamination.
    Can u please provide coding for this type of task.
    Thanks in advance.

  • Weblogic 11G error = BEA-000449  Closing socket as no data read from it

    In My Weblogic 11G, i am getting Warning msg in my log file saying Closing socket as no data read from it
    ####<Nov 2, 2010 12:10:53 AM IST> <Warning> <Socket> <TradeServer> <TradeServer> <[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <1288636853607> <BEA-000449> <Closing socket as no data read from it on 95.66.7.15:58,089 during the configured idle timeout of 25 secs>
    ####<Nov 2, 2010 12:10:53 AM IST> <Warning> <Socket> <TradeServer> <TradeServer> <[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <1288636853607> <BEA-000449> <Closing socket as no data read from it on 95.66.7.15:58,088 during the configured idle timeout of 25 secs>
    ####<Nov 2, 2010 12:21:37 AM IST> <Info> <JDBC> <TradeServer> <TradeServer> <[ACTIVE] ExecuteThread: '23' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <1288637497701> <BEA-001128> <Connection for pool "IB_JDBC_Data_Source" closed.>
    I have follow the following step
    If you want to follow this solution. Go to Admin console -> Click on Domain->Configuration->Log Filters->create new Log filter.
    I added this line in expression "(MESSAGE !='Closing socket as no data read from it during the configured idle timeout of 5 secs')"
    Go to your server-(for each server you have to set it individually)->Logging->Advanced->Select this log filter for Standard Out or log file.
    My Filter is "(MESSAGE !=Closing socket as no data read from it ')"
    this is not working in weblogic 11G, any one have the solution to stop this msg.
    Edited by: Amar_Shaw on Nov 3, 2010 1:40 PM

    Hi Amar,
    I think you have given the wrong string in the filter, you are getting "*Closing socket as no data read from it on 95.66.7.15:58,089 during the configured idle timeout of 25 secs*" and you have given in the filter "*Closing socket as no data read from it during the configured idle timeout of 5 secs*".
    You can change it and see if that works for you.
    Also the above option is just to suppress the issue which are getting which in this case is fine as its just a warning message, however you can even try to tune few of the follwoing parameters that too would help you to remove this warning message.
    1. Set the parameter -Dweblogic.client.socket.ConnectTimeout=XXX, in the start-up script of the server which you are seeing this issue under JAVA_OPTIONS
    Note: Where "XXX" is the value in ms.
    Example:
    -Dweblogic.client.socket.ConnectTimeout=500
    2. Try tuning the duration time to a higher value from the below Console path
    Server -> Protocols (tab) -> HTTP (sub-tab) -> Duration
    Regards,
    Ravish Mody
    http://middlewaremagic.com/weblogic/
    Middleware Magic | Come, Join Us and Experience The Magic…

  • Data read from undo

    hi,
    how to find the data read from undo tablespace.
    how to find the data read from datafile.
    any select statement read from redo log or not. i think no,is it correct
    thanks
    with regards

    user3266490 wrote:
    hi,
    thanks for reply.
    What does it mean by "how to find data read" ?
    that means how  to find the a select statement  whether read from data buffer cache or data file*
    even if it is read from data file.first kept in buffer then return to userYes , data is always going to be read from teh buffer cache only , even if its going to be a physical read too.
    In case you want to see that there was a PIO involved or logical IO( from teh cache), you can check so by seeing the stats for the query like below
    SQL*Plus: Release 10.2.0.1.0 - Production on Thu May 21 11:59:39 2009
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Connected to an idle instance.
    SQL> startup
    ORACLE instance started.
    Total System Global Area  167772160 bytes
    Fixed Size                  1247900 bytes
    Variable Size              75498852 bytes
    Database Buffers           88080384 bytes
    Redo Buffers                2945024 bytes
    Database mounted.
    Database opened.
    SQL> conn aman/aman
    Connected.
    SQL> set autot trace stat
    SQL> select * from scott.emp;
    14 rows selected.
    Statistics
            455  recursive calls
              0  db block gets
             83  consistent gets
             10  physical reads                      <----------------------- This went to disk first to read the data
              0  redo size
           1415  bytes sent via SQL*Net to client
            381  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              6  sorts (memory)
              0  sorts (disk)
             14  rows processed
    SQL> select * from scott.emp;
    14 rows selected.
    Statistics
              0  recursive calls
              0  db block gets
              8  consistent gets
              0  physical reads                    <---------------No PIO, which means it was accessed truly from the cache and didn't involve disk IO at all.
              0  redo size
           1415  bytes sent via SQL*Net to client
            381  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
             14  rows processed
    SQL>HTH
    Aman....
    Edited by: Aman.... on May 21, 2009 11:58 AM

  • BEA-000449  Closing socket as no data read from it

    This error message is filling up the server log files. It looks like some network problem. How can I find the cause ? This does not create a functional problem, but I am sure there will be a performance problem. Also, since this message is filling up the logs rapidly, I cannot see my regular application debug statements.
    <Warning> <Socket> <myserver.mydomain.net> <my_managedserver_01> <[ACTIVE] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1218554019557> <BEA-000449> <Closing socket as no data read from it during the configured idle timeout of 30 secs>
    The timeout of 30 seconds is the value set in Login Timeout in server tuning tab.
    Environment:
    WebLogic Portal 10.0 MP1 (The domain is a server domain, not portal domain)
    Red Hat linux 4
    Intel Xeon
    Message was edited by:
    prakashp

    In My Weblogic 11G, i am getting Warning msg in my log file saying Closing socket as no data read from it
    ####<Nov 2, 2010 12:10:53 AM IST> <Warning> <Socket> <TradeServer> <TradeServer> <[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1288636853607> <BEA-000449> <Closing socket as no data read from it on 95.66.7.15:58,089 during the configured idle timeout of 25 secs>
    ####<Nov 2, 2010 12:10:53 AM IST> <Warning> <Socket> <TradeServer> <TradeServer> <[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1288636853607> <BEA-000449> <Closing socket as no data read from it on 95.66.7.15:58,088 during the configured idle timeout of 25 secs>
    ####<Nov 2, 2010 12:21:37 AM IST> <Info> <JDBC> <TradeServer> <TradeServer> <[ACTIVE] ExecuteThread: '23' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1288637497701> <BEA-001128> <Connection for pool "IB_JDBC_Data_Source" closed.>
    I have follow the following step
    If you want to follow this solution. Go to Admin console -> Click on Domain->Configuration->Log Filters->create new Log filter.
    I added this line in expression "(MESSAGE !='Closing socket as no data read from it during the configured idle timeout of 5 secs')"
    Go to your server-(for each server you have to set it individually)->Logging->Advanced->Select this log filter for Standard Out or log file.
    this is not working in weblogic 11G, any one have the solution to stop this msg.

  • Data Managers from all applications into one unique package

    Hi,
    The issue is that we are trying to put all the Data manager packages in all applications into one unique package.
    If BPC admin changes the parameters or currency rates , he just has to run that one package which includes all necessary
    packages and he may look into logs if he has to.
    Firstly , We tried to put multiple run_logic process types into one process chains, but it is giving errors like;
    u201CAn exception with the type CX_SY_TABLE_KEY_SPECIFICATION occurred, but was neither handled locally, nor declared in
    a RAISING clause Line Type Contains a Component with the Name FI_ACCu201D
    or
    u201CAn exception with the type CX_SY_OPEN_SQL_DB occurred, but was neither handled locally, nor declared in a RAISING clause
    The system tried to insert a data record, even though a data record with the same primary key already existsu201D.
    Secondly, after we read the blog () and we tried to run program
    UJD_TEST_PACKAGE , but we get errors with %SELECTION% prompt variable.
    Is there any other solution you can advise?
    If we use the program UJD_TEST_PACKAGE how do we fill AnswerPrompt paremeter file for the dynamic script below?
    PROMPT(SELECTINPUT,,,"Lütfen bir kategori seçiniz.","%CATEGORY_DIM%,%TIME_DIM%")
    PROMPT(TEXT,%LEVEL%,"XX Level",,"7,6,5,4,3,2,1")
    INFO(%EQU%,=)
    INFO(%TAB%,;)
    TASK(XXX_LOGIC,TAB,%TAB%)
    TASK(XXX_LOGIC,EQU,%EQU%)
    TASK(XXX_LOGIC,SUSER,%USER%)
    TASK(XXX_LOGIC,SAPPSET,%APPSET%)
    TASK(XXX_LOGIC,SAPP,MM)
    TASK(XXX_LOGIC,SELECTION,%SELECTION%)
    TASK(XXX_LOGIC,LOGICFILENAME,XXXX.LGF)
    TASK(XXX_LOGIC,REPLACEPARAM,LEVEL%EQU%%LEVEL%)
    Best Regards,
    Melike

    Hi.  I have a similar issue to the one posted below in that I want to run a logic script for one application (call it Application A) from a DM package in a different application (Application B).  This is to stop the user from having to switch between applications to run the logic.
    I have tried the following:
    1. I have tried putting the script logic from App A into App B, but the dimensionality is different so it fails to validate.
    2. I have tried "hard coding" the application name within the process chain, but it fails with an error "u201CAn exception with the type CX_SY_TABLE_KEY_SPECIFICATION occurred ...." similar to the post below.
    Any suggestions would be appreciated.
    Thanks
    Sean

  • How to transfer data retrieved from a bean, into requestScope

    I have a jsf page called viewCustomer.jsp, which is backed by a controller/mbean with a name viewCustomerController.
    This page is always called via a request which carries the customer accountID in its request attributes. Hence in order to load the customer details i am using a f:view beforephase call which acts before the render phase. This retrieves a number of beans from of different types. For example, each customer can have an address.
    each addressbean has an ID field which is the primary key to the addresses. If i want to delete the address, i need to send this primary key via a requestAttribute to a controller which will delete it.
    hence to delete the address i have a form such as:-
    <h:form>
    <h:inputHidden value="#{viewCustomerController.customerAddressBean.id}" />
    <h:commandButton value="Delete Address" action="#{viewCustomerController.deleteCustomerAddress}" />
    </h:form>
    The problem with this, is that because the addressbean is only added before the render phase, on presssing the delete address button, i get a null exception, because customerAddressBean doesnt exist yet.
    What i want to do, is that upon pressing the delete address button, the id value should be immediately sent to a requestAttribute called 'addressId', and not back to the backing bean.
    i. e. (if jsf had an assignment operator) it would be something like
    <h:form>
    <h:inputHidden value="requestScope.addressID = #{viewCustomerController.customerAddressBean.id}" />
    <h:commandButton value="Delete Address" action="#{viewCustomerController.deleteCustomerAddress}" />
    </h:form>
    basically, the data should be read from the backing bean, but it shouldnt be written back to the backing bean.
    now i realize that if i allow my database to repopulate the backing bean earlier, the customerAddressBean will be populated, and then the first listing would work. But that would require a second set of trips to the database with no meaning but to repopulate the backing bean which seems like quite a waste.
    In the case of the address, i could populate the propertly with a dummy addressbean, but this would not work in the case of properties which are lists of beans.
    So in summation. How do i transfer data that has been read from a property of a backing bean, into a request attribute on a commandbutton click, without putting the data back into the property of the backing bean.

    Hello Anu,
    There are different hardware options that you have here. The basic things that you need to keep in mind is that the PDA that you purchase runs on Pocket PC and has either a CompactFlash or a PCMCIA slot in it. The driver that you would be using for your LabVIEW PDA application would NI-DAQmx Base Ver 2.0.1. You can refer to its readme for more information on the supported hardware. Also you can check at this page for more information on the supported devices. About your original question, using LabVIEW PDA you can create a text file for storing data and separate the data points with a comma. So that this way you would be able to open the file in Excel if you wanted to. All the file I/O related VIs can be found in the function palette at Programming >> File I/O.
    Regards,
    Chetan K.
    Application Engineer
    National Instruments

  • Open and read from text file into a text box for Windows Store

    I wish to open and read from a text file into a text box in C# for the Windows Store using VS Express 2012 for Windows 8.
    Can anyone point me to sample code and tutorials specifically for Windows Store using C#.
    Is it possible to add a Text file in Windows Store. This option only seems to be available in Visual C#.
    Thanks
    Wendel

    This is a simple sample for Read/Load Text file from IsolateStorage and Read file from InstalledLocation (this folder only can be read)
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Windows.Storage;
    using System.IO;
    namespace TextFileDemo
    public class TextFileHelper
    async public static Task<bool> SaveTextFileToIsolateStorageAsync(string filename, string data)
    byte[] fileBytes = System.Text.Encoding.UTF8.GetBytes(data);
    StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
    var file = await local.CreateFileAsync(filename, CreationCollisionOption.ReplaceExisting);
    try
    using (var s = await file.OpenStreamForWriteAsync())
    s.Write(fileBytes, 0, fileBytes.Length);
    return true;
    catch
    return false;
    async public static Task<string> LoadTextFileFormIsolateStorageAsync(string filename)
    StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
    string returnvalue = string.Empty;
    try
    var file = await local.OpenStreamForReadAsync(filename);
    using (StreamReader streamReader = new StreamReader(file))
    returnvalue = streamReader.ReadToEnd();
    catch (Exception ex)
    // do somthing when exception
    return returnvalue;
    async public static Task<string> LoadTextFileFormInstalledLocationAsync(string filename)
    StorageFolder local = Windows.ApplicationModel.Package.Current.InstalledLocation;
    string returnvalue = string.Empty;
    try
    var file = await local.OpenStreamForReadAsync(filename);
    using (StreamReader streamReader = new StreamReader(file))
    returnvalue = streamReader.ReadToEnd();
    catch (Exception ex)
    // do somthing when exception
    return returnvalue;
    show how to use it as below
    async private void Button_Click(object sender, RoutedEventArgs e)
    string txt =await TextFileHelper.LoadTextFileFormInstalledLocationAsync("TextFile1.txt");
    Debug.WriteLine(txt);
    在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。

  • Why can I not put a picture from camera roll into an album?

    Why can I not put a picture from my camera roll into an album now? When I try these are greyed out. I created these albums on my ipad too but ever since I updated to IOS 7 this can't be done, it was so easy before.

    I can now answer my own question as I've worked it out. For those who are interested click on Shared Streams then on album you require photo to be in then click on the empty box with a cross in the centre and choose photo you wish to add.

  • Putting attribute value from java level into sessionScope variable?

    Hallo,
    is it possible to put an attribute value from java level into a sessionScope variable?
    For example when i'am in prepareSession is it possible to fill a sessionScope variable which i can use in a jspx-Site? And when how i must do it?
    Any help is appreciated.

    At the java level i make this
    private void setUserIdIntoUserDataHashtable() {
    Integer userid = getUserIdForLoggedInUser();
    Integer groupid = getGroupIdForLoggedInUser();
    Hashtable userdata = getDBTransaction().getSession().getUserData();
    if (userdata == null){
    userdata = new Hashtable();
    userdata.put(PBConstants.CURRENT_USER_ID, userid);
    userdata.put(PBConstants.CURRENT_GROUP_ID, groupid);
    And when i at the java level i can use the constants. But i don't have an interaction at this point. Thats why i don't now how to bring the values to a sessionScope variable i need later in a / some sites?

  • I put the sdcard from my camera into the large disc slot and it is stuck!!

    I put the sd card from my camera into the large disc slot and it is stuck. I've tried shaking it out.

    The safest option is to take it into an apple retail store or an authorized service provider. It is a bad idea to stick things in the disk drive to try to get the SD card out and risk any more possible damage.

  • Convert a line read from text file into string

    how to convert a line from text file into string?
    i know how to convert to numbers,
    private int  parseLine1(String line) {
              StringTokenizer tokenizer = new StringTokenizer(line);
                  value1 = Integer.valueOf(tokenizer.nextToken()).intValue();
                  value2 = Integer.valueOf(tokenizer.nextToken()).intValue();
                 return value1;
                     }but what about charactrs?

    ok, here is my problem, i have a file with a bunch of Xs in it but position function doesn't return a correct value, what's going wrong?
    private int positioni(){
           int i=0;
           int j=0;
           int b=0;
           String line="";
            while(line!= null){
                for(int a=0; a<line.length(); a++){
                    if(line.charAt(a)=='X'){
                        i=a;}
                b++;
                j=b;
                t=line.length();
                line=read(gridFileN);
           return i;
    private String read(String ggridFileN){
             TextStreamReader ggridFile = new TextStreamReader(ggridFileN);
             return ggridFile.readLine();

Maybe you are looking for

  • Restricting Follow Up Activities on Lead Transaction

    Hello All, I need to restrict certain follow up activities on the lead transaction, I have gone through the forum and found out that the same can be restricted using authorizations Following are the posts Limit the transaction types by role Restrict

  • How to access the data in a TableView with build-in Dropdownlists

    Hi, I build up a TableView with DropdownListBoxes in the cells. All works so far but if I try to access the data in the cells I get the following error message :      at java.lang.Thread.run(Thread.java:479) Caused by: java.lang.reflect.InvocationTar

  • Printing document from FB03

    Hi We are on ECC 6.0.  After displaying a document in FB03, if i wish to print it, only the line items are passed for output (in spool) not the header data. If i go to Document - Print preview and then print, complete document is passed to output. Al

  • MobileMe Question

    I use the apple mail client to retrieve and manage my POP email accounts. [email protected] I have never used .mac or want to use the .me as a primary email. I set everything up and I was expecting the mobileme site to import all my emails and folder

  • Access Exporter Error -2147221163

    When i try to export an 2003 mdb file with the Access exorter i get the error message 2147221163. Can somebody tell me what i did wrong ?