FileDocCategorySizeDatePackage
DataAccessHelper.javaAPI DocExample1445Wed May 04 06:17:12 BST 2005com.samscdrental.dataaccess

DataAccessHelper

public class DataAccessHelper extends Object

Title: Sams CD Rental Store

Description:

Copyright: Copyright (c) 2004

Company:

author
Ken Pugh
version
1.0

Fields Summary
private static final String
ERROR_CREATING_OBJECT_STREAM
private static final String
ERROR_STREAM_NOT_COLLECTION
Constructors Summary
Methods Summary
public static java.lang.ObjectreadObjectFromOpenStream(java.lang.Class expectedClass, java.io.ObjectInputStream input)

		Object anObject = null;
		try
		{
			anObject = input.readObject();
			if ( !anObject.getClass().equals( expectedClass ) )
			{
				throw new ClassNotFoundException();
			}
		}

		catch ( IOException exception )
		{
			throw new SeriousErrorException(
				ERROR_CREATING_OBJECT_STREAM, exception );
		}
		catch ( ClassNotFoundException exception )
		{
			throw new SeriousErrorException(
				ERROR_STREAM_NOT_COLLECTION, exception );
		}

		return anObject;

	
public static voidwriteObjectToOpenStream(java.lang.Object anObject, java.io.ObjectOutputStream output)


		try
		{
			output.writeObject( anObject );
		}
		catch ( IOException exception )
		{
			throw new SeriousErrorException(
				ERROR_CREATING_OBJECT_STREAM, exception );
		}

		return;