Enhancing the Application: Advanced JDBC Features(转)
Enhancing the Application: Advanced JDBC Features
This chapter describes additional functionality that you can use in your Java application. Some of these features have not been implemented in the sample application, while some features are enhancements you can use in your code to improve performance.
This chapter includes the following sections:
6.1 Using Dynamic SQL
Dynamic SQL, or generating SQL statements on the fly, is a constant need in a production environment. Very often, and especially in the matter of updates to be performed on a database, the final query is not known until run time.
For scenarios where many similar queries with differing update values must be run on the database, you can use the OraclePreparedStatement object, which extends the Statement object. This is done by substituting the literal update values with bind variables. You can also use stored PL/SQL functions on the database by calling stored procedures through the OracleCallableStatement object.
This section discusses the following topics:
6.1.1 Using OraclePreparedStatement
To run static SQL queries on the database, you use the Statement object. However, to run multiple similar queries or perform multiple updates that affect many columns in the database, it is not feasible to hard-code each query in your application.
You can use OraclePreparedStatement when you run the same SQL statement multiple times. Consider a query like the following:
SELECT * FROM Employees WHERE ID=xyz;
Every time the value of xyz in this query changes, the SQL statement needs to be compiled again.
If you use OraclePreparedStatement functionality, the SQL statement you want to run is precompiled and stored in a PreparedStatement object, and you can run it as many times as required without compiling it every time it is run. If the data in the statement changes, you can use bind variables as placeholders for the data and then provide literal values at run time.
Consider the following example of using OraclePreparedStatement:
Example 6-1 Creating a PreparedStatement
OraclePreparedStatement pstmt = conn.prepareStatement("UPDATE Employees
SET salary = ? WHERE ID = ?");
pstmt.setBigDecimal(1, 153833.00)
pstmt.setInt(2, 110592)
The advantages of using the OraclePreparedStatement interface include:
You can batch updates by using the same
PreparedStatementobjectYou can improve performance because the SQL statement that is run many times is compiled only the first time it is run.
You can use bind variables to make the code simpler and reusable.
6.1.2 Using OracleCallableStatement
You can access stored procedures on databases using the OracleCallableStatement interface. This interface extends the OraclePreparedStatement interface. The OracleCallableStatement interface consists of standard JDBC escape syntax to call stored procedures. You may use this with or without a result parameter. However, if you do use a result parameter, it must be registered as an OUT parameter. Other parameters that you use with this interface can be either IN, OUT, or both.
These parameters are set by using accessor methods inherited from the OraclePreparedStatement interface. IN parameters are set by using the setXXX methods and OUT parameters are retrieved by using the getXXX methods, XXX being the Java data type of the parameter.
A CallableStatement can also return multiple ResultSet objects.
As an example, you can create an OracleCallableStatement to call the stored procedure called foo, as follows:
Example 6-2 Creating a CallableStatement
OracleCallableStatement cs = (OracleCallableStatement)
conn.prepareCall("{call foo(?)}");
You can pass the string bar to this procedure in one of the following two ways:
cs.setString(1,"bar"); // JDBC standard
// or...
cs.setString("myparameter","bar"); // Oracle extension
6.1.3 Using Bind Variables
Bind variables are variable substitutes for literals in a SQL statement. They are used in conjunction with OraclePreparedStatement and OracleCallableStatement to specify parameter values that are used to build the SQL statement. Using bind variables has remarkable performance advantages in a production environment.
For PL/SQL blocks or stored procedure calls, you can use the following qualifiers to differentiate between input and output variables: IN, OUT, and IN OUT. Input variable values are set by using setXXX methods and OUT variable values can be retrieved by using getXXX methods, where XXX is the Java data type of the values. This depends on the SQL data types of the columns that you are accessing in the database.
6.2 Calling Stored Procedures
Oracle Java Database Connectivity (JDBC) drivers support the processing of PL/SQL stored procedures and anonymous blocks. They support Oracle PL/SQL block syntax and most of SQL92 escape syntax. The following PL/SQL calls would work with any Oracle JDBC driver:
Example 6-3 Calling Stored Procedures
// SQL92 syntaxCallableStatement cs1 = conn.prepareCall
( "{call proc (?,?)}" ) ; // stored proc
CallableStatement cs2 = conn.prepareCall
( "{? = call func (?,?)}" ) ; // stored func // Oracle PL/SQL block syntax
CallableStatement cs3 = conn.prepareCall
( "begin proc (?,?); end;" ) ; // stored proc
CallableStatement cs4 = conn.prepareCall
( "begin ? := func(?,?); end;" ) ; // stored func
As an example of using the Oracle syntax, here is a PL/SQL code snippet that creates a stored function. The PL/SQL function gets a character sequence and concatenates a suffix to it:
Example 6-4 Creating a Stored Function
create or replace function foo (val1 char)
return char as
begin
return val1 || 'suffix';
end;
You can call this stored function in a Java program as follows:
Example 6-5 Calling a Stored Function in Java
OracleDataSource ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:@<hoststring>");
ods.setUser("hr");
ods.setPassword("hr");
Connection conn = ods.getConnection();
CallableStatement cs = conn.prepareCall ("begin ? := foo(?); end;");
cs.registerOutParameter(1,Types.CHAR);
cs.setString(2, "aa");
cs.executeUpdate();
String result = cs.getString(1);
The following sections describe how you can use stored procedures in the sample application in this guide:
6.2.1 Creating a PL/SQL Stored Procedure in JDeveloper
JDeveloper allows you to create stored procedures in the database through the Connection Navigator. In these steps, you create a stored procedure that can be used as an alternative way of inserting an employee record in the sample application.
Select the Connections tab to view the Connection Navigator.
Expand the database connection node (by default called DBConnection1), and the HR node to see the objects in the
HRdatabase.Right-click Procedures, and select New PL/SQL Procedure.
In the Create PL/SQL Procedure dialog, enter
insert_employeeas the object name. Click OK.The skeleton code for the procedure is displayed in the Source Editor.
After the procedure name, enter the following lines of code:
PROCEDURE "INSERT_EMPLOYEE" (p_first_name employees.first_name%type,
p_last_name employees.last_name%type,
p_email employees.email%type,
p_phone_number employees.phone_number%type,
p_job_id employees.job_id%type,
p_salary employees.salary%type
)After the
BEGINstatement, replace the line that readsNULLwith the following:INSERT INTO Employees VALUES (EMPLOYEES_SEQ.nextval, p_first_name ,
p_last_name , p_email , p_phone_number, SYSDATE, p_job_id,
p_salary,.30,100,80);You can see that the statement uses the same hard-coded values that are used for the last three columns in the
addEmployeemethod in theDataHandler.javaclass.Add the procedure name in the
ENDstatement:END insert_employee;
Save the file, and check whether there are any compilation errors.
The complete code for the stored procedure is shown in Example 6-6.
Example 6-6 Creating a PL/SQL Stored Procedure to Insert Employee Data
PROCEDURE "INSERT_EMPLOYEE" (p_first_name employees.first_name%type,
p_last_name employees.last_name%type,
p_email employees.email%type,
p_phone_number employees.phone_number%type,
p_job_id employees.job_id%type,
p_salary employees.salary%type
)
AS
BEGIN
INSERT INTO Employees VALUES (EMPLOYEES_SEQ.nextval, p_first_name ,
p_last_name , p_email , p_phone_number, SYSDATE, p_job_id,
p_salary,.30,100,80);
END insert_employee;
6.2.2 Creating a Method to Use the Stored Procedure
In these steps, you add a method to the DataHandler.java class that can be used as an alternative to the addEmployee method. The new method you add here makes use of the insert_employee stored procedure.
Select the Applications tab to display the Application Navigator.
If the
DataHandler.javafile is not already open in the Java Source Editor, double-click it to open it.Import the
CallableStatementinterface as follows:import java.sql.CallableStatement;
After the
addEmployeemethod, add the declaration for theaddEmployeeSPmethod.public String addEmployeeSP(String first_name, String last_name,
String email, String phone_number, String job_id,
int salary) throws SQLException {
}The method signature is the same as that for
addEmployee.Inside the method, add a
tryblock, and inside that, connect to the database.try {
getDBConnection();
}In addition, inside the
tryblock, create the SQL string:sqlString = "begin hr.insert_employee(?,?,?,?,?,?); end;";
The question marks (
?) in the statement are bind variables, acting as placeholders for the values offirst_name,last_name, and so on expected by the stored procedure.Create the
CallableStatement:CallableStatement callstmt = conn.prepareCall(sqlString);
Set the
INparameters:callstmt.setString(1, first_name);
callstmt.setString(2, last_name);
callstmt.setString(3, email);
callstmt.setString(4, phone_number);
callstmt.setString(5, job_id);
callstmt.setInt(6, salary);Add a trace message, and run the callable statement.
System.out.println("\nInserting with stored procedure: " +
sqlString);
callstmt.execute();Add a return message:
return "success";
After the
tryblock, add acatchblock to trap any errors. Call thelogExceptioncreated in Example 5-5.catch ( SQLException ex ) {
System.out.println("Possible source of error: Make sure you have created the stored procedure");
logException( ex );
return "failure";
}Save
DataHandler.java.
The complete method is shown in Example 6-7.
Note:
If you have not added the logException() method (see Example 5-5), JDeveloper will indicate an error by showing a red curly line under logException(ex). This method must be present in the DataHandler.java class before you proceed with compiling the file.
Example 6-7 Using PL/SQL Stored Procedures in Java
public String addEmployeeSP(String first_name, String last_name,
String email, String phone_number, String job_id,
int salary) throws SQLException { try {
getDBConnection();
sqlString = "begin hr.insert_employee(?,?,?,?,?,?); end;";
CallableStatement callstmt = conn.prepareCall(sqlString);
callstmt.setString(1, first_name);
callstmt.setString(2, last_name);
callstmt.setString(3, email);
callstmt.setString(4, phone_number);
callstmt.setString(5, job_id);
callstmt.setInt(6, salary);
System.out.println("\nInserting with stored procedure: " +
sqlString); callstmt.execute();
return "success";
}
catch ( SQLException ex ) {
System.out.println("Possible source of error: Make sure you have created the stored procedure");
logException( ex );
return "failure";
}
}
6.2.3 Allowing Users to Choose the Stored Procedure
The steps in this section add a radio button group to the insert.jsp page, which allows a user to choose between inserting an employee record using the stored procedure, or by using a SQL query in Java code.
Open
insert.jspin the Visual Editor, if it is not already open.Create a new line after the Insert Employee Record heading. With the cursor on this new line, drag UseBean from the JSP page of the Component Palette to add a
jsp:useBeantag to the page. Enterempsbeanas the ID, browse to selecthr.DataHandleras the Class, and set the Scope tosession. With the UseBean still selected on the page, set the style of this line toNoneinstead of Heading 3.Drag a Radio Button component from the HTML Forms page of the Component Palette onto the page inside the form above the table. In the Insert Radio Button dialog, enter
useSPas the Name,falseas the Value, and select Checked. Click OK.In the Visual Editor, position the cursor to the right of the button, and enter text to describe the purpose of the button, for example, 'Use only JDBC to insert a new record'.
Press Enter at the end of the current line to create a new line.
Drag a second Radio Button below the first one. In the Insert Radio Button dialog, use
useSPas the Name,trueas the Value, and ensure that the Checked checkbox is not selected.In the Visual Editor, position the cursor directly to the right of the button, and enter text to describe the purpose of the button, for example, 'Use stored procedure called via JDBC to insert a record'.
Save the page.
Figure 6-1 shows insert.jsp with the radio button that provides the option to use a stored procedure.
Figure 6-1 Adding a Link to Provide the Stored Procedure Option

Description of "Figure 6-1 Adding a Link to Provide the Stored Procedure Option"
6.2.4 Calling the Stored Procedure from the Application
The steps in this section modify the insert_action.jsp file, which processes the form on the insert.jsp page, to use the radio button selection and select the appropriate method for inserting a new employee record.
Open
insert_action.jspin the Visual Editor, if it is not already open.Double-click the scriptlet to invoke the Scriptlet Properties dialog box and add a new variable after the salary variable, as follows:
String useSPFlag = request.getParameter("useSP");Below that, still in the Scriptlet Properties dialog box, replace the existing
empsbean.addEmployeeline with the following lines of code to select theaddEmployeeSPmethod or the pure JDBCaddEmployeemethod to insert the record.if ( useSPFlag.equalsIgnoreCase("true"))
empsbean.addEmployeeSP(first_name, last_name, email,
phone_number, job_id, salary.intValue());
// otherwise use pure JDBC insert
else
empsbean.addEmployee(first_name, last_name, email,
phone_number, job_id, salary.intValue());Save
insert_action.jsp.
You can now run the application and use the radio buttons on the insert page to choose how you want to insert the new employee record. In a browser, the page will appear as shown in Figure 6-2.
Figure 6-2 Using Stored Procedures to Enter Records

Description of "Figure 6-2 Using Stored Procedures to Enter Records"
6.3 Using Cursor Variables
Oracle JDBC drivers support cursor variables with the REF CURSOR types, which are not a part of the JDBC standard. REF CURSOR types are supported as JDBC result sets.
A cursor variable holds the memory location of a query work area, rather than the contents of the area. Declaring a cursor variable creates a pointer. In SQL, a pointer has the data type REF x, where REF is short for REFERENCE and x represents the entity being referenced. A REF CURSOR, then, identifies a reference to a cursor variable. Because many cursor variables might exist to point to many work areas, REF CURSOR can be thought of as a category or data type specifier that identifies many different types of cursor variables. A REF CURSOR essentially encapsulates the results of a query.
Oracle does not return ResultSets. To access data returned by a query, you use CURSORS and REF CURSORS. CURSORS contain query results and metadata. A REF CURSOR (or CURSOR variable) data type contains a reference to a cursor. It can be passed between the RDBMS and the client, or between PL/SQL and Java in the database. It can also be returned from a query or a stored procedure.
Note:
REF CURSOR instances are not scrollable.
This section contains the following subsections:
6.3.1 Oracle REF CURSOR Type Category
To create a cursor variable, begin by identifying a type that belongs to the REF CURSOR category. For example:
dept_cv DeptCursorTyp
...
Then, create the cursor variable by declaring it to be of the type DeptCursorTyp:
Example 6-8 Declaring a REF CURSOR Type
DECLARE TYPE DeptCursorTyp IS REF CURSOR
REF CURSOR, then, is a category of data types, rather than a particular data type. Stored procedures can return cursor variables of the REF CURSOR category. This output is equivalent to a database cursor or a JDBC result set.
6.3.2 Accessing REF CURSOR Data
In Java, a REF CURSOR is materialized as a ResultSet object and can be accessed as follows:
Example 6-9 Accessing REF Cursor Data in Java
import oracle.jdbc.*;
...
CallableStatement cstmt;
ResultSet cursor; // Use a PL/SQL block to open the cursor
cstmt = conn.prepareCall
("begin open ? for select ename from emp; end;"); cstmt.registerOutParameter(1, OracleTypes.CURSOR);
cstmt.execute();
cursor = ((OracleCallableStatement)cstmt).getCursor(1); // Use the cursor like a normal ResultSet
while (cursor.next ())
{System.out.println (cursor.getString(1));}
In the preceding example:
A
CallableStatementobject is created by using theprepareCallmethod of the connection class.The callable statement implements a PL/SQL procedure that returns a
REF CURSOR.As always, the output parameter of the callable statement must be registered to define its type. Use the type code
OracleTypes.CURSORfor aREF CURSOR.The callable statement is run, returning the
REF CURSOR.The
CallableStatementobject is cast toOracleCallableStatementto use thegetCursormethod, which is an Oracle extension to the standard JDBC application programming interface (API), and returns theREF CURSORinto aResultSetobject.
6.3.3 Using REF CURSOR in the Sample Application
In the following sections, you enhance the sample application to display a dynamically-generated list of job IDs and job titles in the Job field when they are inserting a new employee record.
To do this, you create a database function, GET_JOBS, that uses a REF CURSOR to retrieve a result set of jobs from the Jobs table. A new Java method, getJobs, calls this database function to retrieve the result set.
6.3.3.1 Creating a Package in the Database
The following steps create a new package in the database to hold a REF CURSOR declaration.
Select the Connections tab to view it in the Navigator.
Expand the Database node, the DBConnection1 node, and the HR node, to view the list of database objects. Scroll down to Packages. Right-click Packages and select New PL/SQL Package.
In the Create PL/SQL Package dialog, enter
JOBSPKGas the name. Click OK. The package definition is displayed in the Source Editor.Position the cursor at the end of the first line and press Enter to create a new line. In the new line, declare a
REF CURSORas follows:TYPE ref_cursor IS REF CURSOR;
Save the package.
The code for the package is shown in Example 6-10:
Example 6-10 Creating a Package in the Database
PACKAGE "JOBSPKG" AS
TYPE ref_cursor IS REF CURSOR;
END;
6.3.3.2 Creating a Database Function
These steps create a database function GET_JOBS that uses a REF CURSOR to retrieve a result set of jobs from the Jobs table.
In the Connections Navigator, again expand the necessary nodes to view the objects in the
HRdatabase. Right-click Functions and select New PL/SQL Function from the shortcut menu.In the Create PL/SQL Function dialog, enter
GET_JOBSas the name. Click OK. The definition for theGET_JOBSfunction displays in the Source EditorIn the first line of the function definition, substitute
JobsPkg.ref_cursoras the return value, in place ofVARCHAR2.After the
ASkeyword, enter the following:jobs_cursor JobsPkg.ref_cursor;
In the
BEGINblock enter the following code to replace the current content:OPEN jobs_cursor FOR
SELECT job_id, job_title FROM jobs;
RETURN jobs_cursor;Save the function
The code for the function is shown in Example 6-11.
Example 6-11 Creating a Stored Function
FUNCTION "GET_JOBS"
RETURN JobsPkg.ref_cursor
AS jobs_cursor JobsPkg.ref_cursor;
BEGIN
OPEN jobs_cursor FOR
SELECT job_id, job_title FROM jobs;
RETURN jobs_cursor;
END;
6.3.3.3 Calling the REF CURSOR from a Method
These steps create a Java method, getJobs, in the DataHandler class that calls the GET_JOBS function to retrieve the result set.
Double-click
DataHandler.javato open it in the Source Editor if it is not already open.Enter the method declaration.
public ResultSet getJobs() throws SQLException { }Within the method body, connect to the database.
getDBConnection();
Following the connection, declare a new variable,
jobquery:String jobquery = "begin ? := get_jobs; end;";
Create a CallableStatement using the
prepareCallmethod:CallableStatement callStmt = conn.prepareCall(jobquery);
Register the type of the
OUTparameter, using an Oracle-specific type.callStmt.registerOutParameter(1, OracleTypes.CURSOR);
When you specify that you want to use an Oracle-specific type, JDeveloper displays a message asking you to use Alt+Enter to import
oracle.jdbc.OracleTypes. Press Alt+Enter, and then select OracleTypes (oracle.jdbc) from the list that appears.Run the statement and return the result set.
callStmt.execute();
rset = (ResultSet)callStmt.getObject(1);Enclose the code entered so far in a
tryblock.Add a catch block to catch any exceptions, and call your logException method as well.
catch ( SQLException ex ) {
logException( ex );
}After the close of the
catchblock, return the result set.return rset;
Make the file to check for syntax errors.
The code for the getJobs method is as follows:
public ResultSet getJobs() throws SQLException {
try {
getDBConnection();
String jobquery = "begin ? := get_jobs; end;";
CallableStatement callStmt = conn.prepareCall(jobquery);
callStmt.registerOutParameter(1, OracleTypes.CURSOR);
callStmt.execute();
rset = (ResultSet)callStmt.getObject(1);
} catch ( SQLException ex ) {
logException( ex );
}
return rset;
}
6.3.3.4 Displaying a Dynamically Generated List
To create the drop down list displaying the list of job IDs and job titles in the Insert page, you hard-coded the job IDs and job titles. In the following steps, you replace this with a dynamically-generated list provided by the REF CURSOR created in the previous section.
Double-click
insert.jspin the Application Navigator to open it in the Visual Editor, if it is not already open.Drag a Page Directive onto the page to the right of the
useBeantag. In the Insert Page Directive dialog box, enterJavaas the Language, and in the Import field, browse to select java.sql.ResultSet. Click OK.Drag a scriptlet onto the page next to the Page Directive. In the Insert Scriptlet dialog box, add the following code to execute the
getJobsmethod and return a result set containing a list of jobs.ResultSet rset = empsbean.getJobs();
Select the ListBox component in the page, and click Scriptlet in the JSP Component Palette. (You need not drag and drop the scriptlet onto the page in this case.) The Insert Scriptlet dialog box appears.
Enter the following code into the Insert Scriptlet dialog box. Click OK.
while (rset.next ())
{
out.println("<option value=" + rset.getString("job_id") + ">" +
rset.getString("job_title") + "</option> " );
}Remove the hard-coded values as follows.
With the ListBox component still selected, in the Structure window scroll to Job field. Examine the list of hard-coded options below the select keyword. Delete each of the options, ensuring that you retain the scriptlet.
Figure 6-3 Structure View of Dropdown ListBox Options

Description of "Figure 6-3 Structure View of Dropdown ListBox Options"Save the page.
Now run the application, click to insert a new employee and use the list to display a list of available jobs. Figure 6-4 shows the dynamic jobs list in the browser.
Enhancing the Application: Advanced JDBC Features(转)的更多相关文章
- Advanced redirection features
here are three types of I/O, which each have their own identifier, called a file descriptor: standar ...
- Spring Security(二十一):6.3 Advanced Web Features
6.3.1 Remember-Me Authentication (记住我的身份验证) See the separate Remember-Me chapter for information on ...
- # advanced packaging
目录 advanced packaging ASM NEXX ASMPT完成收購NEXX 準備就緒迎接先進半導體封裝之高速增長 Intro Bumping 产品供应 晶圆溅镀– Apollo 300 ...
- From MSI to WiX, Part 4 - Features and Components by Alex Shevchuk
Following content is directly reprinted from : http://blogs.technet.com/b/alexshev/archive/2008/08/2 ...
- SpringBoot2 application.properties方式加载配置文件
application.properties jdbc.driverClassName=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://127.0.0.1:33 ...
- mysql jdbc 官方编程示例
/* Basic example of an application using JDBC API of Connector/C++ */ /* Standard C++ includes */ #i ...
- arcgis andriod Edit features
来自:https://developers.arcgis.com/android/guide/edit-features.htm#ESRI_SECTION1_56C60DB71AF941E98668A ...
- Java性能提示(全)
http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLi ...
- Deployment options
Play applications can be deployed virtually anywhere: inside Servlet containers, as standalone serve ...
随机推荐
- openCV之头文件分析
我们利用openCV开源库进行项目开发时,往往要牵涉到头文件的添加问题,而openCV中头文件众多,该如何选择呢?下面对openCV2.4.10的头文件进行一个简单的梳理,以便能够快速的添加对应的头文 ...
- 怎样获取自己的SSL证书
2.创建证书,注意这里的common name应该填你的server name $ openssl req -new -key key.pem -out request.pem Country Nam ...
- cocos2d-x游戏开发 跑酷(四) 关联与物理世界
原创.转载注明出处http://blog.csdn.net/dawn_moon/article/details/21451077 前面一节尽管实现了一个跑动的人物,可是他只不过一个精灵在运行一个跑动的 ...
- 新出台的治理iMessage垃圾短信的规则
工信部拟制定<通信短信息服务管理规定>,为治理垃圾短信提供执法根据.当中,对于苹果iMessage垃圾信息泛滥现象,工信部也将跟踪研究技术监測和防范手段.这意味着长期以来处于监管" ...
- FZU2181+poj2942(点双连通+判奇圈)
分析:我们对于那些相互不憎恨的人连边,将每次参加会议的所有人(不一定是全部人,只需人数>=3且为奇数)看做一个点双联通分量,那么每个点都至少有两个点与他相邻.即需要保证双联通分量中存在奇圈.至于 ...
- POj 1879 Tempus et mobilius Time and motion (模拟+群)
题目特别长,大意为球的传递. 三个轨道,一个库.各自是分钟单位的轨道.5min单位的轨道.一小时单位的轨道.还有就是n容量的库. 每过一分钟,一个小球从库里面出来,库符合先进先出,进入分钟轨道.假设分 ...
- CC++刚開始学习的人编程教程(9) Windows8.1安装VS2013并捆绑QT与编程助手
我们在Windows8.1安装VS2013并捆绑QT与编程助手须要下列文件. 2. 在虚拟机中开启Windows8.1 3.然后选择VS2013的安装镜像. 4.将镜像拷贝到虚拟机. 5.我们装载这个 ...
- [WebGL入门]十,矩阵计算和外部库
注:文章译自http://wgld.org/,原作者杉本雅広(doxas),文章中假设有我的额外说明,我会加上[lufy:],另外,鄙人webgl研究还不够深入,一些专业词语,假设翻译有误,欢迎大家指 ...
- Object.wait()的使用方法示例(转)
本文节选自 Effective Java by Joshua Bloch 和 Concurrent Programming in Java by Doug Lea. 1.3 原子数据的同步 java语 ...
- Android_多媒体_SoundPool声音池使用
1.SoundPool概述 SoundPool就相当于一个简单的集合,可以将apk中的资源或者系统中的文件加载至内存中,使用了MediaPlayer服务区解码音频文件,用SoundPool可以播一些短 ...