Conversion into Binary Octet String

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • itgaurav198
    New Member
    • Oct 2007
    • 41

    Conversion into Binary Octet String

    Hi,

    Is it possible to convert a string in "Binary Octet String".?Also, if possible, please make clear what "Binary Octet String" is.

    Thanks
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by itgaurav198
    Hi,

    Is it possible to convert a string in "Binary Octet String".?Also, if possible, please make clear what "Binary Octet String" is.

    Thanks
    An 'octet' is a group of eight bits; we used to call that a 'byte' but bytes can
    contain more than eight bits. An octet can contain 256 different values and we
    usually interpret those values as numbers in the range [0,255] or [-128,127];

    There are a few methods available that can convert those octet values to their
    binary representation which is a String.

    kind regards,

    Jos

    Comment

    • itgaurav198
      New Member
      • Oct 2007
      • 41

      #3
      Originally posted by JosAH
      An 'octet' is a group of eight bits; we used to call that a 'byte' but bytes can
      contain more than eight bits. An octet can contain 256 different values and we
      usually interpret those values as numbers in the range [0,255] or [-128,127];

      There are a few methods available that can convert those octet values to their
      binary representation which is a String.

      kind regards,

      Jos
      Hi,

      Thanks for your quick reply.

      As you have written that there are few methods to convert octet values into binary that are strings. But I have to convert a string into Octet. So do you mean that first i have to convert it into binart then into octet. If I am right how can i implement it in java.

      Thanks

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by itgaurav198
        Hi,

        Thanks for your quick reply.

        As you have written that there are few methods to convert octet values into binary that are strings. But I have to convert a string into Octet. So do you mean that first i have to convert it into binart then into octet. If I am right how can i implement it in java.

        Thanks
        You've got it the wrong way around: an octet can contain 256 different values;
        it's us humans that want to represent those numbers in writing (Strings). There
        are a lot of representations for numbers and a binary representation is one of
        them. So representations are always Strings. You can convert numbers (stored
        in octets) to their String representation and vice versa.

        Read the API documentation for the following classes: Byte, Integer, and String.

        kind regards,

        Jos

        Comment

        • itgaurav198
          New Member
          • Oct 2007
          • 41

          #5
          Originally posted by JosAH
          You've got it the wrong way around: an octet can contain 256 different values;
          it's us humans that want to represent those numbers in writing (Strings). There
          are a lot of representations for numbers and a binary representation is one of
          them. So representations are always Strings. You can convert numbers (stored
          in octets) to their String representation and vice versa.

          Read the API documentation for the following classes: Byte, Integer, and String.

          kind regards,

          Jos
          Hi,
          Actually I am working on IBM Tivoli Identity Manager and I have to store the value of password in an attribuet that is of type Binary Octet String and I am entering the value in String. Thats why I have to convert it. Is there any other way to do this.

          Thaks

          Comment

          • JosAH
            Recognized Expert MVP
            • Mar 2007
            • 11453

            #6
            Originally posted by itgaurav198
            Hi,
            Actually I am working on IBM Tivoli Identity Manager and I have to store the value of password in an attribuet that is of type Binary Octet String and I am entering the value in String. Thats why I have to convert it. Is there any other way to do this.

            Thaks
            Ah, I think I'm beginning to understand what you want. Read the API documentation
            for the String class and pay special attention to the getBytes() method.

            kind regards,

            Jos

            Comment

            • mathewhai
              New Member
              • Feb 2008
              • 1

              #7
              Not sure on how to set the Octet String value to the server. if you want to manipulate an Octet String value from Directory Server, java providers one option like env.put("java.n aming.ldap.attr ibutes.binary", "mpegVideo mySpecialKey");
              So the Octet String value will be retrieved as binary, we can store it in a byte array and do thye things. may be some similar reverse mechanism will be there for storing the values.

              Comment

              Working...