Unzip or decompress files in java using ZipInputStream & ZipEntry (example)

Given a zipped or compressed file in java. Write a program to unzip or decompress the contents of zip file using ZipInputStream in java. Zip file may contain nested directory structure. e.g. Zip file may have compressed files having following directory structure. FirstFile.txt SecondFile.txt Dir1\Dir1_F1.txt Dir1\Dir1_F2.txt Dir1\Dir11\Dir11_F1.txt Dir1\Dir11\Dir11_F2.txt ….. Read the content of zip files… Read More »

Generate UUID or GUID from String in java (with example)

Given an string representing unique identifier. We would like to convert string to corresponding universal unique identifier (UUID) or Globally unique identifier (GUID). We will use java.util.UUID class to create UUID or GUID from string. e.g UUID generateUUID = UUID.fromString(inputUUID) Program: generate UUID or GUID from String in java package org.learn.uuid; import java.util.UUID; public class GenerateUUIDFromString {… Read More »

Generate unique identifier or UUID or GUID in java (with example)

Universal unique identifier (UUID) or Globally unique identifier (GUID) is unique identifier (or Id). GUID represents the unique id(s). Typically UUID is used in following scenarios: UUID is used as a primary key in database Window’s registry is using GUID (or UUID) to uniquely identify (installed) resources. GUID is also used to generate unique name… Read More »

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 »

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