Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*-
  * See the file LICENSE for redistribution information.
  *
  * Copyright (c) 2000, 2010 Oracle and/or its affiliates.  All rights reserved.
  *
  */
 
 package com.sleepycat.bind.serial;
 
A specialized ObjectInputStream that gets class description information from a ClassCatalog. It is used by SerialBinding.

This class is used instead of an java.io.ObjectInputStream, which it extends, to read an object stream written by the SerialOutput class. For reading objects from a database normally one of the serial binding classes is used. SerialInput is used when an java.io.ObjectInputStream is needed along with compact storage. A ClassCatalog must be supplied, however, to stored shared class descriptions.

Author(s):
Mark Hayes
See also:
Class Evolution
public class SerialInput extends ClassResolver.Stream {
    private ClassCatalog classCatalog;

    
Creates a serial input stream.

Parameters:
in is the input stream from which compact serialized objects will be read.
classCatalog is the catalog containing the class descriptions for the serialized objects.
    public SerialInput(InputStream inClassCatalog classCatalog)
        throws IOException {
        this(inclassCatalognull);
    }

    
Creates a serial input stream.

Parameters:
in is the input stream from which compact serialized objects will be read.
classCatalog is the catalog containing the class descriptions for the serialized objects.
classLoader is the class loader to use, or null if a default class loader should be used.
    public SerialInput(InputStream in,
                       ClassCatalog classCatalog,
                       ClassLoader classLoader)
        throws IOException {
        super(inclassLoader);
        this. = classCatalog;
    }
    @Override
        throws IOExceptionClassNotFoundException {
        try {
            byte len = readByte();
            byte[] id = new byte[len];
            readFully(id);
            return .getClassFormat(id);
        } catch (DatabaseException e) {
            /*
             * Do not throw IOException from here since ObjectOutputStream
             * will write the exception to the stream, which causes another
             * call here, etc.
             */
            throw RuntimeExceptionWrapper.wrapIfNeeded(e);
        }
    }
New to GrepCode? Check out our FAQ X