Posts in "Code Base"

How to read a File using Scanner Class

Here we are discussing about reading the file using Scanner. To learn to read File using BufferedInputStream  Click Here. package JavaIOExample; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; /* * Here we will learn to read the file using Scanner. */ public class ReadTheFileUsingScanner { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter the… Continue reading

How to read a File using BufferedInputStream

Here we are discussing about reading the file using BufferedInputStream. To learn to read File using Scanner  Click Here. package JavaIOExample; import java.io.BufferedInputStream; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Scanner; /* * Here we will learn to read the file using BufferedInputStream. */ public class ReadTheFileUsingBufferedInputStream { @SuppressWarnings("deprecation") public static void… Continue reading

Create Excel file in java using PoI

package com.howto; import java.io.File; import java.io.FileOutputStream; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.apache.poi.hssf.usermodel.HSSFCellStyle; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; /* * Here we will learn how to create Excel file and header for the same. */ public class CreateExcelFile { int rownum = 0; HSSFSheet firstSheet; Collection<File> files; HSSFWorkbook workbook; File exactFile;… Continue reading

Read doc file in java using poi

package com.howto; import java.io.FileInputStream; import java.io.IOException; import org.apache.poi.hwpf.HWPFDocument; /* * Here we will learn how to read a Doc file */ public class ReadDocFile { public static void main(String args[]) throws IOException { /* * Create input stream of the doc file – Provide exact path of the doc * file to read */ FileInputStream… Continue reading