Chapter 5: Java IO and NIO

image from book Download CD Content

Introduction

Reading from and writing to a stream of data is essential to every game. Streams have been part of Java since it was introduced. Over the years, the standard IO package (java.io) has matured and a new IO package (java.nio) has been introduced to meet the demand for an efficient and high-performance IO API. In this chapter, we will discuss the java.io and java.nio packages. More specifically, we will discuss streams and the new IO-related objects such as Channels and ByteBuffers. This chapter also covers the process of storing and restoring the state of Java objects, known as serialization. We will also provide benchmarks that compare the different IO approaches in Java as well as native IO. Native IO refers to IO performed in a native language, such as C or C++. We will show how you can achieve IO performance that is up to par with native IO.



Practical Java Game Programming
Practical Java Game Programming (Charles River Media Game Development)
ISBN: 1584503262
EAN: 2147483647
Year: 2003
Pages: 171

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net