ctxt.setEncoding(enc); if (enc == JsonEncoding.UTF8) {
_context.setEncoding(enc); return enc;
ctxt.setEncoding(enc); if (enc == JsonEncoding.UTF8) {
ctxt.setEncoding(enc); if (enc == JsonEncoding.UTF8) {
_context.setEncoding(enc); return enc;
ctxt.setEncoding(enc); if (enc == JsonEncoding.UTF8) {
@Override public ToXmlGenerator createJsonGenerator(File f, JsonEncoding enc) throws IOException { OutputStream out = new FileOutputStream(f); // true -> yes, we have to manage the stream since we created it IOContext ctxt = _createContext(out, true); ctxt.setEncoding(enc); return new ToXmlGenerator(ctxt, _generatorFeatures, _xmlGeneratorFeatures, _objectCodec, _createXmlWriter(out)); }
/** * Creates a {@link Utf8Generator} for the outputstream with the supplied buf * {@code outBuffer} to use. */ static Utf8Generator newJsonGenerator(OutputStream out, byte[] buf, int offset, boolean bufferRecyclable, IOContext context) { context.setEncoding(JsonEncoding.UTF8); return new Utf8Generator(context, DEFAULT_JSON_FACTORY.getGeneratorFeatures(), DEFAULT_JSON_FACTORY.getCodec(), out, buf, offset, bufferRecyclable); }
/** * Method for constructing json generator for writing json content * using specified output stream. * Encoding to use must be specified, and needs to be one of available * types (as per JSON specification). *<p> * Underlying stream <b>is NOT owned</b> by the generator constructed, * so that generator will NOT close the output stream when * {@link JsonGenerator#close} is called (unless auto-closing * feature, * {@link org.codehaus.jackson.JsonGenerator.Feature#AUTO_CLOSE_TARGET} * is enabled). * Using application needs to close it explicitly if this is the case. * * @param out OutputStream to use for writing json content * @param enc Character encoding to use */ public JsonGenerator createJsonGenerator(OutputStream out, JsonEncoding enc) throws IOException { IOContext ctxt = _createContext(out, false); ctxt.setEncoding(enc); if (enc == JsonEncoding.UTF8) { // We have optimized writer for UTF-8 return new WriterBasedGenerator(ctxt, _generatorFeatures, new UTF8Writer(ctxt, out)); } return new WriterBasedGenerator(ctxt, _generatorFeatures, new OutputStreamWriter(out, enc.getJavaName())); }
ctxt.setEncoding(enc); if (enc == JsonEncoding.UTF8) {
ctxt.setEncoding(enc); if (enc == JsonEncoding.UTF8) {
_context.setEncoding(enc); return enc;
throw new RuntimeException("Internal error"); // should never get here _context.setEncoding(enc); return enc;
_context.setEncoding(enc); return enc;
ctxt.setEncoding(enc); if (enc == JsonEncoding.UTF8) {
ctxt.setEncoding(enc); if (enc == JsonEncoding.UTF8) {