BufferedReader with both text and binary data

I'm reading ascii data from a socket using the read(char[] cbuf, int off, int len) method for a BufferedReader. This data contains a mixture of text to be parsed and data for an image. The messege is of variable length and the text fields are delimited by markers such as "FOO" or "BAR". I have initialized the BufferedReader in two seperate ways. First is: new BufferedReader(new InputStreamReader(iplCommSocket.getInputStream()));
The second is : new BufferedReader(new InputStreamReader(iplCommSocket.getInputStream(),"8859_1"));
If I use the first, I don't think I am getting the data correctly, if I use the second, the string ( creating a new String(char[]) )I get back from the read operation has the text after the binary data clobbered. I've tried converting the char[] to a byte[] and then creating a new String with the byte array using the "8859_1" character encoding to no avail. Any help is greatly appreciated

Is there a reason that you are using BufferedReader? 'cause, if I were you I wouldn't. It's geared toward text data, not binary data. I would look into some flavor of InputStream or possibly a FileChannel with some clever way to use the ByteBuffer.
Good Luck
Lee

Similar Messages

  • How to read a file with both text and binary data?

    For text data I use a BufferedReader,
    for binary data I use a DataInputStream.
    Since readLine is deprecated in DataInputStream, how can I read in a proper way a file that contains some lines of text followed by some binary data.
    Is there a way to do this without writing a new 'readLine' for DataInputStream (that has to take into account the different newlines for Unix en other OS's)?

    sorry about that ^
    NEW STRING str
    WHILE there is stuff in the file DO
        getByte()
        IF reading a string THEN
            WHILE byte is not a return character DO
                convert the byte to character/string
                append char to str
            WEND
        ELSE IF reading raw data THEN
            parse raw data
            do stuff with it
        END IF
    WEND

  • Fax / E-mail text and binary data

    Hi all,
    We have an existing Forte application which sends Fax / E-mail delivery
    confirmation to users.
    We have a new requirement to include a binary signature image in the
    delivery confimation.
    The existing code package the data as Textdata.
    A sample of the code is greatly appreciated.
    Thank you and have a great day.
    Wedad Zabanah
    Purolator Courier Limited
    Mississauga, Ontario
    Canada

    Is there a reason that you are using BufferedReader? 'cause, if I were you I wouldn't. It's geared toward text data, not binary data. I would look into some flavor of InputStream or possibly a FileChannel with some clever way to use the ByteBuffer.
    Good Luck
    Lee

  • Pie chart with both text and value

    Hi,
    I want the pie chart to contain both the text and value how is this possible when I look at the optiond for chart I was able to select only one thing at a time both not both the things at a time ,please let me know how is this possible
    Thanks
    Priya

    Hi Priya,
    this should be possible. In the Chart Designer in the properties of the Categories you must edit the Format string to e.g. "$Label$br0.00" (show the label, make a line break, show the value with 2 decimals). For more info regarding the format string see note <a href="http://service.sap.com/sap/support/notes/1064448">1064448</a>.
    Best regards
    Matthias

  • Format cell that contains both text and a date in Numbers

    I have this formula in a cell in Numbers
    =("Balance for " & YEAR(NOW()) & "-" & MONTH(NOW())-1)
    Since it is May 2012 that results in "Balance for 2012-4". How can I have it show as "Balance for 2012-04"?

    Just replace the month portion with something like this
    Right("0"&amp;month(today()),2)
    Takes the month number and combines it with a zero to the left, then takes the right two characters.
    Jason

  • Lightroom 4 crashes when trying to open the slideshow module. I spent over three hours with both Adobe and Apple tech support and we know it is a permission issue but have not been able to get it solved.  It started with the last upgrade to 10.8

    Lightroom 4 crashes when trying to open the slideshow module. I spent over three hours with both Adobe and Apple tech support and we know it is a permission issue but have not been able to get it solved.  It started with the last upgrade to 10.8

    Back up all data.
    This procedure will unlock all your user files (not system files) and reset their ownership and access-control lists to the default. If you've set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it.
    Step 1
    If you have more than one user account, and the one in question is not an administrator account, then temporarily promote it to administrator status in the Users & Groups preference pane. To do that, unlock the preference pane using the credentials of an administrator, check the box marked Allow user to administer this computer, then reboot. You can demote the problem account back to standard status when this step has been completed.
    Triple-click the following line to select it. Copy the selected text to the Clipboard (command-C):
    { sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; sudo chown -Rh $UID:staff ~ $_ ; sudo chmod -R u+rwX ~ $_ ; chmod -R -N ~ $_ ; } 2> /dev/null
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V). You'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning not to screw up. If you don’t have a login password, you’ll need to set one before you can run the command. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    The command will take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear, then quit Terminal.
    Step 2 (optional)
    The first step should give you usable permissions in your home folder. This step will restore special attributes set by OS X on some user folders to protect them from unintended deletion or renaming. You can skip this step if you don't consider that protection to be necessary.
    Boot into Recovery by holding down the key combination command-R at startup. Release the keys when you see a gray screen with a spinning dial.
    When the OS X Utilities screen appears, select
    Utilities ▹ Terminal
    from the menu bar. A Terminal window will open.
    In the Terminal window, type this:
    resetpassword
    That's one word, all lower case, with no spaces. Then press return. A Reset Password window will open. You’re not  going to reset a password.
    Select your boot volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button.
    Select
     ▹ Restart
    from the menu bar.

  • Is it possible to do a GLOBAL color change for both text and graphics in ACrobat XI?

    I used to do this using the Pitstop Pro plugin but now Pitstop is almost $900 and this is the only thing that I would use it for, not worth the investment
    I can change text color by selecting individual text items, but I want to change all of the red text into white text
    I also need to change all of the red graphics into white graphics and I can't figure out how to do that either
    I have a trial version of XI on a Mac and will buy it if it can do what I am trying to do, i.e. global color changes to both text and graphics
    thanks!!

    I have version 6, but it is way out of date, doesn't work on my current system, I downloaded a trial version of the new one, version 12 I think, now I have to decide if I can afford to buy it, it is not cheap!
    oops, sorry, I didn't read your entire message, aargh!
    I'll check with them if I can upgrade from this early version, thanks for the suggestion!
    (edited because I didn't read properly!)

  • How to print  both normal and bold data in a single line

    Hi ,
    I have requirement wherin the data need to be displayed in a single line.
    FAX:              Z8525_text.
    where FAX needs to be in bold and Z8525_text is a standard text and it shoould not be bold , both of this needs to be displayed in
    a single line.
    Can you let me know how to print  both normal and bold data in a single line one of which is coming fro standard text.
    Regards,
    Senthil

    Hi Senthil,
    If you are using smartforms, have a character format created for BOLD and apply it to the text you want to highlight. The remaining text of the line could be applied with a Character format which is not highlighted.
    Try and revert in case you need further assistance

  • Sending emails with both body and attachment to multiple recipients

    I have a requirement to send email with body and attachment to multiple recipients.
    Body of the email is a standard text. It is a proxy-to-mail scenario.
    Here is what I've done: (I'm using PI 7.11)
    One mapping from Source to Target structure (format of the attachment text file)
    Second mapping from Target Structure to Mail Package format.
    In the second mapping I'm concatenating the output of first step into "Content" of the Mail Package.
    "XIPAYLOAD" is the message protocol used.
    The "Keep attachments" option in the Mail adapter allows only to send "Content" as attachment or as body of the email.
    How to send an email with both content and text?
    The other problem is even with using ASMA, I can't send email to multiple recipients. I can only do CC and TO for 1 person each - a total of 2. Although I can resolve this by creating mailing lists, it is better if this can be addressed in PI.
    Thanks for any input you can provide!
    Edited by: crazylad on Jan 18, 2012 3:39 PM

    Thank you for your response Mikael.
    For the first question, I was able to find the solution in the following blog:
    XI Mail Adapter : Dynamically building attachment and message body content using a simple UDF
    (I just needed to search with the right set of key words )
    The key is to set the "Content Encoding" as "None" in the mail adapter. If this is not done, the mail will be sent with an attachment - untitled.bin containing both the mail body and the attachment text. Also, don't forget to check the "Keep Attachments" checkbox in the mail adapter.
    Multiple recipients could be added by separating the email IDs with a Comma. I have used ASMA to set the recipients.

  • How to change both start and end dates for an business event (or any object

    Hi all.
    We are in the case to change the validity dates for several business events in training management.
    The special point is that both, start and end date, have to be changed.
    In example, business event 00000001 is valid from 2010.01.01 to 2010.01.31 and shoud be "moved" from 2010.05.01 to 2010.05.31.
    So if i run RHBEGDA0 report to change start date first, it doesn't work propperly because new start date is bigger than old enddate.
    Next thing we thought is to change end date first, using RHGRENZ1, and then change the start date, with the report RHBEGDA0. Problem with this solution is that a business event duration shoud be calculated taking care of free days (weekends and day ofs).
    Is there any better solution for this?
    Thanks in advance for your help.
    Best regards.

    Hi,
    I gueass the best solution is to use PV1A t-code.
    You can write an LSMW for this t-code if the number of business events to be maintained is huge.
    Regards,
    Dilek

  • How do  create a slide show with both video and photos in elements 12

    how do  create a slide show with both video and photos in elements 12

    Hi Brian
    You can batch process a set of prepared slides from Full Edit (see image) using:
    File >> Process Multiple Files
    In the PMF dialog you can choose filename, date, or description (caption)
    Make sure you choose a separate destination folder to your source folder so as tot to permanently overwrite your originals.
    Click image to view

  • Extractor 0HR_PA_OS_1 as both masterdata and transaction data in same load?

    We use the 0HR_PA_OS_1 as an extractor for both masterdata and transaction data.  To reduce the loadingtime  I would like to know if we can populate both the info.object and the Info cube from the same load. Technical it should be no problem, but the infoobject 0HRPOSITION is masterdata in the Info cube using the same extractor, and masterdata should alsways be loaded before transaction data.
    Any advice?
    Tom

    We have daily load process chains to load HR data. And we have following sequence
    Attribute Data Load -> Text Data Load -> Attribute change Run -> Transaction Data Load.
    0HR_PA_OS_1 (for 0HRPOSITION) gets loaded in attribute load local PC, and in Transaction Data Load PC we have DTP that loads from PSA to cube 0PAOS_C01.
    Yes, masterdata should always be loaded before transaction data, this is because of SIDs generation and also if u r using 'Read master Data' in any of transactional transformation mapping, then this 'Read master Data' should happen after master data (0HRPOSITION) is active (after Attribute change Run).

  • Error message "SiteFile.getCRC called with no text or binary content" when trying to publish site to Business Catalyst

    I'm trying to publish my site to business catalyst, but keep getting a pop-up message and muse shuts down. The error message says "SiteFile.getCRC called with no text or binary content".
    No issues before, but I made a few font changes and now I won't upload. I've updated Air and uninstalled/reinstalled Muse. Not sure what the issue or where to start.
    Thanks for the help!

    Could you please share your .muse file with us to investigate? Please email it to [email protected] If your file is greater than 20MB you can use something like Adobe SendNow or SendThisFile or Dropbox. Please do not forget to mention the link to this forum thread in your e-mail so that we can identify the file.

  • Issues with both iChat and AIM

    Recently I have been having issues with both iChat and AIM. I was hoping someone here could shed some light on what the problem may be.
    AIM allows me to log-in and chat with people. However, if I close an IM window or Buddy Info window, the AIM program will quit and the "Unexpectedly Quit" notice will pop up.
    In regards to iChat, I did a clean install of iChat using the Tiger install disk. However, when I launch iChat and go through the initial setup it freezes up and I get the spinning rainbow and have no choice but to do a force quit.
    Any ideas as to what the problem may be?

    Hi
    Seeing you re-installed iChat you will need to run the 10.4.10combo http://www.apple.com/downloads/macosx/apple/macosx_updates/macosx10410comboupdat eppc.html to bring iChat back upto date.
    Tony

  • Please help to get onhand stock report with last purchase and billed date warehouse and item wise

    please help to get onhand stock report with last purchase and billed date warehouse and item wise

    Hi Rajeesh Ambadi...
    Try This
    SELECT distinct T0.ITEMCODE , t1.ItemName, T0.ONHAND as 'Total Qty',  
      T1.LASTPURDAT ,t1.LastPurPrc
    FROM OITW T0 INNER JOIN OITM T1 ON T0.ITEMCODE = T1.ITEMCODE
    INNER JOIN OITB T2 ON T1.ITMSGRPCOD=T2.ITMSGRPCOD left join ibt1 t3 on t3.itemcode = t0.itemcode and t3.whscode = t0.whscode
    WHERE
    T0.ONHAND>0
    AND T0.WhsCode ='[%0]'
    Hope Helpful
    Regards
    Kennedy

Maybe you are looking for

  • Default for baseline date  in Payment terms

    Hi All, Can anyone please explain me the options in OBB8 default for base line date 1. No Default 2. Posting Date 3. Document date 4. Entry Date while creating payment terms with examples. It's very very very Urgent!!!!!!!!!!!! Thanks in advance. Bop

  • Ipod Mini won't restore... folder with exclamation point

    A few weeks back my mini suddenly stopped working and showed a folder with an exclamation point. I have tried everything suggested on this site, 5 R's, re-formatting through Windows etc and the closest I can get to restoring is going into disk mode a

  • Bridging Two Networks

    My mac (G5 running 10.4.11) is connected through ethernet to a router-powered small network. I'd like to be able to connect a PC (running XP64), using ethernet, to the 2nd ethernet port on the Mac. I would like this PC to be able to access all of the

  • Tiles problem

    Hi I'm new to struts and I have some problem with struts. I have tiles.jsp: <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> <tiles:insert page="/tiles/karta.jsp" flush="true"> <tiles:put name="title" type="string" value="karta" /> <tiles

  • Scripting in Numbers

    Does numbers support scripting? likewise what level of scripting is available in Keynote pages If not does anyone think that a lot of the things that people are saying is missing could appear when leopard is launched ( and iwork service update perhap