Plein de choses interressantes dans le livre “Killer Game Programming in Java”. Des extraits de chapitres et de codes: http://fivedots.coe.psu.ac.th/~ad/jg/index.html.
http://filthyrichclients.org/ Le bouquin de Romain Guy & Chet Haase. In Filthy Rich Clients, we explain how to create filthy rich effects in your applications, from the fundamental graphics, GUI, and animation technology up through sample code and algorithms for the effects themselves. Des exemples de code.
http://ostermiller.org/convert_java_outputstream_inputstream.html
Method 1: Buffer the data using a byte array
ByteArrayOutputStream out = new ByteArrayOutputStream(); class1.putDataOnOutputStream(out); class2.processDataFromInputStream( new ByteArrayInputStream(out.toByteArray()) );
Method 2: Use pipes
PipedInputStream in = new PipedInputStream(); PipedOutputStream out = new PipedOutputStream(in); new Thread( new Runnable(){ public void run(){ class1.putDataOnOutputStream(out); } } ).start(); class2.processDataFromInputStream(in);
Method 3: Use Circular Buffers
// Multiple Threaded Example of a Circular Buffer CircularByteBuffer cbb = new CircularByteBuffer(); new Thread( new Runnable(){ public void run(){ class1.putDataOnOutputStream(cbb.getOutputStream()); } } ).start(); class2.processDataFromInputStream(cbb.getInputStream());
// Single Threaded Example of a Circular Buffer // buffer all data in a circular buffer of infinite size CircularByteBuffer cbb = new CircularByteBuffer(CircularByteBuffer.INFINITE_SIZE); class1.putDataOnOutputStream(cbb.getOutputStream()); class2.processDataFromInputStream(cbb.getInputStream());