Responsive Ad Area


Reading and Writing XML data files using Java

In this post I will show you how to read and write data types in simple xml file format using XML DOM. DOM means Document Object Model. We are mainly concerned here with reading and writing some data of the same types we have been working with in previous articles. So i.e. XML document can be more complex with other parts to parse. In this we have a document root which has as it children which has as its children has attributes which contain the data we want to store. But also text data can be stored if we use text </some data> notation. The way this works we load the entire xml file into xml DOM document object. The we use methods to access the nodes in the DOM Tree. If you do not understand this terminology then research data structures and tree structures. The name=value pair is c...

Reading and Writing Serialized Objects to a File

Reading and Writing Objects to files or streams is fairly straight forward. Here is a working example. There are a few things to know. Use serialver.exe to create a serial id number for the class. A class must implement Serializable interface and should use @serial tag in Javadoc comments. A cryptic coded file is created which is not very editable or readable. In a later article I will talk about serializing objects to xml streams and files.

Java Fixed Width Text files using row, col type storage.

This article demonstrates using a fixed field width | delimited text file similar to a spread sheet. You can store and retrieve various data types in give row,col cells. It expands columns if new data is longer than the cell. It does not add new columns or rows however and if you try to access columns or rows that are no there you get out of bounds errors. In the example I show a survey note book sheet that we use in mapping caves. A future version of this might calculate variables that would be used in cave mapping and add them to the sheet. This could also be used for mapping things above ground.

Reading and Writing Property Files using Java

I show you how to read and write your own property file which contains name=value pairs. Java comes with a Properties object to do this exact thing and I will write an article about that object later. Or expand this article to include an example. This article is another example of using a delimiter and in this case it is = symbol. Later I will upgrade this to include new line as delimiter to handle long strings.

Reading and Writing delimited files using Java

Here I show you how to read and write | delimited files. Each column is a field in a record. If you are writing simple applications or prototyping why use a full database? This can work just as well. I show you how to convert data types to strings and strings back to basic datatypes.

Reading and Writing files using Java

Simple examples for writing and reading to and from a text file line by line. Write, Read and Append. In Java we not only use FileWriter and FileReader but also BufferedWriter and BufferedReader to speed up reading and writing in just about all cases.

Java Phone Apps on Android

Java Phone Apps on Android Java was designed so that it should run on all phones. The founder of Apple computers who invented the IPhone rejected Java and said it was a slow and dead technology. He provided no support for Java on the IPhone. No phones would support Java if it were not for Google. Google has made a version of Linux which is Android OS and made up api's that support Java. By the way Google makes heavy use of Java technology within its systems. Google even hired one of the main Java guru's away from Sun. Java will run on a few brands of phones other than the Android I assume with some setup required. Java apps will also run on some tablets and specifically Android tablets. Java had a micro edition at one time for just such ventures, but at the time was for Personal Data Assis...

Java Web Sockets

Java Web Sockets Java web sockets is Java's alternative to Ajax. It is actually not specifically Java but an open standard called Web Sockets which is the HTTP alternative to Ajax. Java Web Sockets is Java's implementation of Web Sockets. Basically in HTTP and Common Gateway Interface (CGI) protocols there is much text based overhead in each server request and response messaging. Prior a hack was made to servers that was unofficial to get around this problem. They called it Ajax. It was made official with Web Sockets. The jest of it is that now once the web socket is made your web page and Javascript code can make very concise request with as few characters as possible of the server and get back a very concise response. This reduces bandwidth and speeds communications and reduces lag consi...

Java Facelets and Java Server Faces

Java Facelets and Java Server Faces So Java JSP is awesome and we need no more right? Wrong, JSP is great, but it is a very cryptic way to describe things. Also routine work on web type applications developed into repetitive design and coding task. This was turned into what is called web frameworks. Jakarta Struts is a 3rd party api for such a framework. Sun felt it was time to create a framework for distribution with the standard and extended api's. Facelets and Java Server Faces was born. Faclets and JSF is built on top of the existing servlet technology. A facelet page is based on specialized facelet codes which are "interpreted" by a Java Facelet servlet. Java Server Faces is the framework that uses this facelet language. This gives the developer quick and easy access to common task us...

Java Servlets and Java Server Pages

Java Servlets and Java Server Pages Well first maybe I should explain a bit about the first actual web applications called CGI's. CGI(Common Gateway Interface) is a protocol or language for formatting request and responses from an http server to and http client. On this web site the server is the Java web server Apache Tomcat 5.5. A client would be any web browser typically. Initially a web server would send a request in CGI format to standard output on the server, at the same time calling a program on the server to startup. This program can be written in any programming language which can get standard input and output to standard output (practically any language, and even shell scripts). So the server sends the request to standard output which is read as standard input by the program. It ...

Java Applets and Webstart

Java Applets and Webstart Java Applets Java applets are mini-applications which run within another application. Applets actually could be run as a desktop application with Java's appletviewer.exe program. And actually, that may be the only way to make an applet run at the current day and time. Well, a better way to run an applet is to convert it to Web Start application which I talk about later on in this article. Java applets were quit the rage when Java first appeared on the scene. Applets are primarily run on a web page. However over time they lost popularity. Reasons for this might include applets being to startup. Another was applets not starting up at all which usually had a fix but was frustrating enough from the end user point of view to cause a loss in popularity. Applets may have...

Java Daemons and Servers

Java Daemons and Servers A server is a daemon but a daemon is not necessarily a server? I think so. I think all a daemon is, is a process that runs in the background, meaning no user interface. You start it up, it hides, runs and does it thing. A server does the same thing but accepts connections from clients which request it to do things for them. The server then does as requested if it can and responds to the client with details, data or files. A server's user interface is the client itself though actually they can have admin user interfaces that are web or GUI based. They usually do not have user interfaces but are simply configured, started and stopped. If a java daemon(server) is started then in a process list you will see the java VM instead of the actual Java class name. If more tha...

  • 1
  • 2