Java 38
Escaping Html : Apache Common lang3
Apache Common Lang library provides some Util classes for the developer. One of the mostly used util class is StringEscapeUtil. It has many methods for escaping html,xml,java etc. download apache common lang:- download apache common Project Structure:- Demo Data:- package com.sandeep.apache.common.data;/* * HtmlDataService.java * */public class HtmlDataService { public static String getHtmlString(){ return "Sandeep […]
Apache : PdfBox API
Apache PdfBox Api: Apache pdf-box library is an open source project. This library can be used for creating pdf,extracting text from pdf,bookmarking pdf etc. jar files required:- pdfbox-1.7.1.jar, fontbox-1.7.1.jar, commons-logging-1.1.1.jar . Apache Project Structure: PdfBox Demo java Program: package com.sandeep.pdfbox.demo;import java.io.IOException;import org.apache.pdfbox.exceptions.COSVisitorException;import org.apache.pdfbox.pdmodel.PDDocument;import org.apache.pdfbox.pdmodel.PDPage;import org.apache.pdfbox.pdmodel.edit.PDPageContentStream;import org.apache.pdfbox.pdmodel.font.PDFont;import org.apache.pdfbox.pdmodel.font.PDType1Font;public class PdfBoxDemo { /** * @param args […]
Java Logging
The java logging is present in java.util.logging package. The logging service is useful for developers, administrator and service engineers for their debugging work. Different levels of logging are:- SEVERE (highest value) WARNING INFO CONFIG FINE FINER FINEST (lowest value) Set up the Project :- 5. JavaHtmlLoggerFormatter.java This is a custom formater […]
Java : Null Pointer Exception
What is a Null Pointer Exception? Thrown when an application attempts to use null in a case where an object is required. These are the common scenarios where one can confront with a null pointer exception:- Obtaining the length of such object as an array which is null. Invoking an instance method of a object […]