com.sap.cloud.security.ams.dcl.client.dcn.DcnTools Maven / Gradle / Ivy
The newest version!
/************************************************************************
* © 2019-2024 SAP SE or an SAP affiliate company. All rights reserved. *
************************************************************************/
package com.sap.cloud.security.ams.dcl.client.dcn;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import com.sap.cloud.security.ams.dcl.client.annotation.Beta;
/**
* Tooling for reading and writing of DCN files.
*
* @apiNote This interface is not to be implemented by consumers.
* @implSpec Instances of this interface are thread-safe.
*
* @since 0.7
**/
@Beta
public interface DcnTools {
int DCN_VERSION = 1;
class SerializationConfiguration {
private boolean isPretty;
public SerializationConfiguration() {
super();
}
public boolean isPretty() {
return isPretty;
}
public void setPretty(boolean isPretty) {
this.isPretty = isPretty;
}
}
//
// Deserialization
//
T deserialize(Class clazz, InputStream is, SerializationConfiguration configuration) throws IOException;
DcnContainer deserialize(File file) throws IOException;
DcnContainer deserialize(InputStream is) throws IOException;
Object deserializeExpression(InputStream is, SerializationConfiguration configuration) throws IOException;
Object deserializeExpression(InputStream is) throws IOException;
//
// Serialization
//
void serialize(Object dcn, OutputStream os, SerializationConfiguration configuration) throws IOException;
void serialize(Object dcn, File file, SerializationConfiguration configuration) throws IOException;
void serialize(DcnContainer dcn, File file) throws IOException;
void serialize(DcnContainer dcn, OutputStream os) throws IOException;
public static DcnTools getInstance() {
return DcnToolsFactory.INSTANCE;
}
}