Provide training configuration as file input stream from JSON

@param trainingJsonInputStream Input stream of training JSON string
@return Model builder
160409
public KerasModelBuilder trainingJsonInputStream(InputStream trainingJsonInputStream) throws IOException {
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        IOUtils.copy(trainingJsonInputStream, byteArrayOutputStream);
        this.trainingJson = new String(byteArrayOutputStream.toByteArray());
        return this;
    }
129819
@Override
    TarInputStream getInputStreamForRawStream(final InputStream in) throws IOException {
        assert in != null : "Specified inputstream was null";
        return new TarInputStream(in);
    }
478971
public KerasModelBuilder modelYamlInputStream(InputStream modelYamlInputStream) throws IOException {
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        IOUtils.copy(modelYamlInputStream, byteArrayOutputStream);
        this.modelJson = new String(byteArrayOutputStream.toByteArray());
        return this;
    }
977565
public final void train() throws IOException {
    // load training parameters file
    final String paramFile = this.parsedArguments.getString("params");
    final TrainingParameters params = InputOutputUtils
        .loadTrainingParameters(paramFile);
    String outModel = null;
    if (params.getSettings().get("OutputModel") == null
        || params.getSettings().get("OutputModel").length() == 0) {
      outModel = Files.getNameWithoutExtension(paramFile) + ".bin";
      params.put("OutputModel", outModel);
    } else {
      outModel = Flags.getModel(params);
    }
    String component = Flags.getComponent(params);
    if (component.equalsIgnoreCase("POS")) {
      final TaggerTrainer posTaggerTrainer = new FixedTrainer(params);
      final POSModel trainedModel = posTaggerTrainer.train(params);
      CmdLineUtil.writeModel("ixa-pipe-pos", new File(outModel), trainedModel);
    } else if (component.equalsIgnoreCase("Lemma")) {
      final LemmatizerTrainer lemmatizerTrainer = new LemmatizerFixedTrainer(params);
      final LemmatizerModel trainedModel = lemmatizerTrainer.train(params);
      CmdLineUtil.writeModel("ixa-pipe-lemma", new File(outModel), trainedModel);
    }
  }
226566
protected Model restoreModel(InputStream inputStream) throws Exception {
    final File instanceDir = solrResourceLoader.getInstancePath().toFile();
    return ModelGuesser.loadModelGuess(inputStream, instanceDir);
  }
668410
public static <T extends Trainable, TP extends Parameterizable> T create(TP trainingParameters, Configuration configuration) {
        try {
            Class<T> aClass = (Class<T>) trainingParameters.getClass().getEnclosingClass();
            Constructor<T> constructor = aClass.getDeclaredConstructor(trainingParameters.getClass(), Configuration.class);
            constructor.setAccessible(true);
            return constructor.newInstance(trainingParameters, configuration);
        }
        catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException ex) {
            throw new RuntimeException(ex);
        }
    }
231622
function streamFactory( options ) {
		if ( !arguments.length ) {
			options = {};
		}
		options = copyOptions( options );
		/**
		* FUNCTION: createStream( value )
		*	Creates a stream.
		*
		* @param {*} value - value to be appended
		* @returns {Stream} Transform stream
		*/
		return function createStream( value ) {
			return new Stream( value, options );
		};
	}
492998
public JSONObject instantiateJsonObject(InputStream in) throws IOException,
                                                                JSONException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(in));
    StringBuffer contents = new StringBuffer();
    String text = null;
    while ((text = reader.readLine()) != null) {
      contents.append(text).append(System.getProperty("line.separator"));
    }
    in.close();
    JSONObject json = new JSONObject(contents.toString());
    return json;
  }
900791
@Override
    public InputStream exportAsInputStream() {
        // Create export delegate
        final AbstractExporterDelegate<InputStream> exportDelegate = new TarGzExporterDelegate(this.getArchive());

        // Execute export
        return exportDelegate.export();
    }
1216841
public static JsonObject toJson( SystemInputDef systemInput)
    {
    JsonObjectBuilder builder = Json.createObjectBuilder();
    builder.add( SYSTEM_KEY, systemInput.getName());

    addAnnotations( builder, systemInput);
    
    toStream( systemInput.getFunctionInputDefs()).forEach( function -> builder.add( function.getName(), toJson( function)));

    return builder.build();
    }
763243
public final static <T> T readJson(InputStream jsonStream, Class<T> clazz)
    {
        ObjectMapper mapper = new ObjectMapper();
        try
        {
            if (jsonStream != null)
            {
                return mapper.readValue(jsonStream, clazz);
            }
            else
            {
                LOGGER.error("InputStream is null.");
                throw new KunderaException("InputStream is null.");
            }
        }
        catch (IOException e)
        {
            LOGGER.error("Error while mapping input stream to object. Caused By: ", e);
            throw new KunderaException("Error while mapping input stream to object. Caused By: ", e);
        }

    }
110486
@Override
    TarBzInputStream getInputStreamForRawStream(final InputStream in) throws IOException {
        assert in != null : "Specified inputstream was null";
        return new TarBzInputStream(in);
    }
398165
public static EsriFeature FeatureFromJson(InputStream jsonInputStream) throws JsonParseException, IOException{
		JsonParser parser = jsonFactory.createJsonParser(jsonInputStream);
		return FeatureFromJson(parser);
	}
367137
protected ClassConfigData processClassConfiguration(final InputStream inputStream) throws IOException {
        if (introspectAnnotations == false) {
            return new ClassConfigData(inputStream);
        }

        ClassReader cr = new ClassReader(inputStream);
        ClassWriter cw = new ClassWriter(cr, 0); // Don't compute anything - read only mode
        TraceConfigClassVisitor cv = new TraceConfigClassVisitor(cw);
        cr.accept(cv, 0);
        ClassInfo classInfo = cv.getClassInfo();
        InputStream classInputStream = new ByteArrayInputStream(cw.toByteArray());

        return new ClassConfigData(classInputStream, classInfo);
    }
810726
public <V> V convertFrom(final InputStream in) {
        if (in == null) return null;
        return (V) new AnyDecoder(factory).convertFrom(new JsonStreamReader(in));
    }
675198
static <IN> PatternStreamBuilder<IN> forStreamAndPattern(final DataStream<IN> inputStream, final Pattern<IN, ?> pattern) {
		return new PatternStreamBuilder<>(inputStream, pattern, null, null);
	}
1111536
public static byte[] streamBytes(InputStream stream) throws IOException {

		ByteArrayOutputStream bytes = new ByteArrayOutputStream();

		copyStream(stream, bytes);

		return bytes.toByteArray();
	}