Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright (c) 2008, http://www.snakeyaml.org
*
* Licensed 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 lowentry.ue4.libs.snakeyaml;
import lowentry.ue4.libs.snakeyaml.DumperOptions.FlowStyle;
import lowentry.ue4.libs.snakeyaml.composer.Composer;
import lowentry.ue4.libs.snakeyaml.constructor.BaseConstructor;
import lowentry.ue4.libs.snakeyaml.constructor.Constructor;
import lowentry.ue4.libs.snakeyaml.emitter.Emitable;
import lowentry.ue4.libs.snakeyaml.emitter.Emitter;
import lowentry.ue4.libs.snakeyaml.error.YAMLException;
import lowentry.ue4.libs.snakeyaml.events.Event;
import lowentry.ue4.libs.snakeyaml.introspector.BeanAccess;
import lowentry.ue4.libs.snakeyaml.nodes.Node;
import lowentry.ue4.libs.snakeyaml.nodes.Tag;
import lowentry.ue4.libs.snakeyaml.parser.Parser;
import lowentry.ue4.libs.snakeyaml.parser.ParserImpl;
import lowentry.ue4.libs.snakeyaml.reader.StreamReader;
import lowentry.ue4.libs.snakeyaml.reader.UnicodeReader;
import lowentry.ue4.libs.snakeyaml.representer.Representer;
import lowentry.ue4.libs.snakeyaml.resolver.Resolver;
import lowentry.ue4.libs.snakeyaml.serializer.Serializer;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.regex.Pattern;
/**
* Public YAML interface. This class is not thread-safe. Which means that all the methods of the same
* instance can be called only by one thread.
* It is better to create an instance for every YAML stream.
*/
@SuppressWarnings("all")
public class Yaml {
protected final Resolver resolver;
private String name;
protected BaseConstructor constructor;
protected Representer representer;
protected DumperOptions dumperOptions;
protected LoaderOptions loadingConfig;
/**
* Create Yaml instance.
*/
public Yaml() {
this(new Constructor(), new Representer(), new DumperOptions(), new LoaderOptions(),
new Resolver());
}
/**
* Create Yaml instance.
*
* @param dumperOptions DumperOptions to configure outgoing objects
*/
public Yaml(DumperOptions dumperOptions) {
this(new Constructor(), new Representer(dumperOptions), dumperOptions);
}
/**
* Create Yaml instance.
*
* @param loadingConfig LoadingConfig to control load behavior
*/
public Yaml(LoaderOptions loadingConfig) {
this(new Constructor(), new Representer(), new DumperOptions(), loadingConfig);
}
/**
* Create Yaml instance.
*
* @param representer Representer to emit outgoing objects
*/
public Yaml(Representer representer) {
this(new Constructor(), representer);
}
/**
* Create Yaml instance.
*
* @param constructor BaseConstructor to construct incoming documents
*/
public Yaml(BaseConstructor constructor) {
this(constructor, new Representer());
}
/**
* Create Yaml instance.
*
* @param constructor BaseConstructor to construct incoming documents
* @param representer Representer to emit outgoing objects
*/
public Yaml(BaseConstructor constructor, Representer representer) {
this(constructor, representer, initDumperOptions(representer));
}
private static DumperOptions initDumperOptions(Representer representer) {
DumperOptions dumperOptions = new DumperOptions();
dumperOptions.setDefaultFlowStyle(representer.getDefaultFlowStyle());
dumperOptions.setDefaultScalarStyle(representer.getDefaultScalarStyle());
dumperOptions.setAllowReadOnlyProperties(representer.getPropertyUtils().isAllowReadOnlyProperties());
dumperOptions.setTimeZone(representer.getTimeZone());
return dumperOptions;
}
/**
* Create Yaml instance. It is safe to create a few instances and use them
* in different Threads.
*
* @param representer Representer to emit outgoing objects
* @param dumperOptions DumperOptions to configure outgoing objects
*/
public Yaml(Representer representer, DumperOptions dumperOptions) {
this(new Constructor(), representer, dumperOptions, new LoaderOptions(), new Resolver());
}
/**
* Create Yaml instance. It is safe to create a few instances and use them
* in different Threads.
*
* @param constructor BaseConstructor to construct incoming documents
* @param representer Representer to emit outgoing objects
* @param dumperOptions DumperOptions to configure outgoing objects
*/
public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions) {
this(constructor, representer, dumperOptions, new LoaderOptions(), new Resolver());
}
/**
* Create Yaml instance. It is safe to create a few instances and use them
* in different Threads.
*
* @param constructor BaseConstructor to construct incoming documents
* @param representer Representer to emit outgoing objects
* @param dumperOptions DumperOptions to configure outgoing objects
* @param loadingConfig LoadingConfig to control load behavior
*/
public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions,
LoaderOptions loadingConfig) {
this(constructor, representer, dumperOptions, loadingConfig, new Resolver());
}
/**
* Create Yaml instance. It is safe to create a few instances and use them
* in different Threads.
*
* @param constructor BaseConstructor to construct incoming documents
* @param representer Representer to emit outgoing objects
* @param dumperOptions DumperOptions to configure outgoing objects
* @param resolver Resolver to detect implicit type
*/
public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions,
Resolver resolver) {
this(constructor, representer, dumperOptions, new LoaderOptions(), resolver);
}
/**
* Create Yaml instance. It is safe to create a few instances and use them
* in different Threads.
*
* @param constructor BaseConstructor to construct incoming documents
* @param representer Representer to emit outgoing objects
* @param dumperOptions DumperOptions to configure outgoing objects
* @param loadingConfig LoadingConfig to control load behavior
* @param resolver Resolver to detect implicit type
*/
public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions,
LoaderOptions loadingConfig, Resolver resolver) {
if (!constructor.isExplicitPropertyUtils()) {
constructor.setPropertyUtils(representer.getPropertyUtils());
} else if (!representer.isExplicitPropertyUtils()) {
representer.setPropertyUtils(constructor.getPropertyUtils());
}
this.constructor = constructor;
this.constructor.setAllowDuplicateKeys(loadingConfig.isAllowDuplicateKeys());
this.constructor.setWrappedToRootException(loadingConfig.isWrappedToRootException());
if (dumperOptions.getIndent() <= dumperOptions.getIndicatorIndent()) {
throw new YAMLException("Indicator indent must be smaller then indent.");
}
representer.setDefaultFlowStyle(dumperOptions.getDefaultFlowStyle());
representer.setDefaultScalarStyle(dumperOptions.getDefaultScalarStyle());
representer.getPropertyUtils()
.setAllowReadOnlyProperties(dumperOptions.isAllowReadOnlyProperties());
representer.setTimeZone(dumperOptions.getTimeZone());
this.representer = representer;
this.dumperOptions = dumperOptions;
this.loadingConfig = loadingConfig;
this.resolver = resolver;
this.name = "Yaml:" + System.identityHashCode(this);
}
/**
* Serialize a Java object into a YAML String.
*
* @param data Java object to be Serialized to YAML
* @return YAML String
*/
public String dump(Object data) {
List