/*
* Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package java.lang;
import java.io.*;
import java.security.AccessControlContext;
import java.util.Properties;
import java.util.PropertyPermission;
import java.util.StringTokenizer;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.AllPermission;
import java.nio.channels.Channel;
import java.nio.channels.spi.SelectorProvider;
import sun.nio.ch.Interruptible;
import sun.reflect.CallerSensitive;
import sun.reflect.Reflection;
import sun.security.util.SecurityConstants;
import sun.reflect.annotation.AnnotationType;
/**
* The System class contains several useful class fields
* and methods. It cannot be instantiated.
*
*
Among the facilities provided by the System class
* are standard input, standard output, and error output streams;
* access to externally defined properties and environment
* variables; a means of loading files and libraries; and a utility
* method for quickly copying a portion of an array.
*
* @author unascribed
* @since JDK1.0
*/
public final class System {
/* register the natives via the static initializer.
*
* VM will invoke the initializeSystemClass method to complete
* the initialization for this class separated from clinit.
* Note that to use properties set by the VM, see the constraints
* described in the initializeSystemClass method.
*/
private static native void registerNatives();
static {
registerNatives();
}
/** Don't let anyone instantiate this class */
private System() {
}
/**
* The "standard" input stream. This stream is already
* open and ready to supply input data. Typically this stream
* corresponds to keyboard input or another input source specified by
* the host environment or user.
*/
public final static InputStream in = null;
/**
* The "standard" output stream. This stream is already
* open and ready to accept output data. Typically this stream
* corresponds to display output or another output destination
* specified by the host environment or user.
*
* For simple stand-alone Java applications, a typical way to write
* a line of output data is:
*
* System.out.println(data)
*
*
* See the println methods in class PrintStream.
*
* @see java.io.PrintStream#println()
* @see java.io.PrintStream#println(boolean)
* @see java.io.PrintStream#println(char)
* @see java.io.PrintStream#println(char[])
* @see java.io.PrintStream#println(double)
* @see java.io.PrintStream#println(float)
* @see java.io.PrintStream#println(int)
* @see java.io.PrintStream#println(long)
* @see java.io.PrintStream#println(java.lang.Object)
* @see java.io.PrintStream#println(java.lang.String)
*/
public final static PrintStream out = null;
/**
* The "standard" error output stream. This stream is already
* open and ready to accept output data.
*
* Typically this stream corresponds to display output or another
* output destination specified by the host environment or user. By
* convention, this output stream is used to display error messages
* or other information that should come to the immediate attention
* of a user even if the principal output stream, the value of the
* variable out, has been redirected to a file or other
* destination that is typically not continuously monitored.
*/
public final static PrintStream err = null;
/* The security manager for the system.
*/
private static volatile SecurityManager security = null;
/**
* Reassigns the "standard" input stream.
*
*
First, if there is a security manager, its checkPermission
* method is called with a RuntimePermission("setIO") permission
* to see if it's ok to reassign the "standard" input stream.
*
*
* @param in the new standard input stream.
*
* @throws SecurityException
* if a security manager exists and its
* checkPermission method doesn't allow
* reassigning of the standard input stream.
*
* @see SecurityManager#checkPermission
* @see java.lang.RuntimePermission
*
* @since JDK1.1
*/
public static void setIn(InputStream in) {
checkIO();
setIn0(in);
}
/**
* Reassigns the "standard" output stream.
*
*
First, if there is a security manager, its checkPermission
* method is called with a RuntimePermission("setIO") permission
* to see if it's ok to reassign the "standard" output stream.
*
* @param out the new standard output stream
*
* @throws SecurityException
* if a security manager exists and its
* checkPermission method doesn't allow
* reassigning of the standard output stream.
*
* @see SecurityManager#checkPermission
* @see java.lang.RuntimePermission
*
* @since JDK1.1
*/
public static void setOut(PrintStream out) {
checkIO();
setOut0(out);
}
/**
* Reassigns the "standard" error output stream.
*
*
First, if there is a security manager, its checkPermission
* method is called with a RuntimePermission("setIO") permission
* to see if it's ok to reassign the "standard" error output stream.
*
* @param err the new standard error output stream.
*
* @throws SecurityException
* if a security manager exists and its
* checkPermission method doesn't allow
* reassigning of the standard error output stream.
*
* @see SecurityManager#checkPermission
* @see java.lang.RuntimePermission
*
* @since JDK1.1
*/
public static void setErr(PrintStream err) {
checkIO();
setErr0(err);
}
private static volatile Console cons = null;
/**
* Returns the unique {@link java.io.Console Console} object associated
* with the current Java virtual machine, if any.
*
* @return The system console, if any, otherwise null.
*
* @since 1.6
*/
public static Console console() {
if (cons == null) {
synchronized (System.class) {
cons = sun.misc.SharedSecrets.getJavaIOAccess().console();
}
}
return cons;
}
/**
* Returns the channel inherited from the entity that created this
* Java virtual machine.
*
*
This method returns the channel obtained by invoking the
* {@link java.nio.channels.spi.SelectorProvider#inheritedChannel
* inheritedChannel} method of the system-wide default
* {@link java.nio.channels.spi.SelectorProvider} object.
*
*
In addition to the network-oriented channels described in
* {@link java.nio.channels.spi.SelectorProvider#inheritedChannel
* inheritedChannel}, this method may return other kinds of
* channels in the future.
*
* @return The inherited channel, if any, otherwise null.
*
* @throws IOException
* If an I/O error occurs
*
* @throws SecurityException
* If a security manager is present and it does not
* permit access to the channel.
*
* @since 1.5
*/
public static Channel inheritedChannel() throws IOException {
return SelectorProvider.provider().inheritedChannel();
}
private static void checkIO() {
SecurityManager sm = getSecurityManager();
if (sm != null) {
sm.checkPermission(new RuntimePermission("setIO"));
}
}
private static native void setIn0(InputStream in);
private static native void setOut0(PrintStream out);
private static native void setErr0(PrintStream err);
/**
* Sets the System security.
*
*
If there is a security manager already installed, this method first
* calls the security manager's checkPermission method
* with a RuntimePermission("setSecurityManager")
* permission to ensure it's ok to replace the existing
* security manager.
* This may result in throwing a SecurityException.
*
*
Otherwise, the argument is established as the current
* security manager. If the argument is null and no
* security manager has been established, then no action is taken and
* the method simply returns.
*
* @param s the security manager.
* @exception SecurityException if the security manager has already
* been set and its checkPermission method
* doesn't allow it to be replaced.
* @see #getSecurityManager
* @see SecurityManager#checkPermission
* @see java.lang.RuntimePermission
*/
public static
void setSecurityManager(final SecurityManager s) {
try {
s.checkPackageAccess("java.lang");
} catch (Exception e) {
// no-op
}
setSecurityManager0(s);
}
private static synchronized
void setSecurityManager0(final SecurityManager s) {
SecurityManager sm = getSecurityManager();
if (sm != null) {
// ask the currently installed security manager if we
// can replace it.
sm.checkPermission(new RuntimePermission
("setSecurityManager"));
}
if ((s != null) && (s.getClass().getClassLoader() != null)) {
// New security manager class is not on bootstrap classpath.
// Cause policy to get initialized before we install the new
// security manager, in order to prevent infinite loops when
// trying to initialize the policy (which usually involves
// accessing some security and/or system properties, which in turn
// calls the installed security manager's checkPermission method
// which will loop infinitely if there is a non-system class
// (in this case: the new security manager class) on the stack).
AccessController.doPrivileged(new PrivilegedAction
key :java.util.logging.config.file and value :C:\Users\Administrator\.IntelliJIdea14\system\tomcat\Unnamed_xdfmanager_3\conf\logging.properties
key :sun.desktop and value :windows
key :com.sun.management.jmxremote and value :
key :java.vm.specification.vendor and value :Oracle Corporation
key :java.runtime.version and value :1.7.0_80-b15
key :user.name and value :Administrator
key :shared.loader and value :
key :tomcat.util.buf.StringCache.byte.enabled and value :true
key :java.naming.factory.initial and value :org.apache.naming.java.javaURLContextFactory
key :user.language and value :zh
key :sun.boot.library.path and value :E:\Program Files (x86)\Java\jdk1.7.0_80\jre\bin
key :com.sun.management.jmxremote.port and value :1099
key :jdk.tls.ephemeralDHKeySize and value :2048
key :java.version and value :1.7.0_80
key :java.util.logging.manager and value :org.apache.juli.ClassLoaderLogManager
key :user.timezone and value :Asia/Shanghai
key :sun.arch.data.model and value :64
key :java.util.concurrent.ForkJoinPool.common.threadFactory and value :org.apache.catalina.startup.SafeForkJoinWorkerThreadFactory
key :java.endorsed.dirs and value :F:\apache-tomcat-7.0.77\endorsed
key :java.rmi.server.randomIDs and value :true
key :sun.cpu.isalist and value :amd64
key :sun.jnu.encoding and value :GBK
key :file.encoding.pkg and value :sun.io
key :package.access and value :sun.,org.apache.catalina.,org.apache.coyote.,org.apache.jasper.,org.apache.naming.resources.,org.apache.tomcat.
key :file.separator and value :\
key :java.specification.name and value :Java Platform API Specification
key :java.class.version and value :51.0
key :user.country and value :CN
key :java.home and value :E:\Program Files (x86)\Java\jdk1.7.0_80\jre
key :java.vm.info and value :mixed mode
key :os.version and value :6.1
key :com.sun.management.jmxremote.ssl and value :false
key :path.separator and value :;
key :java.vm.version and value :24.80-b11
key :user.variant and value :
key :java.awt.printerjob and value :sun.awt.windows.WPrinterJob
key :tomcat.util.scan.DefaultJarScanner.jarsToSkip and value :bootstrap.jar,commons-daemon.jar,tomcat-juli.jar,annotations-api.jar,el-api.jar,jsp-api.jar,servlet-api.jar,websocket-api.jar,catalina.jar,catalina-ant.jar,catalina-ha.jar,catalina-tribes.jar,jasper.jar,jasper-el.jar,ecj-*.jar,tomcat-api.jar,tomcat-util.jar,tomcat-coyote.jar,tomcat-dbcp.jar,tomcat-jni.jar,tomcat-spdy.jar,tomcat-i18n-en.jar,tomcat-i18n-es.jar,tomcat-i18n-fr.jar,tomcat-i18n-ja.jar,tomcat-juli-adapters.jar,catalina-jmx-remote.jar,catalina-ws.jar,tomcat-jdbc.jar,tools.jar,commons-beanutils*.jar,commons-codec*.jar,commons-collections*.jar,commons-dbcp*.jar,commons-digester*.jar,commons-fileupload*.jar,commons-httpclient*.jar,commons-io*.jar,commons-lang*.jar,commons-logging*.jar,commons-math*.jar,commons-pool*.jar,jstl.jar,taglibs-standard-spec-*.jar,geronimo-spec-jaxrpc*.jar,wsdl4j*.jar,ant.jar,ant-junit*.jar,aspectj*.jar,jmx.jar,h2*.jar,hibernate*.jar,httpclient*.jar,jmx-tools.jar,jta*.jar,log4j.jar,log4j-1*.jar,mail*.jar,slf4j*.jar,xercesImpl.jar,xmlParserAPIs.jar,xml-apis.jar,junit.jar,junit-*.jar,hamcrest*.jar,org.hamcrest*.jar,ant-launcher.jar,cobertura-*.jar,asm-*.jar,dom4j-*.jar,icu4j-*.jar,jaxen-*.jar,jdom-*.jar,jetty-*.jar,oro-*.jar,servlet-api-*.jar,tagsoup-*.jar,xmlParserAPIs-*.jar,xom-*.jar
key :sun.io.unicode.encoding and value :UnicodeLittle
key :awt.toolkit and value :sun.awt.windows.WToolkit
key :com.sun.management.jmxremote.authenticate and value :false
key :package.definition and value :sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.jasper.,org.apache.naming.,org.apache.tomcat.
key :user.script and value :
key :java.naming.factory.url.pkgs and value :org.apache.naming
key :user.home and value :C:\Users\Administrator
key :org.apache.catalina.startup.ContextConfig.jarsToSkip and value :
key :java.specification.vendor and value :Oracle Corporation
key :java.library.path and value :E:\Program Files (x86)\Java\jdk1.7.0_80\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;E:\apache-maven-3.5.0/bin;E:\Program Files (x86)\Java\jdk1.7.0_80/bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;E:\Program Files (x86)\TortoiseSVN\bin;E:\Program Files (x86)\MySQL\MySQL Server 5.5\bin;.
key :java.vendor.url and value :http://java.oracle.com/
key :org.apache.catalina.startup.TldConfig.jarsToSkip and value :tomcat7-websocket.jar
key :java.vm.vendor and value :Oracle Corporation
key :common.loader and value :F:/apache-tomcat-7.0.77/lib,F:/apache-tomcat-7.0.77/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar
key :java.runtime.name and value :Java(TM) SE Runtime Environment
key :sun.java.command and value :org.apache.catalina.startup.Bootstrap start
key :java.class.path and value :F:\apache-tomcat-7.0.77\bin\bootstrap.jar;F:\apache-tomcat-7.0.77\bin\tomcat-juli.jar
key :java.vm.specification.name and value :Java Virtual Machine Specification
key :java.vm.specification.version and value :1.7
key :catalina.home and value :F:\apache-tomcat-7.0.77
key :sun.cpu.endian and value :little
key :sun.os.patch.level and value :Service Pack 1
key :java.io.tmpdir and value :F:\apache-tomcat-7.0.77\temp
key :java.vendor.url.bug and value :http://bugreport.sun.com/bugreport/
key :server.loader and value :
key :java.rmi.server.hostname and value :127.0.0.1
key :os.arch and value :amd64
key :java.awt.graphicsenv and value :sun.awt.Win32GraphicsEnvironment
key :java.ext.dirs and value :E:\Program Files (x86)\Java\jdk1.7.0_80\jre\lib\ext;C:\Windows\Sun\Java\lib\ext
key :user.dir and value :F:\apache-tomcat-7.0.77\bin
key :line.separator and value :
key :java.vm.name and value :Java HotSpot(TM) 64-Bit Server VM
key :file.encoding and value :GBK
key :java.specification.version and value :1.7
androi中提到了布尔数组;
布尔数组默认的是false, 并且只会打印false或者是true
布尔数组的例子; 根据字符数组创建布尔数组
char[] c = {'p','u','b','l','i','c'};
//根据字符数组的长度创建布尔数组的个数
boolean[] b = new bool
文章摘自:http://blog.csdn.net/yangwawa19870921/article/details/7553181
在编写HQL时,可能会出现这种代码:
select a.name,b.age from TableA a left join TableB b on a.id=b.id
如果这是HQL,那么这段代码就是错误的,因为HQL不支持
1. 简单的for循环
public static void main(String[] args) {
for (int i = 1, y = i + 10; i < 5 && y < 12; i++, y = i * 2) {
System.err.println("i=" + i + " y="
异常信息本地化
Spring Security支持将展现给终端用户看的异常信息本地化,这些信息包括认证失败、访问被拒绝等。而对于展现给开发者看的异常信息和日志信息(如配置错误)则是不能够进行本地化的,它们是以英文硬编码在Spring Security的代码中的。在Spring-Security-core-x
近来工作中遇到这样的两个需求
1. 给个Date对象,找出该时间所在月的第一天和最后一天
2. 给个Date对象,找出该时间所在周的第一天和最后一天
需求1中的找月第一天很简单,我记得api中有setDate方法可以使用
使用setDate方法前,先看看getDate
var date = new Date();
console.log(date);
// Sat J
MyBatis的update元素的用法与insert元素基本相同,因此本篇不打算重复了。本篇仅记录批量update操作的
sql语句,懂得SQL语句,那么MyBatis部分的操作就简单了。 注意:下列批量更新语句都是作为一个事务整体执行,要不全部成功,要不全部回滚。
MSSQL的SQL语句
WITH R AS(
SELECT 'John' as name, 18 as