Object Serialization for Programming Language Technology and Paradigms | CMSC 433, Study notes of Programming Languages

Material Type: Notes; Professor: Pugh; Class: PROG LANG TECH & PDGMS; Subject: Computer Science; University: University of Maryland; Term: Fall 2005;

Typology: Study notes

Pre 2010

Uploaded on 07/30/2009

koofers-user-4dj
koofers-user-4dj 🇺🇸

10 documents

1 / 12

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Object Serialization
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Object Serialization for Programming Language Technology and Paradigms | CMSC 433 and more Study notes Programming Languages in PDF only on Docsity!

Object Serialization

Say you have a bunch of data

  • That you want to:
    • Save to a file, or
    • Send over a tcp connection
  • What are your options

Structured data

  • What if you want to send structured data? - E.g., a HashMap from Strings to integers
  • Or even more complicated stuff
    • A sequence of commands to an IMAP server
    • A graph

Options

  • Develop a text based format
    • Designed for human readability
    • Designed for machine readability (e.g., XML)
  • Some binary format
    • Custom, or
    • VM / library generated

Java object serialization

  • You can decorate any OutputStream with an ObjectOutputStream - Allows you to write ints, floats, longs, … - And (Serializable) Objects
  • Decorate an InputStream with an ObjectInputStream to read it in

Many things are serializable

  • Strings, Integers, most collections
    • Although a collection can only be serialized if the things contained in the collection are serializable
  • You can make your own classes serializable

Cycles

Graphs and cycles are

handled

  • Object serialization handles graphs and cycles - When reconstructed, object graph is isomorphic to original