How to enbed message length in message

Hello,
I pretty new with have java, so be easy on me...
I am trying to send a socket message to a client. The message is in the form of <stx>LLMMMMMMMM<etx>.
The 'LL' (16 bits) is the actual length of the message. For example if the message length was 10, LL would be the integer value of 10 (hex 000A). Does that make sense?
In C I would do something like:
sprintf(message, "<stx>%dMMMMMMMM<etx>", length);
This would stick the integer value of length in the string, but I am not sure how to do it in Java...
Regards,
-Jeff

Actually I tried that first, but that is not quite right. If I do that I get,
<stx>10<etx> which is not what they want.
They want the binary or ascii value of that with a leading 0, so it would be something like 00 in the 1st character and 10 in the 2nd character... So it would be (null)(lf) where (lf) is the line-feed character...
I hope that explains it better...
Why they do their message this way, I have no idea! That's the banking industry for you...

Similar Messages

  • How to make the length of Message Dialog follows the length of text

    Hi all.
    I am making a Message Dialog From JOptionPane because i do not want to use some static methods of JOptionPane (JOptionPane.Show ...)
    My source codes following :
    public static void showMessageDialog(String message) {
              JOptionPane optionPane = new JOptionPane();
              JDialog dialog = optionPane.createDialog(null, "Message");
              optionPane.setMessage(message);
              optionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
              JButton btnOk = new JButton("OK");
              optionPane.setOptions(new Object[] { btnOk });
              dialog.setVisible(true);
    }It runs well but having a problem. When message is a long text --> JDialog can not show all text, dialog's length does not resize automatically following message's length.
    Have a the way to make it ? How to solve ?
    Thanks in advance !
    Diego
    Edited by: ThuCT on Feb 1, 2010 3:28 AM

    Add a dialog.pack() call. See SSCCE below.
    i do not want to use some static methods of JOptionPane (JOptionPane.Show ...)Why? In this case the built-in static method handles the size as expected.
    public class TestJOptionPaneSizeAdaptsToMessageLength {
       public static void main(String... args) {
           String message = "This is a very long message, I say long but really it is a very very long one, and when I say long I do mean it!!! ";
           message += message;
           message += message;
           message += message;
           showMessageDialog(message);
    //       showMessageDialogUsingStaticJOptionPaneMethod(message);
       public static void showMessageDialog(String message) {
            JOptionPane optionPane = new JOptionPane();
            JDialog dialog = optionPane.createDialog(null, "Message");
            optionPane.setMessage(message);
            optionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
            JButton btnOk = new JButton("OK");
            optionPane.setOptions(new Object[] { btnOk });
            dialog.pack();
            dialog.setVisible(true);
       public static void showMessageDialogUsingStaticJOptionPaneMethod(String message) {
            JOptionPane.showMessageDialog(null, message);
    }Edited by: jduprez on Feb 1, 2010 11:39 AM
    I have to admit, I am a zealous fan of the built-in JOptionPane.showXxx methods :o)

  • How to increase the length of message in status bar

    Hi all,
    I need to show an error message in the status bar of the ABAP editor when an error occurs in the program. But the error message is not fully getting displayed, it is getting truncated. Is there any way to increase the length of the message in the status bar.

    You can display upto 73 charcters ,if you need more than this then create one text element .
    here you can have 132 charcters.
    parameters p_matnr like mara-matnr.
    start-of-selection.
    message s999(z01) with text-005.
    Create message class with & & & & & & ( Message short text ).
    This way you can show maximum 132 charcters.
    Thanks
    Seshu

  • How to create the alterable length XML message in WLI workflow?

    When I do some development in WLI2.1 workflow, I meet a problem. I need a XML
    message to invoke this workflow, and then tailor this XML message and create a
    new XML message to send to a certain destination.
    Now the question is: The XML message is alterable length, like following:
    <ROOT>
    <tag1>
    <tag2>...</tag2>
    <tag3>...</tag3>
    </tag1>
    <tag1>
    <tag2>...</tag2>
    <tag3>...</tag3>
    </tag1>
    <tag1>
    <tag2>...</tag2>
    <tag3>...</tag3>
    </tag1>
    </ROOT>
    The number of <tag1> is alterable. But I don't know how to create the new XML
    message, which also includes the same structure of input XML message, in workflow
    "Post external XML Event" action?
    I try to use XPath to get the value of each tag, but when I use the following
    XPath expression:
    XPath ("/ROOT/tag1/tag2/text()")
    I can only get the reference of weblogic.apache.xpath.axes.LocPathIterator.
    And I also don't know how to define the XML document structure to implement this
    kind of alterable length XML message.
    Your comments are highly appreciated!

    You will need to use substr to restrict the length of the strings returned by extract(). I assume that either the document in non schema based or the attributes referenced are not defined with maxLength restriction in the XML Schema

  • How to increase the length of a message in message class

    Hi Friends,
    Is there any way to increase the length of a message in a message class as the maximum length is 72 chars.
    My requirement is I cannot use the Long text option.
    Thank You

    HI,
      We cannot change the message length in the message class
    but you can do one thing ,
    while giving the message in your msg class write till which you are allowed to and then you put '&'
    eg : this is message &
    now goto text elements and create a text element suppose T00
    and write the remaining text in that text element.
    and when you want to display the message do it like
    message i00(zmsg_class) with text-T00.
    it ll work.
    *****Reward if useful,
    Thanks & Regards,
    Sunny Suren .C.

  • How to display - Message Length more than 100 characters

    Hi,
    I am displaying a message string which gets generated dynamically. Which means I donno theolength of that. It may go upto 200 characters also.
    However, In message display, the number of characters have some limit.
    Could you please let me know, How can I achieve this?
    MESSAGE E000 with lv_string.
    Thanks,
    Sandeep

    Hi Srini,
    I have already 4 place holders. And one of the place holder will be populated dynamically which I mentioned above. And more than 4 place holders, it is not accepting.
    Could you please help me.
    Thanks,
    Sandeep

  • Message length in a message class

    hi all,
    I have  a error message to be displayed in report , its length exceeds 74 character.
    What is the way to increase the default length?
    or is there another way to display the error where length is greater

    HI
    You can Write Like ths
    MESSAGE E000(Z..) WITH text-001 text-002.
    And Also go through This Link
    How to increase the length of a message in message class
    Ranga

  • Want to change length validator message and change field format.

    I want to override Length Validator Message as I want to tell the user that phone number
    must contain 10 numbers
    I've added this validator on the phone field
    af:validateLength minimum="10" maximum="10"
                                   hintMinimum="11" hintMaximum="22"
                                   hintNotInRange="33" messageDetailMinimum="44"
                                   messageDetailMaximum="55"
                                   messageDetailNotInRange="66" id="lengthval"/>and this when I enter less than 10 numbers the error message tell that you must enter 10 characters
    I want to override this message to be "you must enter 10 numbers"
    And I want to make this number format like
    XXXX,XXX,XX
    How can I make this.

    Strictly speaking a number in this format is no number. It's a phone number and you should use a regular expression validator for this.
    Check http://docs.oracle.com/cd/E15051_01/apirefs.1111/e12419/tagdoc/af_validateRegExp.html for more info.
    Timo

  • I have one apple ID and multiple family members share this with their devices.  How do we keep pics and messages separate?

    I have one apple ID and multiple family members share this with their individual devices.  How do we keep pics and messages separate for each device?

    For messages
    MacMost Now 653: Setting Up Multiple iOS Devices For Messages and FaceTime
    For other issue:
    How to use multiple iPods, iPads, or iPhones with one computer
    What is the best way to manage multiple...: Apple Support Communities

  • When I update my nano ipod I get an error message "User ipod cannot be updated.  The disk couldnot be read from or written to."   How can I overcome this error message.

    In the iTunes window, when I update my nano ipod, I get an error message "User ipod cannot be updated.  The disk could not be read from or written to."   How can I overcome this error message.

    Hello there dilip77707,
    It sounds like you are getting this error message that your iPod cannot be read from or written to when you are trying to update your iPod Nano. I recommend the troubleshooting from the following article to help you get that resolved. Its pretty straight forward, just start at the top and work your way down as needed:
     'Disk cannot be read from or written to' when syncing iPod or 'Firmware update failure' error when updating or restoring iPod
    Thank you for using Apple Support Communities.
    All the very best,
    Sterling

  • How can i stop an error message that comes up when i am using word? the error message is "word is unable to save the Autorecover file in the location specified. Make sure that you have specified a valid location for Autoreover files in Preferences,-

    how can i stop an error message that comes up when i am using word? the error message is "word is unable to save the Autorecover file in the location specified. Make sure that you have specified a valid location for Autoreover files in Preferences,…"

    It sounds like if you open Preferences in Word there will be a place where you can specify where to store autorecover files. Right now it sounds like it's pointing to somewhere that doesn't exist.

  • How do I forward a text message with the iPhone?

    How do I forward a text message with the iPhone?

    You could take a screen shot (hold and release both buttons simultaneously) and then email the resulting image to someone.
    // crude workaround for now...

  • I have just switched to samsung and i have removed the sim from the iphone however i am still receiving texts rather 'imessage' on the old iphone. how do i make sure all messages only come to my new phone??

    i have just switched to samsung and i have removed the sim from the iphone however i am still receiving texts rather 'imessage' on the old iphone. how do i make sure all messages only come to my new phone??

    You can turn iMessage off on your iPhone.  That's relatively easy.  Since iMessage is an Apple product/service, I have no idea how a Samsung phone will deal with an incoming one.  For that answer you should probably contact Samsung support.

  • When i update to the latest version (7.0.3), there is a message appear to me when i open any application that contains notification such as (What'sApp or BBM),this message said (Connect to iTunes to use push Notification),How I can to stop these message?

    When i update to the latest version (7.0.3), there is a message appear to me when i open any application that contains notification such as (What'sApp or BBM) , this message said (Connect to iTunes to use push Notification) , How I can to stop these messages that appear to me constantly?

     Hi,
    One of my ex-colleagues has installed a NI-DAQ 6.5 in our system. [And I do not see any other naitional instruments card in the CPU of the computer, may be he removed it] I deleted the account and all his files in the system. When I am trying to install version8.0, its not getting installed and giving me a message that I should uninstall the previous version by going to Add/Remove programs in the control panel.
    I tried doing that, but the "Change/Remove" button does not seem to work...[There is no response and so unable to install the new version...]
    Any idea how can this problem be solved?
    It is a windowsXP operating system with SP2 installed on a machine with P4 processor.
    Thanks

  • When the message arrives, the message tone sound that many times. How this problem can be solved? I installed the new version, but the problem is not resolved, the future is to be taken into account in the new version of this?

    When the message arrives, the message tone sound that many times. How this problem can be solved? I installed the new version, but the problem is not resolved, the future is to be taken into account in the new version of this?

    I'm not sure I understand the question, is the message tone going more then once?
    Turn off repeat message alert here:
    settings > notifications > messages > repeat alert > never
    Some people have found this does not stop the repeat miessage tone,
    if you are one of those then I suggest you contact Apple:
    http://www.apple.com/feedback/iphone.html
    They may not respond, but hopefully will fix in uodate if enough people complain.

Maybe you are looking for

  • Need SAP Segment Change or Update for LSMW

    Our LSMW person is using a segment E1BPCHARACTDETAIL, in his LSMW Field Mapping. This segment is in an hierarchy that falls under E1CHARACTERISTIC_CREATE. Our LSMW person uses E1BPCHARACTDETAIL because he according to him it is the equivalent of BAPI

  • Please Help---Thank you very much!

    Does anyone know how to embed an application program on a website, thus the users can run this application(say excel) on the website. One of my friends told me that I could use java applet, but can anyone tell me more about that issue? Thank you very

  • Archive

    Hi all,          while i am configuring my source file adapter i set processing  mode as archive do we have to create separate folder for this archived files if yes how we have to create if not where this archived files sores..plz clear my doubts.. r

  • Installation Problems Photoshop 5.0 LE on Win 7

    hello, I recently tried to install5.0 LE (32 bit) on new Win 7 system (32 bit) -it was XP before-, but after installation (the license code was accepted) it could not be opened, it said "no reaction" and it did not load the open the program. It was s

  • Copying attacment and sending in a message it in format of .jpg

    I have tryed to copy an email I got from a a friend I have. This document had a '1.JPG" in it. I copied expanded from my computer email file, but it did not show up when I sent it with Skype, through the message box. So I copied it alone and the reci