Ejemplo n.º 1
0
        /*
         *
         * Adds information about provider services into HashMap.
         *
         * @param p
         */
        public static void initServiceInfo(java.security.Provider p)
        {
            java.security.Provider.Service serv;
            String key;
            String type;
            String alias;

            java.lang.StringBuilder sb = new java.lang.StringBuilder(128);

            for (java.util.Iterator <java.security.Provider.Service> it1 = p.getServices().iterator(); it1.hasNext();)
            {
                serv = it1.next();
                type = serv.getType();
                sb.delete(0, sb.length());
                key = sb.append(type).append(".").append( //$NON-NLS-1$
                    Util.toUpperCase(serv.getAlgorithm())).toString();
                if (!services.containsKey(key))
                {
                    services.put(key, serv);
                }
                for (java.util.Iterator <String> it2 = Engine.door.getAliases(serv); it2.hasNext();)
                {
                    alias = it2.next();
                    sb.delete(0, sb.length());
                    key = sb.append(type).append(".").append(Util.toUpperCase(alias)) //$NON-NLS-1$
                          .toString();
                    if (!services.containsKey(key))
                    {
                        services.put(key, serv);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /**
         * Returns the timestamp formatted as a String in the JDBC Timestamp Escape
         * format, which is {@code "yyyy-mm-dd hh:mm:ss.nnnnnnnnn"}.
         *
         * @return A string representing the instant defined by the {@code
         *         Timestamp}, in JDBC Timestamp escape format.
         */
        public override String ToString()
        {
            java.lang.StringBuilder sb = new java.lang.StringBuilder(29);

            format((getYear() + 1900), 4, sb);
            sb.append('-');
            format((getMonth() + 1), 2, sb);
            sb.append('-');
            format(getDate(), 2, sb);
            sb.append(' ');
            format(getHours(), 2, sb);
            sb.append(':');
            format(getMinutes(), 2, sb);
            sb.append(':');
            format(getSeconds(), 2, sb);
            sb.append('.');
            if (nanos == 0)
            {
                sb.append('0');
            }
            else
            {
                format(nanos, 9, sb);
                while (sb.charAt(sb.length() - 1) == '0')
                {
                    sb.setLength(sb.length() - 1);
                }
            }

            return(sb.toString());
        }
Ejemplo n.º 3
0
        /**
         * Reads a line of text form the current position in this file. A line is
         * represented by zero or more characters followed by {@code '\n'}, {@code
         * '\r'}, {@code "\r\n"} or the end of file marker. The string does not
         * include the line terminating sequence.
         * <p>
         * Blocks until a line terminating sequence has been read, the end of the
         * file is reached or an exception is thrown.
         *
         * @return the contents of the line or {@code null} if no characters have
         *         been read before the end of the file has been reached.
         * @throws IOException
         *             if this file is closed or another I/O error occurs.
         */
        public String readLine()                                            //throws IOException {
        {
            java.lang.StringBuilder line = new java.lang.StringBuilder(80); // Typical line length
            bool foundTerminator         = false;
            long unreadPosition          = 0;

            while (true)
            {
                int nextByte = read();
                switch (nextByte)
                {
                case -1:
                    return(line.length() != 0 ? line.toString() : null);

                case (byte)'\r':
                    if (foundTerminator)
                    {
                        seek(unreadPosition);
                        return(line.toString());
                    }
                    foundTerminator = true;
                    /* Have to be able to peek ahead one byte */
                    unreadPosition = getFilePointer();
                    break;

                case (byte)'\n':
                    return(line.toString());

                default:
                    if (foundTerminator)
                    {
                        seek(unreadPosition);
                        return(line.toString());
                    }
                    line.append((char)nextByte);
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        /**
         *
         * Adds information about provider services into HashMap.
         *
         * @param p
         */
        public static void initServiceInfo(java.security.Provider p)
        {
            java.security.Provider.Service serv;
            String key;
            String type;
            String alias;
            java.lang.StringBuilder sb = new java.lang.StringBuilder(128);

            for (java.util.Iterator<java.security.Provider.Service> it1 = p.getServices().iterator(); it1.hasNext(); )
            {
                serv = it1.next();
                type = serv.getType();
                sb.delete(0, sb.length());
                key = sb.append(type).append(".").append( //$NON-NLS-1$
                        Util.toUpperCase(serv.getAlgorithm())).toString();
                if (!services.containsKey(key))
                {
                    services.put(key, serv);
                }
                for (java.util.Iterator<String> it2 = Engine.door.getAliases(serv); it2.hasNext(); )
                {
                    alias = it2.next();
                    sb.delete(0, sb.length());
                    key = sb.append(type).append(".").append(Util.toUpperCase(alias)) //$NON-NLS-1$
                            .toString();
                    if (!services.containsKey(key))
                    {
                        services.put(key, serv);
                    }
                }
            }
        }
Ejemplo n.º 5
0
        /**
         * Returns the timestamp formatted as a String in the JDBC Timestamp Escape
         * format, which is {@code "yyyy-mm-dd hh:mm:ss.nnnnnnnnn"}.
         *
         * @return A string representing the instant defined by the {@code
         *         Timestamp}, in JDBC Timestamp escape format.
         */
        public override String ToString()
        {
            java.lang.StringBuilder sb = new java.lang.StringBuilder(29);

            format((getYear() + 1900), 4, sb);
            sb.append('-');
            format((getMonth() + 1), 2, sb);
            sb.append('-');
            format(getDate(), 2, sb);
            sb.append(' ');
            format(getHours(), 2, sb);
            sb.append(':');
            format(getMinutes(), 2, sb);
            sb.append(':');
            format(getSeconds(), 2, sb);
            sb.append('.');
            if (nanos == 0)
            {
                sb.append('0');
            }
            else
            {
                format(nanos, 9, sb);
                while (sb.charAt(sb.length() - 1) == '0')
                {
                    sb.setLength(sb.length() - 1);
                }
            }

            return sb.toString();
        }
Ejemplo n.º 6
0
 /**
  * Reads a line of text form the current position in this file. A line is
  * represented by zero or more characters followed by {@code '\n'}, {@code
  * '\r'}, {@code "\r\n"} or the end of file marker. The string does not
  * include the line terminating sequence.
  * <p/>
  * Blocks until a line terminating sequence has been read, the end of the
  * file is reached or an exception is thrown.
  *
  * @return the contents of the line or {@code null} if no characters have
  *         been read before the end of the file has been reached.
  * @throws IOException
  *             if this file is closed or another I/O error occurs.
  */
 public String readLine()
 {
     //throws IOException {
     java.lang.StringBuilder line = new java.lang.StringBuilder(80); // Typical line length
     bool foundTerminator = false;
     long unreadPosition = 0;
     while (true) {
     int nextByte = read();
     switch (nextByte) {
         case -1:
             return line.length() != 0 ? line.toString() : null;
         case (byte) '\r':
             if (foundTerminator) {
                 seek(unreadPosition);
                 return line.toString();
             }
             foundTerminator = true;
             /* Have to be able to peek ahead one byte */
             unreadPosition = getFilePointer();
             break;
         case (byte) '\n':
             return line.toString();
         default:
             if (foundTerminator) {
                 seek(unreadPosition);
                 return line.toString();
             }
             line.append((char) nextByte);
             break;
     }
     }
 }