src/share/classes/java/lang/System.java

Print this page




 617      * @see        java.lang.SecurityException
 618      * @see        java.lang.SecurityManager#checkPropertiesAccess()
 619      * @see        java.util.Properties
 620      */
 621     public static Properties getProperties() {
 622         SecurityManager sm = getSecurityManager();
 623         if (sm != null) {
 624             sm.checkPropertiesAccess();
 625         }
 626 
 627         return props;
 628     }
 629 
 630     /**
 631      * Returns the system-dependent line separator string.  It always
 632      * returns the same value - the initial value of the {@linkplain
 633      * #getProperty(String) system property} {@code line.separator}.
 634      *
 635      * <p>On UNIX systems, it returns {@code "\n"}; on Microsoft
 636      * Windows systems it returns {@code "\r\n"}.


 637      * @since 1.7
 638      */
 639     public static String lineSeparator() {
 640         return lineSeparator;
 641     }
 642 
 643     private static String lineSeparator;
 644 
 645     /**
 646      * Sets the system properties to the <code>Properties</code>
 647      * argument.
 648      * <p>
 649      * First, if there is a security manager, its
 650      * <code>checkPropertiesAccess</code> method is called with no
 651      * arguments. This may result in a security exception.
 652      * <p>
 653      * The argument becomes the current set of system properties for use
 654      * by the {@link #getProperty(String)} method. If the argument is
 655      * <code>null</code>, then the current set of system properties is
 656      * forgotten.




 617      * @see        java.lang.SecurityException
 618      * @see        java.lang.SecurityManager#checkPropertiesAccess()
 619      * @see        java.util.Properties
 620      */
 621     public static Properties getProperties() {
 622         SecurityManager sm = getSecurityManager();
 623         if (sm != null) {
 624             sm.checkPropertiesAccess();
 625         }
 626 
 627         return props;
 628     }
 629 
 630     /**
 631      * Returns the system-dependent line separator string.  It always
 632      * returns the same value - the initial value of the {@linkplain
 633      * #getProperty(String) system property} {@code line.separator}.
 634      *
 635      * <p>On UNIX systems, it returns {@code "\n"}; on Microsoft
 636      * Windows systems it returns {@code "\r\n"}.
 637      *
 638      * @return the system-dependent line separator string
 639      * @since 1.7
 640      */
 641     public static String lineSeparator() {
 642         return lineSeparator;
 643     }
 644 
 645     private static String lineSeparator;
 646 
 647     /**
 648      * Sets the system properties to the <code>Properties</code>
 649      * argument.
 650      * <p>
 651      * First, if there is a security manager, its
 652      * <code>checkPropertiesAccess</code> method is called with no
 653      * arguments. This may result in a security exception.
 654      * <p>
 655      * The argument becomes the current set of system properties for use
 656      * by the {@link #getProperty(String)} method. If the argument is
 657      * <code>null</code>, then the current set of system properties is
 658      * forgotten.