Read binary and ascii values from input stream

Hi All
I want to read a stream that consist both binary values and ascii values. Length of the stream cannot anticipate. Can you help me?
Thanks

Sameera wrote:
Hi All
I want to read a stream that consist both binary values and ascii values. Length of the stream cannot anticipate. Can you help me?
ThanksHave a look at this:
Character and Byte Streams
http://java.sun.com/docs/books/tutorial/i18n/text/stream.html

Similar Messages

  • How to read binary floating point values from TCP/IP

    I am attempting to use a LabView application to read an array of binary single precision floating point numbers transferred through a TCP/IP connection from a Windows C++ program. The endianization occurs before the values are sent to the Labview application. When I read the values in LabView, some values are interpreted correctly, some are not. For instance, the C program is sending a 6 as one element, and 7 as another. Labview interprets both as 6. The difference between 6 and 7 in binary format is 1 bit (bit #21 if counting from 0 in LabView format). There are 2 other values that show the same error- 459.67 is being sent, 395.67 is read by labview (1 bit difference, exact same bit... 7.5 is being sent, 6.5 is being read by LabView (1 bit difference, exact same bit). LabView reads that bit as 0, when it should be 1.
    This seems very odd to me because most values are being read correctly, including other values with that same bit on. There are values being read correctly that are both before and after the incorrect values in the array, so it's not just an issue with an offset or something in the bit stream. Additionally, when attempting to read an array of values with all bits on, I get a strange pattern of 111110011111100111111001111110.
    We have also verified that the binary representation for the values is the same on both machines, once you account for the byte swapping. What am I missing here? How in the world can some values come across correctly and others incorrectly? Any help would be greatly appreciated! Our fallback is to transfer everything in ASCII, which is going to greatly increase packet sizes.
    Thanks,
    Jason

    Update:
    Problem fixed. I say fixed and not solved because I don't know why it's fixed. I had been storing the TCP/IP read in a string and passing it through a shift register after each read. I would then concatenate it with the TCP/IP read result in the next loop. After each read, it would search the concatenated string for ASCII flags. When it found them, it would strip off the flags and then type cast the rest as single precision floating points.
    I knew I would be getting the same number of bytes each time, so I ditched the ASCII flags and had just the binary values sent. This way, I expect to get all of the values in one TCP/IP read. No values are passed through a shift register to the next loop and there is no concatenation of the string outputs from TCP/IP read.
    I'm not sure if it was the ASCII flags being included or something with the way I was manipulating the string that was causing the binary values to be interpreted incorrectly. Hope this helps someone else.
    Jason

  • Reading one and one value from either excel or text file

    Hello
    We are some students working on a schoolproject where we want to control some motor outputs. We want to create a set of input-values that are being red into our program either excel or text file.
    For example we want a input to read value "1" then the program runs its course and we get a result of the input "1", after that read the next value "2" and the program runs its course and so on.
    We have searched for clues and answeres, but i guess were really bad at that. Anyone here that could help us out?
    Under you can see one of our programs, its designed to control 3 fans depending on the input (CO ppm). We want to replace the "Numeric Controller" (CO ppm) into "something else" that gives us one and one input from a list of values.
    Kindly regards
    Weary students
    Solved!
    Go to Solution.

    Hi Guys!
    Nice to see that you are using this for your school project! Below I included two Knowledge bases with the information that you need. You can learn from it and try to see if you can read something and display it, to start with. Then try looking for specific data. 
    http://digital.ni.com/public.nsf/allkb/E02847A93FD79F7486256E050070E85B?OpenDocument 
    http://digital.ni.com/public.nsf/allkb/99F61B6AB9CD6AFA8625734600814D6B?OpenDocument 
    Please let me know how this works out for you. 
    Collin de Wit
    National Instruments
    Applications Engineering

  • Reading data from input stream on unix

    I have a program that reads data from input stream from the socket. If the data is over 1500 bytes it is sent in multiple TCP packets. Whats weird is, if I run the program in windows environment it waits till it receives all the packets but when I run the same program in unix environment it only reads the first packet and go further without waiting for all the TCP packets!!
    The line that reads from input stream is
    datalen = inStr.read(byteBuffer);is there anyway I can make it wait till it receives all the packets on unix system? I do not understand why it works fine for windows in this case but not for unix.
    I'll appreciate any help..
    Thanks

    Try using a DataInputStream with the readfully() method.

  • How do I access and delete photos from Photo Stream

    I am using Yosemite 10.10.3.  Apple TV (3rd gen) screen saver shows older photos that I have deleted from the photos program but are apparently still in Photo Stream.  How do I access and delete these from Photo Stream?
    Thanks

    Hello winim64,
    After reviewing your post, it sounds like you want to delete photos from My Photo Stream. I would recommend that you read this article, it may be able to help the issue.
    Delete photos from My Photo Stream - Apple Support
    Thanks for using Apple Support Communities.
    Have a nice day,
    Mario

  • Recording measured voltage and current values from LCR 4284A

    Hello,
    I want to use the labview VI to record the measured voltage and current values from LCR 4284A. These are shown as Vm and Im on the instrument screen. Is it possible to record these values using a VI?
    I have looked through the drivers that are available through the "Instrument driver network" (Link) for 4284A but none of the VIs give any option to monitor Vm and Im. If you know how this can be done then I would really appreciate a reply.
    Thanks
    Mansoor

    I haven't used the instrument but there are functions to enable/read voltage level and current level monitors. Are those different than what you are asking for? What does the manual say about Vm and Im and programatically getting them? If you can find the command in the manual, you can just open the VI Tree and do a text search for the command.

  • From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    Hi,
    Use NVL or COALESCE:
    NVL (col_a, col_b)
    Returns col_a if col_a is not NULL; otherwise, it returns col_b.
    Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
    For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • How can we read the screen field values from the report selection screen wi

    Hi expart,
    How can we read the screen field values from the report selection screen with out having an ENTER button pressed  .
    Regards
    Razz

    use this code...
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_posnr.
    **Read the Values of the SCREEN FIELDs
    CALL FUNCTION 'DYNP_VALUES_READ'

  • How do I set up my Mac mini to read iTunes and iPhoto files from my new Mac mini server?

    Want my old Mac mini to read iPhoto and iTunes files from my new Mac mini server.  Old Mac has no more room to store files.  How do I do this?

    Hello,
    Have you tried enabling iTunes Sharing & iPhoto Sharing on the Server?
    Or maybe...
    http://support.apple.com/kb/ht1449
    http://www.apple.com/itunes/inside-itunes/2011/02/how-to-move-your-itunes-librar y-to-another-hard-drive.html
    http://support.apple.com/kb/PH2506
    http://support.apple.com/kb/ht1229

  • How can i remove a key and its value from properties file

    hi all,
    i want remove a particular key and associated value from the
    properties file. is their any standard way of doing?
    thanks inadvance
    daya

    hi,
    thanks
    i am able to remove the key,
    one more question how can avoid storing date and time
    in properties file.
    thanks
    daya

  • Read parked and posting document from one FM

    Hi all,
    IS theere any FM avaliable to read parked and posting document from one function module.
    Please let me know if anything is there.
    Thanks

    Hi T,
    have u searched in SE37 with words park?,i'm sure we have few FMs which will do the same.
    regards
    Prabhu

  • Min and Max values from entire table

     Hi,
     i have requirement in which i need to find the min and max values from the entire table.
    See the sample data 
    create table test
    Sal1 int,
    Sal2 int,
    Sal3 int
    insert into test values (100,700,5700)
    insert into test values (200,3300,5300)
    insert into test values (4400,1200,3500)
    insert into test values (5400,5600,3100)
    i want the output as 100 and 5700.. how can i achieve this in a single query. Please through some light on this topic..!
    Thanking you in advance
    Regards,
    Balaji Prasad B
    Balaji - BI Developer

    Below is an example with a subquery for each of the queries Mohammad posted in order to return both min and max in a single result set.
    SELECT ( SELECT MAX(Maxx) AS Maxx
    FROM test UNPIVOT
    ( Maxx FOR E IN ( Sal1, Sal2, Sal3 ) ) AS unpvt
    ) AS Maxx
    , ( SELECT MIN(Minn) Minn
    FROM test UNPIVOT
    ( Minn FOR E IN ( Sal1, Sal2, Sal3 ) ) AS unpvt
    ) AS Minxx;
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

  • How to add anchor tag dynamically on infopath (OOTB task form of workflow .xsn) by jquery -dynamically as i did by below script on newform.aspx where I will read Help title and URL value from list

    on newform.aspx just above the top of cancel button I want to put 1 hyperlink "Help"
    but I want to do this by script/jquery by reading my configuration list where 1 column is TITLE and other is- URL
    Configuration List has 2 columns Title and URLValue
    Title                                    UrlValue
    HelpNewPage                    
    http://url1
    HelpEditPage                      http://url2
    so script should read Title and display "Help"--->1st part on NewForm.aspx/EditForm
    Script should read UrlValue column and on click of help-(display link) the respective url should be open in new window.-->second part
    Please let me know reference code for adding anchor tag dynamically by reading from list
    Help/Reference 
    http://www.sharepointhillbilly.com/Lists/Posts/Post.aspx?ID=5
    I can see hyperlink near cancel button-
    //This block is just placing help link near cancel button- 
    $(document).ready(function() {
        GetHelpLinkFromConfigList();
    var HelpLinkhtml ='<a href="#" text="Help">Help</a>';
    var position =$("input[value='Cancel']").parent("td").addClass('ms-separator').append(HelpLinkhtml);
    var HelpLinkhtml ='<a href="#" text="Help" onclick="GetHelpLinkFromConfigList();">Help</a>'; 
    var position =$("input[value='Cancel']").parent("td").addClass('ms-separator').append(HelpLinkhtml);
    var HelpLinkimageButton ='<IMG SRC="../../Style Library/Help.bmp" style="width:35px;"/>'; 
    var position1 =$("input[value='Cancel']").parent("td").addClass('ms-separator').append(HelpLinkimageButton );
    //Rest script
    function GetHelpLinkFromConfigList()
     //The Web Service method we are calling, to read list items we use 'GetListItems'
     var method = "GetListItems";
     //The display name of the list we are reading data from
     var list = "configurationList";
     //We need to identify the fields we want to return. In this instance, we want the Title,Value fields
     //from the Configuration List. You can see here that we are using the internal field names.
     var fieldsToRead = "<ViewFields>"+"<FieldRef Name='Title' />"+"<FieldRef Name='Value' />"+"</ViewFields>";
     //comment
     var query = "<Query>" +
                            "<Where>" +
                                "<Neq>" +
                                    "<FieldRef Name='Title'/><Value Type='Text'>Help</Value>"
    +
                                "</Neq>" +
                            "</Where>" +
                            "<OrderBy>" +
                                "<FieldRef Name='Title'/>" +
                            "</OrderBy>" +
                        "</Query>";
     $().SPServices(
     operation: method,
        async: false,
        listName: list,
        CAMLViewFields: fieldsToRead,
        CAMLQuery: query,
        completefunc: function (xData, Status) {
        $(xData.responseXML).SPFilterNode("z:row").each(function() {
        var displayname = ($(this).attr("ows_Title"));
        var UrlValue = ($(this).attr("ows_Value")).split(",")[0];
        AddRowToSharepointTable(displayname,UrlValue)
    function AddRowToSharepointTable(displayname,UrlValue)
        $("#NDRTable").append("<tr align='Middle'>" +
                                    "<td><a href='" +UrlValue+ "'>+displayname+</a></td>"
    +
                                   "</tr>");
    <table id="NDRTable"></table>
    sudhanshu sharma Do good and cast it into river :)

    Hi,
    From your description, you want to add a help link(read data from other list) into new form page.
    The following code for your reference:
    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    ExecuteOrDelayUntilScriptLoaded(AddHelpLink, "sp.js");
    function AddHelpLink() {
    var context = new SP.ClientContext.get_current();
    var list= context.get_web().get_lists().getByTitle("configurationList");
    var camlQuery= new SP.CamlQuery();
    camlQuery.set_viewXml("<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>Help</Value></Eq></Where></Query></View>");
    this.listItems = list.getItems(camlQuery);
    context.load(this.listItems,'Include(Title,URL)');
    context.executeQueryAsync(function(){
    var ListEnumerator = listItems.getEnumerator();
    while(ListEnumerator.moveNext())
    var currentItem = ListEnumerator.get_current();
    var title=currentItem.get_item("Title");
    var url=currentItem.get_item("URL").get_url();
    var HelpLinkhtml ='<a href="'+url+'">'+title+'</a>';
    $("input[value='Cancel']").parent("td").addClass('ms-separator').append(HelpLinkhtml);
    },function(sender,args){
    alert(args.get_message());
    </script>
    Result:
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Get value from input text in read only adf table

    all,
    i added a column to an adf read-only table and inserted an input text control in the extra column. how do i loop through the table to get the value from the input field?
    paul

    Hi,
    can you be more clear on the usecase? Its a read only table that you added a input text field in a new column. What is the column based on and what is the goal of looping through ?
    Frank

  • Reading an image from input stream

    Hello all,
    I'm familiar with setting up an input stream but I have never actually done it. I'm making a connection to a URL (a JPG image). I would like to read the JPG from the URL using an input stream. With the URL class I was able to open a stream, however, I'm not exactly sure how to read from it.
    I'm aware of the read() method and read(byte[]) methods of inputstream. But how do I actually implement it?
    If I use read(), then bytes come in individually... do I need to combine them at one point? If I read the bytes into an array, how do I determine what size to set the array and how do I convert the byte array into an Image or ImageIcon?
    Please advise.
    R. Alcazar

    Hi,
    See http://java.sun.com/products/jdk/1.2/docs/guide/2d/api-jpeg/
    and especially JPEGCodec.createJPEGDecoder(java.io.InputStream).
    Anyway, you might not want to do it with InputStream. Instead you could try something like this:
    URLConnection con = // get it somehow
    Image i = (Image) con.getContent(new Class[] {Image.class});
    However, If you still want to use the InputStream, here you go with some pseudo code:
    InputStream in = // get the input stream with JPEG data...
    JPEGImageDecoder dec = JPEGCodec.createJPEGDecoder(in);
    Image i = dec.decodeAsBufferedImage();
    You can get the InputStream from the URLConnection with getInputStream(). However, I don't remember if the InputStream contained also the HTTP (or what ever protocol the URL specifies) headers. If it contains the headers, then you must rip them of before giving the InputStream to the JPEGCodec...
    If this is the case, try calling the URLConnection.getHeaderFields() method before getInputStream. This might not work though.

Maybe you are looking for