/*
* XAdES4j - A Java library for generation and verification of XAdES signatures.
* Copyright (C) 2011 Luis Goncalves.
*
* XAdES4j 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 3 of the License, or any later version.
*
* XAdES4j 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 XAdES4j. If not, see
* A signature can contain at most one reference of this type, as specified in * XML-DSIG. * * @author Luís */ public final class AnonymousDataObjectReference extends DataObjectDesc { private final InputStream dataStream; /** * Creates a new anonymous data object reference from a data stream. The stream * will be accessed at {@code ds:Reference} generation and won't be closed. * Additional information is added through the different methods in {@link DataObjectDesc}. * * @param dataStream the input stream used to get the object data * * @throws NullPointerException if {@code dataStream} is {@code null} */ public AnonymousDataObjectReference(InputStream dataStream) { if (null == dataStream) { throw new NullPointerException("Data stream cannot be null"); } this.dataStream = dataStream; } /** * Creates a new anonymous data object reference. Additional information is * added through the different methods in {@link DataObjectDesc}. * * @param data the object data * * @throws NullPointerException if {@code data} is {@code null} */ public AnonymousDataObjectReference(byte[] data) { this(new ByteArrayInputStream(data)); } InputStream getDataStream() { return dataStream; } }