Java Util Examples List part-III (data structures in java)

41. Listing the Main Attributes in a JAR File Manifest
Jar Manifest file is the main section of a jar file. This file contains the detailed information about the specific individual jar file. It contains the complete information about the jar file, each and every section or particular information is separated by new line.

42. Creating a ZIP File
Zip file format is the popular method of data compression. Zip file contains many files in compressed format. You can say the files are stored in the zip format with compression. The file which is in the zip format holds the “.zip” extension.

43. Listing the Contents of a ZIP File
Section, provides the way for listing all the elements of a zip file through the java code. Following program helps you for the appropriate. You can directly copy and paste the code in your java application for showing list of elements present in the zip file format.

44. Retrieving a Compressed File from a ZIP File
How to unzip (extract) a zip file? How to retrieve elements from a zip format file? All these type of questions are solved through the following example.

45. The Java Logging Program

This section introduce you about Java logging and how to use the logger in Java program to log the error and messages into the log file. Explanation of java logging is explained in the given example program.

46. Logging an Exception
This section introduces you the concept of logging exception handling. When certain conditions are not followed or wrong then compiler shows a message which is mentioned under the specific exception.

47. Preventing a Logger from Forwarding Log Records to Its Parent
This section describes how to forward log records to its parent. You know that a logger sends both log records (messages declared before setting the log for it’s parent and log messages after setting for it’s parent) to handlers, parent or ancestor.

48. Writing Log Records to a Log File

This section demonstrates for writing log records to a log file. Logger provides different types of level like: warning, info and severe that have log records.

49. Writing Log Records to Standard Error

This section demonstrates how to write log records to standard error in Java. Java provides the facility for handling an error through the help of ConsoleHandler class.

50. Writing Log Records Only After a Condition Occurs
This section deals with log records those have been written in a log file if the “if” conditions are certified otherwise not.

51. Setting a Filter on a Logger Handler
This section illustrates you how to set filter on a logger handler in Java. Generally, Filter is a program that provides the facility to get data if the certain conditions are satisfied otherwise don’t get any data. In other words, you get data to be filtered.

52. What is Logging Level
Logger: Logger is the class of java.util.logging package that extends the Object class. Java provides logging APIs like: Logger, Level, Handler etc. for implementing logging features in your java application.

53. Getting the Log Level of a Logger
This section helps you to learn about the getting log level of a logger through the java program and illustrates how to get it. The Logger provides various types of levels of a logger like: INFO, WARNING, SEVERE and FINEST etc.

54. Comparing Log Levels
This section describes, how to compare log levels to each other. In Java, the Level class assigns a set of multiple logging levels that has already an individual integer type value.

55. Creating a Custom Log Level
This section tells you how to create a custom log level that means log levels are created by users for own need. Java logging class provides some levels like: INFO, WARNING, SEVERE, FINEST etc.

56. Setting the Formatter of a Logger Handler
This section discussed how to set the formatter of a logger handler. Java provides a logger handler that uses a formatter for writing log records for a log file that can be either xml file or other.

57. Creating a Custom Formatter for a Logger Handler
This section tells you how to create a custom formatter for a logger handler. Java provides two types formatter SimpleFormatter and XMLFormatter. But, the java logging package allows for creating a custom formatter through the logger handler.

58. Limiting the Size of a Log File
This section illustrates you how to limit the size of a log file in Java. Log files haven’t any boundation at the file creation time but Java provides the facility for limiting the size of a log file with the help of FileHandler.

59. Regular Expression Search Program
Regular Expression is used to perform many string related operations. This is the way to manipulate different kind of operations like search, edit and manipulating string can be performed by the regular expression. It has both type characters (literal characters and meta characters).

60. Applying Regular Expressions on the Contents of a File

This section illustrates you how to search a string in a file content. Following takes the file name from which the given string/text has to be searched. File name must be text file (with “.txt” extension).

Leave a Reply

You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <blockquote cite=""> <code> <em> <strong>