All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jmrtd.lds.AbstractLDSInfo Maven / Gradle / Ivy

There is a newer version: 0.8.1
Show newest version
/*
 * JMRTD - A Java API for accessing machine readable travel documents.
 *
 * Copyright (C) 2006 - 2013  The JMRTD team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 *
 * $Id: AbstractLDSInfo.java 1552 2014-09-13 17:42:26Z martijno $
 */

package org.jmrtd.lds;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;

/**
 * Base class for data structures that are contained in files in the LDS. 
 * 
 * @author The JMRTD team ([email protected])
 *
 * @version $Revision: 1552 $
 */
abstract class AbstractLDSInfo implements LDSElement {

	private static final long serialVersionUID = -2340098256249194537L;

	public byte[] getEncoded() {
		try {
			ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
			writeObject(outputStream);
			outputStream.flush();
			return outputStream.toByteArray();
		} catch (IOException ioe) {
			ioe.printStackTrace();
			return null;
		}
	}

	abstract void writeObject(OutputStream outputStream) throws IOException;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy