Basic File Manipulation With Java
Java Configuration File API
This is a simple Java Configuration file API. It provides methods for reading key-value pairs from a file. The main benefit over using Java's standard Properties class is support for nested array configuration values. This implementation is inspired by, but somewhat more basic than libconfig, a very useful C/C++ Configuration File Library.
How to Create File and Directory
In this Java File Tutorial we will basics of File and Directory in Java, How to Create File and Directory in Java, Utility methods provided by File API and Common Exception or Error you will face during File and Directory Creation or access time. Creating File is different than creating Thread in java as you don't have to implement any interface for making a Class as File in Java.
String Manipulation: The String Class
String manipulation forms the basis of many algorithms and utilities such as text analysis, input validation, and file conversion. This tutorial explores some of the needed basics. Unless otherwise noted, the following classes are contained in the java.lang library.
Primitive types are the most basic data types available within the Java language; these include boolean, byte, char, short, int, long, float and double. These types serve as the building blocks of data manipulation in Java. Such types serve only one purpose — containing pure, simple values of a kind. Because these data types are defined into the Java type system by default, they come with a number of operations predefined. You can not define a new operation for such primitive types. In the Java type system, there are three further categories of primitives:
2 solution of java.lang.OutOfMemoryError in Java
Every one in java development face java.lang.OutOfMemoryError now and then, OutOfMemoryError in Java is one problem which is more due to system's limitation (memory) rather than due to programming mistakes in most cases though in certain cases you could have memory leak which causing OutOfMemoryError. I have found that even though java.lang.OutOfMemoryError is quite common basic knowledge of its cause and solution is largely unknown among junior developers. In this article we will explore what is java.lang.OutOfMemoryError; Why OutOfMemoryError comes in Java application, different type of OutOfMemoryError and How to fix OutOfMemoryError in Java. This article is purely meant to provide basic knowledge of java.lang.OutMemoryError and won't discuss profiling in detail.
How to make hidden files in Java Program with Example
we will see how to hide file in Java or make hidden file in Java. As we said File API in Java doesn’t provide any method to make a file hidden in Java but still you can apply some quick tricks to hide files from Java program. Like in Unix environment any file whose names begin with dot (.) is hidden so you can name your file starting with dot (.) and your File will be hidden in Linux or Unix Environment.
How to read XML file in Java – (DOM Parser)
Here’s an example to show you how to read a XML file in Java via DOM XML parser. The DOM interface is the easiest XML parser to understand, and use. It parses an entire XML document and load it into memory, modeling it with Object for easy traversal or manipulation.
File Handling in Java
A look at the file handling methods that Java provides, and an introduction to the complex I/O system that comes packaged in java.io. Read This Useful Java Tutorial
What is an Abstract Class and Abstract Method
Couple of days back I wrote an article on basic Java Fundamental on What is an Interface in Java and How it’s used? This tutorial is also related to basic Java fundamental “Abstract Class and Abstract Method“. “What is an Abstract Class?” – This is very basic Java Interview Question. Probably the 1st Java Interview Question you get during interview.
How to resolve java.lang.ClassNotFoundException
In this java tutorial we will see what is ClassNotFoundException in java, what is real cause of it and how to fix it along with some more frequent and infamous examples of java.lang.ClassNotFoundException in Java or J2EE, Don’t mistake this exception with NoClassDefFoundError in Java which is also due to incorrect classpath in Java. Though both of them are related to missing class file when Java tries to load class in Java they are completely different to each other. Correct understanding of When class is loaded in Java and How Classpath works is must to troubleshoot and fix this error quickly.
How to get size of a file in mb in java ?
File in java is an abstract representation of files and directory pathnames. Java IO package in java provides a number of functionality related to file processing. Apache Commons IO also has a similar class FileUtils related to file processing. This class also has number of methods which helps in making file processing easy. In this article we will discuss how to calculate file size using both File class from java.io package and FileUtils class from apache.commons.io package.
How to read and write in text file
Reading and writing from file in Java is very simple once you are familiar with readers, streams, input stream and output stream in Java. code example and explanation of how to read from file in java.
Java File I/O Basics
Java 7 introduced the java.nio.file package to provide comprehensive support for file I/O. Besides a lot of other functionality this package includes the Files class (if you already use this class you can stop reading here). Files contains a lot of static methods that can be used to accomplish common tasks when working with files. Unfortunately it looks to me that still a lot of newer (Java 7+) code is written using old (pre Java 7) ways of working with files. This does not have to be bad, but it can make things more complex than needed.
To aid programmer productivity, the Java Standard Edition (JSE) includes several predefined class packages (aka Java class libraries). Packages/libraries discussed in this set of tutorials are: applets java.applet, language extensions java.lang, utilities java.util, precision math java.math, formatters java.text, file streams java.io, GUIs java.awt and javax.swing, network services java.net, new io (ie. memory mapped) java.nio and remote method invocation java.rmi. Other libraries include beans java.beans, communication ports java.comm, database management java.sql and security java.security. The import reserved word is used to access classes from the libraries (except for java.lang). Unless another library is indicated the following classes are contained in the java.lang package.
How to check permissions on File and Directory
In this article we will learn how to check whether file is read only , whether file has write permission or not etc. In Java we know we have file object to deal with Files if we have created any file in our application using the file object , we have the privilege to check the access permission of that file using simple method of File class in Java.
Creating Java Servlets With NetBeans
Learn to create Java servlets in the NetBeans IDE. The tutorial creates a basic mailing list and explores file access along with some DOM XML. Also covered is deploying the servlets with Glassfish.
String split example
I don't know how many times I need to Split String in Java. Split is very common operation given various data sources e.g CSV file which contains input string in form of large String separated by comma. Splitting is necessary and Java API has great support for it. Java provides two convenience methods to split strings first within the java.lang.String class itself: split (regex) and other in java.util.StringTokenizer. Both are capable to split the string by any delimiter provided to them. Since String is final in Java every split-ed String is a new String in Java.
MySQL and Java DB
So, finally, more on Java DB-- It’s the Sun-supported version of Apache Derby with all development done with the Apache Derby community. It’s a complete relational database engine, written in 100% Java with a small footprint of 2MB of a JAR file. It runs on Java EE, and Java SE and more. It has a multi-tiered design for different use cases.
How to use Memory Mapped File
Memory Mapped File in Java are special files which allows java program to read and write directly to memory which is extremely fast compare to stream based IO and allows programmer to code high performance java application.
How to serialize an object in Java
Java provides its developers with a rich set of APIs for object serialization. In this article we will look into some of the intricacies of object serialization in Java. We shall start with the most basic example of how to serialize an object in Java; here are the high level steps: