Package com.dd.plist

Class NSString

    • Constructor Summary

      Constructors 
      Constructor Description
      NSString​(byte[] bytes, int startIndex, int endIndex, java.lang.String encoding)
      Creates a new NSString instance from its binary representation.
      NSString​(byte[] bytes, java.lang.String encoding)
      Creates a new NSString instance from its binary representation.
      NSString​(java.lang.String string)
      Creates a new NSString instance with the specified content.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void append​(NSString s)
      Appends a string to this string.
      void append​(java.lang.String s)
      Appends a string to this string.
      boolean boolValue()
      Gets the boolean value of this string.
      NSString clone()
      Creates and returns a deep copy of this instance.
      int compareTo​(NSObject o)  
      double doubleValue()
      Gets the floating-point value (double precision) of this string.
      boolean equals​(java.lang.Object obj)  
      (package private) static java.lang.String escapeStringForASCII​(java.lang.String s)
      Escapes a string for use in ASCII property lists.
      (package private) static java.lang.String escapeStringForXml​(java.lang.String s)  
      float floatValue()
      Gets the floating-point value of this string.
      java.lang.String getContent()
      Gets the string content of this instance.
      int hashCode()  
      int intValue()
      Gets the integer value of this string.
      void prepend​(NSString s)
      Prepends a string to this string.
      void prepend​(java.lang.String s)
      Prepends a string to this string.
      void setContent​(java.lang.String c)
      Sets the string content of this instance.
      protected void toASCII​(java.lang.StringBuilder ascii, int level)
      Generates the ASCII representation of this object.
      protected void toASCIIGnuStep​(java.lang.StringBuilder ascii, int level)
      Generates the ASCII representation of this object in the GnuStep format.
      void toBinary​(BinaryPropertyListWriter out)
      Generates the binary representation of the object.
      java.lang.Object toJavaObject()
      Converts this NSObject into an equivalent object of the Java Runtime Environment.
      java.lang.String toString()  
      (package private) void toXML​(java.lang.StringBuilder xml, int level)
      Generates the XML representation of the object (without XML headers or enclosing plist-tags).
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • asciiEncoder

        private static java.nio.charset.CharsetEncoder asciiEncoder
      • utf16beEncoder

        private static java.nio.charset.CharsetEncoder utf16beEncoder
      • utf8Encoder

        private static java.nio.charset.CharsetEncoder utf8Encoder
      • content

        private java.lang.String content
    • Constructor Detail

      • NSString

        public NSString​(byte[] bytes,
                        java.lang.String encoding)
                 throws java.io.UnsupportedEncodingException
        Creates a new NSString instance from its binary representation.
        Parameters:
        bytes - The binary representation.
        encoding - The string encoding (name of the charset).
        Throws:
        java.io.UnsupportedEncodingException - When the given encoding is not supported by the JRE.
        See Also:
        String(byte[], String)
      • NSString

        public NSString​(byte[] bytes,
                        int startIndex,
                        int endIndex,
                        java.lang.String encoding)
                 throws java.io.UnsupportedEncodingException
        Creates a new NSString instance from its binary representation.
        Parameters:
        bytes - An array containing the binary representation of the string.
        startIndex - The offset inside the array at which the string data starts.
        endIndex - The offset inside the array at which the string data ends.
        encoding - The string encoding (name of the charset).
        Throws:
        java.io.UnsupportedEncodingException - When the given encoding is not supported by the JRE.
        See Also:
        String(byte[], int, int, String)
      • NSString

        public NSString​(java.lang.String string)
        Creates a new NSString instance with the specified content.
        Parameters:
        string - The string that will be contained in the NSString.
    • Method Detail

      • intValue

        public int intValue()
        Gets the integer value of this string.
        Returns:
        The integer value of this string, assuming a decimal representation and skipping whitespace at the beginning of the string. If the string does not contain a valid decimal representation of a number, 0 is returned. If the string contains an integer larger than Integer.MAX_VALUE, Integer.MAX_VALUE is returned. If the string contains an integer less than Integer.MIN_VALUE, Integer.MIN_VALUE is returned.
      • floatValue

        public float floatValue()
        Gets the floating-point value of this string.
        Returns:
        The floating-point value of this string, assuming a decimal representation and skipping whitespace at the beginning of the string. If the string does not contain a valid decimal representation of a number, 0 is returned. If the string contains an integer larger than Float.MAX_VALUE, Float.MAX_VALUE is returned. If the string contains an integer less than -Float.MAX_VALUE, -Float.MAX_VALUE is returned.
      • doubleValue

        public double doubleValue()
        Gets the floating-point value (double precision) of this string.
        Returns:
        The floating-point value of this string, assuming a decimal representation and skipping whitespace at the beginning of the string. If the string does not contain a valid decimal representation of a floating-point number, 0 is returned.
      • boolValue

        public boolean boolValue()
        Gets the boolean value of this string.
        Returns:
        The boolean value of this string. Leading whitespaces are ignored. Any + or - sign and leading zeroes are ignored. If the remaining string starts with 'Y', 'y', 'T', 't' or a positive digit (1-9), true is returned. Otherwise, false is returned.

        Examples: "YES" is true "true" is true " YES" is true "+1" is true "-9" is true " +01" is true "0" is false "false" is false "no" is false "1FALSE" is true "0TRUE" is true "FALSE1" is false

      • getContent

        public java.lang.String getContent()
        Gets the string content of this instance.
        Returns:
        This string contained in this instance.
      • setContent

        public void setContent​(java.lang.String c)
        Sets the string content of this instance.
        Parameters:
        c - The new content of this string object.
      • append

        public void append​(NSString s)
        Appends a string to this string.
        Parameters:
        s - The string to append.
      • append

        public void append​(java.lang.String s)
        Appends a string to this string.
        Parameters:
        s - The string to append.
      • prepend

        public void prepend​(java.lang.String s)
        Prepends a string to this string.
        Parameters:
        s - The string to prepend.
      • prepend

        public void prepend​(NSString s)
        Prepends a string to this string.
        Parameters:
        s - The string to prepend.
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • clone

        public NSString clone()
        Description copied from class: NSObject
        Creates and returns a deep copy of this instance.
        Specified by:
        clone in class NSObject
        Returns:
        A clone of this instance.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toJavaObject

        public java.lang.Object toJavaObject()
        Description copied from class: NSObject
        Converts this NSObject into an equivalent object of the Java Runtime Environment.
        • NSArray objects are converted to arrays.
        • NSDictionary objects are converted to objects extending the Map class.
        • NSSet objects are converted to objects extending the Set class.
        • NSNumber objects are converted to primitive number values (int, long, double or boolean).
        • NSString objects are converted to String objects.
        • NSData objects are converted to byte arrays.
        • NSDate objects are converted to Date objects.
        • UID objects are converted to byte arrays.
        Specified by:
        toJavaObject in class NSObject
        Returns:
        A native java object representing this NSObject's value.
      • toXML

        void toXML​(java.lang.StringBuilder xml,
                   int level)
        Description copied from class: NSObject
        Generates the XML representation of the object (without XML headers or enclosing plist-tags).
        Specified by:
        toXML in class NSObject
        Parameters:
        xml - The StringBuilder onto which the XML representation is appended.
        level - The indentation level of the object.
      • toBinary

        public void toBinary​(BinaryPropertyListWriter out)
                      throws java.io.IOException
        Description copied from class: NSObject
        Generates the binary representation of the object.
        Specified by:
        toBinary in class NSObject
        Parameters:
        out - The output stream to serialize the object to.
        Throws:
        java.io.IOException - If an I/O error occurs while writing to the stream or the object structure contains data that cannot be saved.
      • toASCII

        protected void toASCII​(java.lang.StringBuilder ascii,
                               int level)
        Description copied from class: NSObject
        Generates the ASCII representation of this object. The generated ASCII representation does not end with a newline. Complies with the Old-Style ASCII Property Lists definition.
        Specified by:
        toASCII in class NSObject
        Parameters:
        ascii - The StringBuilder onto which the ASCII representation is appended.
        level - The indentation level of the object.
      • toASCIIGnuStep

        protected void toASCIIGnuStep​(java.lang.StringBuilder ascii,
                                      int level)
        Description copied from class: NSObject
        Generates the ASCII representation of this object in the GnuStep format. The generated ASCII representation does not end with a newline.
        Specified by:
        toASCIIGnuStep in class NSObject
        Parameters:
        ascii - The StringBuilder onto which the ASCII representation is appended.
        level - The indentation level of the object.
      • compareTo

        public int compareTo​(NSObject o)
      • escapeStringForASCII

        static java.lang.String escapeStringForASCII​(java.lang.String s)
        Escapes a string for use in ASCII property lists.
        Parameters:
        s - The unescaped string.
        Returns:
        The escaped string.
      • escapeStringForXml

        static java.lang.String escapeStringForXml​(java.lang.String s)