Hii

System.out.println("THIS IS FIRST DECODER");
        out.setAutoExpand(true);
        Listener l = (Listener)is.getAttribute("listener");
        byte[] bytes = new byte[ib.limit()];
        ib.get(bytes);
        if(l.getMessageType().equals("HL7"))
        {
            String s = new String(bytes);
            String hexString = toHexString(bytes);
            if(hexString.trim().startsWith("0B"))
            {
                if(str.equals(""))
                {
                    System.out.println("START");
                    str=s;
                }else{
                    System.out.println("THERE IS BAD MESSAGE");
                    str=s;
                }
            }else if(!hexString.trim().startsWith("0B")){
                if(str.equals(""))
                {
                    System.out.println("OTHER THAN HL7");
                    out.put(bytes);
                    out.flip();
                    pdo.write(out);
                    return false;
                }else{
                    System.out.println("MIDDLE");
                    str = str + s;
                }
            }
            if(hexString.trim().endsWith("0D")){
                if(!str.equals(""))
                {
                    System.out.println("END");
                    pdo.write(str);
                    str="";
                    return false;
                }
            }
   return true;//or false
        }

This is the code for my first decoder. If it is other than HL7 then I am forwarding IoBuffer than protocol2 is executed
 my question is what is indicate by return type of doDocode

In This example if return true or false it has same behavior

Reply via email to