Generate/create random GUID or UUID in java (JUG library/example)

Generate guid or uuid using RandomBasedGenerator class of Java UUID Generator (JUG) library. In current post, we will generate random uuid using JUG library. Generate random UUID using RandomBasedGenerator class in java. Generate custom random UUID using input random number in java. 1. Maven dependency of JUG library <dependency> <groupId>com.fasterxml.uuid</groupId> <artifactId>java-uuid-generator</artifactId> <version>3.1.3</version> </dependency> 2. Generate or… Read More »

Time based uuid generator in java (JUG library / example)

Generate time based uuid in java using JUG (Java Uuid Generator) library. JUG library provides couple of generator viz TimeBasedGenerator & RandomBasedGenerator. In current post, we will demonstrate TimeBasedGenerator of JUG library. Generate time based UUID using TimeBasedGenerator Get the timestamp of generated UUID. Generate custom UUID using network interface. Maven dependency of JUG library <dependency> <groupId>com.fasterxml.uuid</groupId> <artifactId>java-uuid-generator</artifactId> <version>3.1.3</version>… Read More »

List or display contents of compressed or zipped file in java (example)

Given a zipped or compressed file in java. We would like to display or list the contents of zipped file. We will display the name and size of uncompressed files. Program – list or display contents of zipped /compressed file in java package org.learn; import; import java.util.Enumeration; import; import; public class DisplayZipContents {… Read More »

Create compress /zip file in java (ZipOutputStream class /example)

Given the input files in java, create zip or compress files using ZipOutputStream class . Java framework has provided couple of classes to create a zip & compress file. ZipOutputStream: ZipOutputStream class implements an output stream filter for writing files in ZIP file format. ZipEntry: ZipEntry class represents a ZIP file entry. e.g. If we want to… Read More »

Write or redirect standard output error stream to a file in java

We write error of an application(s) to standard error stream using System.err.print*. System.err.println(“1. Write error to a file”); We would like to redirect the application errors to a file.  e.g. System.err.println(“1. Write error to a file”) should be written to a file. We would like to set output stream, so that all errors will be… Read More »

Page 4 of 42« First...23456...102030...Last »