search
HomeJavaJavaBasewhat is serialization in java

what is serialization in java

Nov 11, 2019 pm 04:46 PM
javaSerialization

what is serialization in java

What is serialization

Serialization is a mechanism used to process object streams, the so-called object stream That is, streaming the content of the object. The streamed objects can be read and written, and the streamed objects can also be transmitted between networks. Serialization is to solve the problems caused when reading and writing object streams.

Implementation of serialization

The class that needs to be serialized implements the Serializable interface. This interface has no methods that need to be implemented. Implements Serializable is just to mark that the object can be is serialized, and then use an output stream to construct an ObjectOutputStream (object stream) object. Then, use the writeObject(Object obj) method of the ObjectOutputStream object to write out the object with the parameter obj (that is, save its state). To restore, use the input stream.

Concept

Serialization: The process of converting Java objects into byte sequences.

Deserialization: The process of restoring a byte sequence into a Java object.

Purpose

1. Permanently save the byte sequence of the object to the hard disk, usually in a file;

2. A sequence of bytes for an object sent over the network.

Recommended tutorial: Java tutorial

The above is the detailed content of what is serialization in java. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft