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.
Transit is a data format and a set of libraries for conveying values between applications written in different languages. This library provides support for marshalling Transit data to/from Java.
// Copyright 2014 Cognitect. All Rights Reserved.
//
// 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 com.cognitect.transit;
import com.cognitect.transit.impl.*;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
import java.util.function.Function;
/**
* Main entry point for using transit-java library. Provides methods to construct
* readers and writers, as well as helpers to make various other values.
*/
public class TransitFactory {
/**
* Transit formats
*/
public static enum Format { JSON, MSGPACK, JSON_VERBOSE }
/**
* Creates a writer instance.
* @param type format to write in
* @param out output stream to write to
* @return a Writer
*/
public static Writer writer(Format type, OutputStream out) {
return writer(type, out, defaultDefaultWriteHandler());
}
/**
* Creates a writer instance.
* @param type format to write in
* @param out output stream to write to
* @param customHandlers additional WriteHandlers to use in addition
* to or in place of the default WriteHandlers
* @return a writer
*/
public static Writer writer(Format type, OutputStream out, Map> customHandlers) {
return writer(type, out, customHandlers, null);
}
/**
* Creates a writer instance.
* @param type format to write in
* @param out output stream to write to
* @param defaultWriteHandler WriteHandler to use by default
* @return a writer
*/
public static Writer writer(Format type, OutputStream out, WriteHandler, ?> defaultWriteHandler) {
return writer(type, out, null, defaultWriteHandler);
}
/**
* Creates a writer instance.
* @param type format to write in
* @param out output stream to write to
* @param customHandlers additional WriteHandlers to use in addition
* to or in place of the default WriteHandlers
* @param defaultWriteHandler WriteHandler to use by default
* @return a writer
*/
public static Writer writer(Format type, OutputStream out, Map> customHandlers, WriteHandler, ?> defaultWriteHandler) {
return writer(type, out, customHandlers, defaultWriteHandler, null);
}
/**
* Creates a writer instance.
* @param type format to write in
* @param out output stream to write to
* @param customHandlers additional WriteHandlers to use in addition
* to or in place of the default WriteHandlers
* @param defaultWriteHandler WriteHandler to use by default
* @param transform a transform function to apply to values before writing
* @return a writer
*/
public static Writer writer(Format type, OutputStream out, Map> customHandlers, WriteHandler, ?> defaultWriteHandler, Function