core java
-
zip
Calculate CRC-32 checksum of zip entry
With this example we are going to demonstrate how to calculate the CRC-32 checksum of a ZipEntry. In short, to…
Read More » -
zip
Get zip entry compression method
This is an example of how to get the ZipEntry Compression method. The compression method of a ZipEntry can be…
Read More » -
zip
Calculate CRC32 checksum for byte array
In this example we shall show you how to calculate the CRC32 Checksum of a byte array. To calculate the…
Read More » -
zip
Compress Objects example
With this example we are going to demonstrate how to compress and expand an Object. We have implemented the ObjectCompressionUtil…
Read More » -
zip
Compress – Decompress files example
This is an example of how to zip and unzip a file. We have implemented the FileCompressionUtil class, that consists…
Read More » -
concurrent
CountDownLatch example of a more general wait/notify mechanism
In this example we shall show you how to create a CountDownLatch of a more general wait/notify mechanism. We have…
Read More » -
concurrent
Synchronous Queue example to execute commands
private BlockingQueue workQueue = new LinkedBlockingQueue(); private Map commandQueueMap = new ConcurrentHashMap(); public SynchronousQueue addCommand(Command command) { SynchronousQueue queue =…
Read More » -
concurrent
Blocking Queue example of limited connection pool
private BlockingQueue<Connection> pool = new ArrayBlockingQueue<Connection>(10); private AtomicInteger connCount = new AtomicInteger(); public Connection getConnection() { Connection conn = pool.poll(5,…
Read More » -
concurrent
Blocking Queue example to execute commands
import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; private BlockingQueue<Command> workQueue = new LinkedBlockingQueue<Command>(); public void addCommand(Command command) { workQueue.offer(command); } public Object call()…
Read More » -
concurrent
Reentrant Lock example of a task runner
With this example we are going to demonstrate how to implement a ReentrantLock of a task runner. The ReentrantLock is…
Read More »