serialize « nio « Java I/O Q&A

1. Java - ReadObject with nio

In a traditional blocking-thread server, I would do something like this

class ServerSideThread {

    ObjectInputStream in;
    ObjectOutputStream out;
    Engine engine;


2. Serialize object with nio

I notice that oos.writeObject(aObject) is slow. What should I do to get better performance? What I want to do is to serialize an object to a byte array and store this byte array to a table. I know the java.nio package helps to increase i/o performance, but I could not find any sample code doing this. How do I replace stream ...

3. Serialization with Nio

You're kind of grasping at two different straws there. Serialization is what we use to persist objects (examples in the tutorial here). The "New IO" (To JDK 1.4, anyway) gave Java some capabilities that didn't exist in the API before, like file locking, direct memory access, memory mapped files and so on (Top Ten New Things You Can Do With New ...

4. Serialize with Java NIO

I am new to Java and have been trying to serialize objects to a file using ObjectInputStream and ObjectOutputStream. As a requirement, I am adding image files about 1MB as byte[] since an Image is not serializable. Once I deserialize the byte[], I convert it to BufferedImage so that I can process it such as subimages and so forth. I am ...