- 授权协议: LGPL
- 开发语言: Java
- 操作系统: Linux
- 软件首页: http://code.google.com/p/juds
软件介绍
Java Unix Domain Sockets (JUDS) 提供了 Java 的方法用来访问 Unix domain sockets 套接字。
示例代码:
package com.google.code.juds.test;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import com.google.code.juds.*;
public class TestUnixDomainSocket {
public static void main(String[] args) throws IOException {
if (args.length != 1) {
System.out
.println("usage: java TestUnixDomainSocket socketfilename");
System.exit(1);
}
String socketFile = args[0];
byte[] b = new byte[128];
// Testcase 1.1: Test UnixDomainSocketClient with a stream socket
UnixDomainSocketClient socket = new UnixDomainSocketClient(socketFile,
UnixDomainSocket.SOCK_STREAM);
InputStream in = socket.getInputStream();
OutputStream out = socket.getOutputStream();
in.read(b);
System.out.println("Text received: \"" + new String(b) + "\"");
String text = "[2] Hello! I'm the client!";
out.write(text.getBytes());
System.out.println("Text sent: " + "\"" + text + "\"");
socket.close();
// Testcase 1.2: Test UnixDomainSocketClient with a datagram socket
socket = new UnixDomainSocketClient(socketFile,
UnixDomainSocket.SOCK_DGRAM);
System.out.println("Provoke and catch an "
+ "UnsupportedOperationException:");
try {
in = socket.getInputStream();
} catch (UnsupportedOperationException e) {
System.out.println("UnsupportedOperationException has been "
+ "thrown as expected.");
}
out = socket.getOutputStream();
text = "[3] Hello! I'm the client!";
out.write(text.getBytes());
System.out.println("Text sent: \"" + text + "\"");
socket.close();
// Testcase 2.1: Test UnixDomainSocketServer with a stream socket
System.out.println("\nTest #2: Test UnixDomainSocketServer\nTestcase "
+ "2.1: Test UnixDomainSocketServer with a stream socket...");
UnixDomainSocketServer ssocket = new UnixDomainSocketServer(socketFile,
UnixDomainSocket.SOCK_STREAM);
in = ssocket.getInputStream();
out = ssocket.getOutputStream();
in.read(b);
System.out.println("Text received: \"" + new String(b) + "\"");
text = "[5] Hello! I'm the server!";
out.write(text.getBytes());
System.out.println("Text sent: " + "\"" + text + "\"");
ssocket.close();
ssocket.unlink();
// Testcase 2.2: Test UnixDomainSocketServer with a datagram socket
System.out.println("Testcase 2.2: Test UnixDomainSocketServer with "
+ "a datagram socket...");
ssocket = new UnixDomainSocketServer(socketFile,
UnixDomainSocket.SOCK_DGRAM);
System.out.println("Provoke and catch an "
+ "UnsupportedOperationException:");
in = ssocket.getInputStream();
try {
out = ssocket.getOutputStream();
} catch (UnsupportedOperationException e) {
System.out.println("UnsupportedOperationException has been "
+ "thrown as expected.");
}
in.read(b);
System.out.println("Text received: \"" + new String(b) + "\"");
ssocket.close();
ssocket.unlink();
}
}
形式感+:网页视觉设计创意拓展与快速表现
晋小彦 / 清华大学出版社 / 2014-1-1 / 59.00元
网页设计师从早年的综合性工作中分化出来,形成了相对独立的专业岗位,网页设计也不再是单纯的软件应用,它衍生出了许多独立的研究方向,当网站策划、交互体验都逐渐独立之后,形式感的突破和表现成为网页视觉设计的一项重要工作。随着时代的发展,网页设计更接近于一门艺术。网络带宽和硬件的发展为网页提供了使用更大图片、动画甚至视频的权利,而这些也为视觉设计师提供了更多表现的空间。另外多终端用户屏幕(主要是各种移动设......一起来看看 《形式感+:网页视觉设计创意拓展与快速表现》 这本书的介绍吧!
