We many times come across this situation where we want to create or edit excel files in java, although there are many open source libraries available out there which allows us to create or edit excel files in java but the most stable among them which I think is Apache Poi. Apache Poi library allows creation and editing of excel files. This library supports traditional 2003 format and 2007 format also.
Apache Poi library supports excel macros, cell customization(cell color, text color, cell background color) and much more.
Although Poi supports both xls and xlsx files, xls files are manipulated smoothly but xlsx file manipulating requires much more RAM and time for processing than that of xls.
Poi has two classes HSSFWorkbook for xls files and XSSFWorkbook for xlsx files, both implements to Workbook interface. You can create multiple workbook sheets.
In next post I will show how to use Apache Poi API to manipulate excel files.
AES stands for Advanced Encryption Standard. AES is an Symmetric Key Algorithm, that means key used for encrypting the data, same key will be used for decryption of the encrypted data. This algorithm supplants DES algorithm. This post shows how to use AES algorithm in Java to encrypt and decrypt data. Encrypting Data- import java.security.GeneralSecurityException; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; public class AESTest1 { public static void main(String[] args) throws GeneralSecurityException { KeyGenerator keyGenerator = KeyGenerator.getInstance("AES"); keyGenerator.init(128); SecretKey key = keyGenerator.generateKey(); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, key); byte encryptedData[] = cipher.doFinal(args[0].getBytes()); } } In above example we have used KeyGenerator class, which generates key for encrypting data, as we are using...
Comments
Post a Comment