Reading two strings from rms

hi guys i save two strings in the same array of bytes in this way:
baos = new ByteArrayOutputStream();
            dos = new DataOutputStream(baos);
            dos.writeChars(id);
            dos.writeChars(dire);
            System.out.println(id);
            System.out.println(dire);
            dos.flush();
            registro = baos.toByteArray();
            rs.addRecord(registro,0,registro.length);           
            baos.close();
            dos.close();            and i read them like this:
ByteArrayInputStream bais;
     String x, y;
     DataInputStream dis;
     byte[] registro = new byte[75];
     try{
            bais = new ByteArrayInputStream(registro);
            dis = new DataInputStream(bais);
            System.out.println("numero de registros: " + rs.getNumRecords());
            for (int i=1;i<=rs.getNumRecords();i++){
                rs.getRecord(i,registro,0);
                x = dis.readUTF();
                LectArch.append("Numero de Id: " + x, null);
                LectArch.append("Direcci�n: ", null);
                y = dis.readUTF();
                LectArch.append(y, null);               
                bais.reset();
                System.out.println(x + y);
            bais.close();
            dis.close();
            rs.closeRecordStore();
        }this works excelent when i save two drifferents types of values like int and string but doesnt work with two string, is it wrong to try to save two string in the same array?

use writeUTF() and readUTF()

Similar Messages

  • Read 2 Strings from EXCEL with GOOP or ActiveX?

    Hello,
    i use Labview 5.1 with WIN NT4.0 SP6a and i programm a fuzzy Logic tool for a exam in Computer Science.
    Now i have a problem, and i read something about the GOOP and the EXCEL Toolkit. I download it and try more times to install but i can't link the *.llb in the Function Palette. Is this GOOP and Excel Toolkit only for Labview 6.x ?
    I solve it with ActiveX and Excel, but my very big Problem is, i need to read2 string from the Excel table from the same time, and with ActiveX i don't find any method how can i do that.
    I don't know how can i read 2 Strings from a Excel table, Can i do it with the Excel Toolkit,if yes how, maybe anyone make it or any helpfiles?
    Thanks for your answer in advance ,
    Ender
    Ekinci

    "fuzzylogic" wrote in message
    news:[email protected]..
    > Hello,
    > i use Labview 5.1 with WIN NT4.0 SP6a and i programm a fuzzy Logic
    > tool for a exam in Computer Science.
    > Now i have a problem, and i read something about the GOOP and the
    > EXCEL Toolkit. I download it and try more times to install but i can't
    > link the *.llb in the Function Palette. Is this GOOP and Excel Toolkit
    > only for Labview 6.x ?
    >
    > I solve it with ActiveX and Excel, but my very big Problem is, i need
    > to read2 string from the Excel table from the same time, and with
    > ActiveX i don't find any method how can i do that.
    >
    > I don't know how can i read 2 Strings from a Excel table, Can i do it
    > with the Excel Toolkit,if yes how, m
    aybe anyone make it or any
    > helpfiles?
    I'm pretty sure the excel toolkit is written for 5.1, and don't know why it
    would give you problems. Do you have excel installed? I'm not sure what
    you mean that you cant link the *.llb in function pallette. Have you tried
    opening the llb using '\functions\select a vi' ? As to how to read two
    cells at once, you could read a block of cells including both cells (ie:
    A5..D10) and then pull the data out of the array.

  • Reading Each String From a text File

    Hello everyone...,
    I've a doubt in File...cos am not aware of File.....Could anyone
    plz tell me how do i read each String from a text file and store those Strings in each File...For example if a file contains "Java Tchnology forums, File handling in Java"...
    The output should be like this... Each file should contains each String....i.e..., Java-File1,Technology-File2...and so on....Plz anyone help me

    The Java� Tutorials > Essential Classes: Basic I/O

  • How 2 read two files from 2 diff. directories, using single adapter

    How 2 read two files from 2 diff. directories in same system, using single file adapter.

    you can use advanced selection for source file
    see
    http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/frameset.htm

  • How to read a string from file & assign the val to a variable in batch file

    Hi,
    How to read a string from a file and assign the value to a variable then return the value to the screen in windows batch file?
    Any suggestions?
    thanks.

    Unless this is a homework question then I don't see the purpose of doing this, but....
    You should be looking a the supplied package utl_file to get the string out of the file, dbms_output to display the string and then google windows batch/command files calling sqlplus to execute your program.
    Andre

  • How to design and implement an application that reads a string from the ...

    How to design and implement an application that reads a string from the user and prints it one character per line???

    This is so trivial that it barely deserves the words "design" or "application".
    You can use java.util.Scanner to get user input from the command line.
    You can use String.getChars to convert a String into an array of characters.
    You can use a loop to get all the characters individually.
    You can use System.out.println to print data on its own line.
    Good luck on your homework.

  • Read query string from End User Menu

    In our IdM application, I want to be able to read a variable passed in a query string.
    The string is part of the JSP page which takes the user back to the end user menu (user/main.jsp).
    Is there a way for the end user menu to read a value from a query string?
    Or can user/main.jsp be modified to pass the value from the query string to the end user menu?

    can you brief ur requirement?

  • Reading a String from the Console.

    Hello,
    I am new to Java... I have to write a program which will read a long value from the console. Can somebody help me in this? or can i read it as a string and then convert to Long ? I prefer the second one as I am planning to convert this code to read a SOAP message... Can somebody help me or pint me to the right direction?
    Thanks,

    Reading it as a string and then parsing it (Long.parseLong(...)) is the way to do this.
    As far as converting to SOAP - slow down. If you're just getting started with java, you're going to be biting off a lot trying to tackle SOAP

  • How to read a String from a simple text file.

    I have a set up popup reminders, the content of which I have entered into a text file. I read the text and display it in a specially formatted JFrame/JPanel.
    My question is, since readLine() has been deprecated, how do you read a simple line of text data from a file created by, say, notepad? I guess I could just use readLine() anyway, but I want to learn the language, and "playing by the rules" seems to be the way I should go.

    I''m guessing your referring to the readLine method of DataInputStream. Use another class, like BufferedReader, which also happens to have a method named readLine:
    BufferedReader in = new BufferedReader(new FileReader(filename));
    try {
        String line;
        while ((line = in.readLine()) != null) {
            //process line
    } finally {
        in.close();
    }

  • How to create two String from ResultSet to arraylist?

    Hi,
    Here is my question:
    String sql = "select colA, colB from tblA";
    String str1 = null;
    String str2 = null;
    ArrayList al = null;
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery(sql);
    while(rs.next()){
              str1 = rs.getString("colA");
              str2 = rs.getString("colB");
    }May i know how can i set the str1 and str2 in the ArrayList al?
    Thanks.

    Hi,
    Here is my question:
    String sql = "select colA, colB from tblA";
    String str1 = null;
    String str2 = null;
    ArrayList al = null;
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery(sql);
    while(rs.next()){
    str1 = rs.getString("colA");
    str2 = rs.getString("colB");
    May i know how can i set the str1 and str2 in the
    ArrayList al?
    Thanks.
    is this what you're looking for?
    al = new ArrayList();
    al.add(str1);
    al.add(str2);

  • Reading A String From A File

    Having Difficulties Parsing a file for specific information. How do you either convert a int (from the read class) to a stream or how do you read a stream directly from a file?
    Also need to know how can ensure that tags within an XML document do not overlap...
    any help is appreciated -- thank you...
    import java.io.*;
         public class Check
         public static void main(String[] args) throws IOException
              if (args.length != 1)
                   System.out.println("JAVA Check <doc.xml>");
                   return;
              String fileName;
              fileName = args[0];
              if (fileName.endsWith(".xml"))
                   System.out.println("THE FILE IS A VALID XML FILE");
                   else
                   System.out.println("NOT A VALID XML FILE");
              File inFile=new File(args[0]);
              FileReader fr=new FileReader(inFile);
              File outFile=new File(args[0]);
              FileWriter fw=new FileWriter(outFile);
              String frontopentag = "<";
                   Check fot=new Check();
                   int countfrontopentag = 0;
              String frontclosetag = "</";
                   Check fct=new Check();
                   int countfrontclosetag = 0;
              String backclosetag = ">";
                   Check bct=new Check();
                   int countbackclosetag = 0;
              int c=0;
              c=fr.read();
              while (c != -1)
                   fw.write(c);
                   c=fr.read();
                        if (fot.equals("<"))
                        ++countfrontopentag;
                        return;
                        if (fct.equals("</"))
                        ++countfrontclosetag;
                        return;
                        if (bct.equals(">"))
                        ++countbackclosetag;
                        return;
                        if (countfrontopentag != countfrontclosetag)
                        System.out.println("CHECK THAT THE OPENING OF THE TAGS ARE BALANCED, '<...' AND '</...'");
                        else
                        System.out.println("OPENING TAGS ARE BALANCED, '<...' AND '</...'");
                        if(countbackclosetag%2 == 0)
                        System.out.println("CLOSING TAGS ARE BALANCED, '...>'");
                        else
                        System.out.println("CHECK THAT THE CLOSING TAGS ARE BALANCED, '...>'");
                        if((2*countbackclosetag) != countfrontopentag)
                        System.out.println("CHECK THAT THE NUMBER OF '<...' AND '</...' EQUALS THE NUMBER OF CLOSING TAGS, '...>'");
                        else
                        System.out.println("THE NUMBER OF '<...' AND '</...' EQUALS THE NUMBER OF CLOSING TAGS, '...>'");
              fr.close();
              fw.close();
              } //close main
         } //close class

    Well... I have no idea of how much java you know, so please forgive me if I state something you already know by heart.
    your best bet for the integer is reading by characters,
    testing them, (Character.isDigit(a valid character)) and the Character.digit(char ch, int radix) method.
    char ch;
    forloop
    ch = aString.charAt(i);
    if (Character.isDigit(ch))
    while your best bet for overlapping brackets and such would be to use a number, and add to it whenever there is a left-hand bracket, and subtract from it, whenever there is a right-hand bracket. or use a stack to save the characters within the brackets and then, whenever you find a right-hand bracket, evaluate the string up to the point of the last left-hand bracket.

  • Character '\' is lost when reading a String from a property file.

    Hi all,
    I have encrypted information inside a property file, but when loading properties in my program, the String object used to store the value is changed by the lost of all �\� characters
    # EIS password saved in the property file
    password=WPLqQE0DlVF8Sg\=\=
    #Value loaded in my String object
    WPLqQE0DlVF8Sg==
    Why is this happening? I use java.util.Properties java class to store and load my properties, and it is supposed to do it with the same encoding (ISO 8859-1).
    Please, can someone explain me why this happened and how to solve it?
    Best regards.

          public static void main(String[] args) throws IOException {
               OutputStream props = new FileOutputStream("test.properties");
               Properties p = new Properties();
               p.put("password", "pass=word#is!dumb");
               p.put("user", "    I am a Dummy");
               p.store(props, "Java forum demo props file");
               props.close();
               /* Properties file after store
                * user=\    I am a Dummy
                * password=pass\=word\#is\!dumb
               Properties post = new Properties();
               post.load(new FileInputStream("test.properties"));
               for(Iterator it = post.entrySet().iterator(); it.hasNext();)
                System.out.println(it.next());
                * After load from test.properties
                * user=    I am a Dummy
                * password=pass=word#is!dumb
          }Notice that the special chars are only in the file, not actually in the props. If you think otherwise, I don't know what to say. The \ is a special character that is used to escape other special chars, including itself. You can't create a string in java containing only one backslash, as java assumes the next char is being escaped. when you create a string in Java with one backslash, you have to have 2 backslashes. If you are storing data in the property file using something other than store, than you need to ensure that you are escaping all special charachters that the store method does
    ~Tim

  • Apache - CGI script can't read query string from STDIN

    My Perl CGI script begins as follows:
    if ($ENV{'REQUEST_METHOD'} eq "POST") {
    read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
    I dumped all ENV variables at entry, and verified that REQUEST_METHOD = "POST" and CONTENT_LENGTH = 73 (which is correct). QUERY_STRING is null. After the above read statement, $in is still null. Any idea why STDIN is not providing the query string?
    Thanks!
    Chap
    867MHz Powerbook   Mac OS X (10.4.8)  

    Hi--
    This isn't really an answer to the question you asked, but is there a reason you aren't using the Perl CGI module? It's installed by default on OS X and makes this kind of stuff much, much easier. Just add a line like this at the top of your script:
    <pre class="command">use CGI qw(:standard);</pre>Then you can get the paramaters for your script like so:
    <pre class="command">my $value = param('paramname');</pre>No muss, no fuss. You can get more information at the CPAN archive page for this module.
    charlie

  • How could java get two strings from c function?

    As title! I want to let a java code call C function. And the C funtion returns two unsigned char pointers.
    Thanks a lot.

    I have the other problem. When compile the code with jnienv, it always shows errors...It's because the code I posted is for C compiler, not C++.
    Here is a complete example in C++.
    Just compile the Java part, then the C++ part, then run it at the console:
    java TestCStringIt should give you:
    Hello
    World!
    // TestCString.java
    class TestCString
        static
            System.loadLibrary("testcstring");
        native String[] getStrings();
        public static void main(String[] args)
            TestCString test = new TestCString();
            String[] strArray = test.getStrings();
            System.out.println(strArray[0]);
            System.out.println(strArray[1]);
    // testcstring.h
    #ifndef _Included_TestCString
    #define _Included_TestCString
    #include <jni.h>
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class:     TestCString
    * Method:    getStrings
    * Signature: ()[Ljava/lang/String;
    JNIEXPORT jobjectArray JNICALL Java_TestCString_getStrings(JNIEnv * env, jobject obj);
    #ifdef __cplusplus
    #endif
    #endif /* _Included_TestCString */
    // testcstring.cpp
    #include "testcstring.h"
    static char * g1 = "Hello";
    static char * g2 = "World!";
    static void myCFunc(unsigned char ** pp1, unsigned char ** pp2)
        *pp1 = (unsigned char *)g1;
        *pp2 = (unsigned char *)g2;
    * Class:     TestCString
    * Method:    getStrings
    * Signature: ()[Ljava/lang/String;
    JNIEXPORT jobjectArray JNICALL Java_TestCString_getStrings(JNIEnv * env, jobject obj)
        unsigned char * p1;
        unsigned char * p2;
        jstring str1;
        jstring str2;
        jclass strCls;
        jobjectArray strArray;
        myCFunc(&p1, &p2); // call the c function
        str1 = env->NewStringUTF((const char *)p1); // create java string with first pointer
        str2 = env->NewStringUTF((const char *)p2); // create java string with second pointer
        strCls = env->FindClass("java/lang/String");
        strArray = env->NewObjectArray(2, strCls, NULL); // create java string array
        env->SetObjectArrayElement(strArray, 0, str1); // set first element
        env->SetObjectArrayElement(strArray, 1, str2); // set second element
        return strArray; // return java string array
    }Regards

  • Read request strings from application

    HI,
    Please help, I need write an app that connects to a URL, and then reads and sends request strings to and fro. What class must I use, and what event is fired when a request is received? This app is not a servlett, but is standalone. Also, I would like to use J2sdk, but if there are other API's, I will use them as well.
    Thanks

    hello

Maybe you are looking for

  • How to select text from a webpage

    hi. i have firefox for my n900. i would like to know how to select some text from a webpage so i can copy and paste it. thanks for the help. i couldn't it anywhere.

  • Change logs not working for manual update modify/delete statements.

    Hi experts,                  My requirement is to display the change logs for a few custom z tables.The log data changes is selected in technical settings of the table.When any changes are made to the table using sm30 the changes are logged. My requi

  • FILE - XI - RFC Problem

    Hi all!! I'm doing tests with my FILE -> XI -> RFC interface. The Status is Succesful, but the XI -> RFC mapping isn't done. Looking in SXMB_MONI in the Payload of Request Message Mapping I got:   <?xml version="1.0" encoding="UTF-8" ?> - <ns1:Z_F1FS

  • Oracle XE limited to less than 20 users?

    Hello, it is true that XE is optimized to work with a lower limit to 20 users? If this is true, if the parameter increased in 60 sessions, slow performance? XE need to configure it to allow users to connect to 60. Roberto Edited by: rober584812 on No

  • Setting in iTunes to indicate a song is a podcast

    This is a little technical, but I am guessing that the itunes library is where the information is kept that indicates that a song is a podcast. Is there any way to manipulate this so that if there are songs that we have downloaded we can then mark or