org.apache.xml.security.encryption.Serializer Maven / Gradle / Ivy
The newest version!
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.xml.security.encryption;
import org.apache.xml.security.c14n.Canonicalizer;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* Converts String
s into Node
s and visa versa.
*/
public interface Serializer {
/**
* Set the Canonicalizer object to use.
*/
void setCanonicalizer(Canonicalizer canon);
/**
* Returns a String
representation of the specified
* Element
.
*
* @param element the Element
to serialize.
* @return the String
representation of the serilaized
* Element
.
* @throws Exception
*/
@Deprecated
String serialize(Element element) throws Exception;
/**
* Returns a byte[]
representation of the specified
* Element
.
*
* @param element the Element
to serialize.
* @return the byte[]
representation of the serilaized
* Element
.
* @throws Exception
*/
byte[] serializeToByteArray(Element element) throws Exception;
/**
* Returns a String
representation of the specified
* NodeList
.
*
* @param content the NodeList
to serialize.
* @return the String
representation of the serialized
* NodeList
.
* @throws Exception
*/
@Deprecated
String serialize(NodeList content) throws Exception;
/**
* Returns a byte[]
representation of the specified
* NodeList
.
*
* @param content the NodeList
to serialize.
* @return the byte[]
representation of the serialized
* NodeList
.
* @throws Exception
*/
byte[] serializeToByteArray(NodeList content) throws Exception;
/**
* Use the Canonicalizer to serialize the node
* @param node
* @return the canonicalization of the node
* @throws Exception
*/
@Deprecated
String canonSerialize(Node node) throws Exception;
/**
* Use the Canonicalizer to serialize the node
* @param node
* @return the (byte[]) canonicalization of the node
* @throws Exception
*/
byte[] canonSerializeToByteArray(Node node) throws Exception;
/**
* @param source
* @param ctx
* @return the Node resulting from the parse of the source
* @throws XMLEncryptionException
*/
@Deprecated
Node deserialize(String source, Node ctx) throws XMLEncryptionException;
/**
* @param source
* @param ctx
* @return the Node resulting from the parse of the source
* @throws XMLEncryptionException
*/
Node deserialize(byte[] source, Node ctx) throws XMLEncryptionException;
}