congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
JsonEncoder.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.apache.avro.io.JsonEncoder
constructor

Best Java code snippets using org.apache.avro.io.JsonEncoder.<init> (Showing top 20 results out of 315)

origin: apache/avro

/**
 * Creates a {@link JsonEncoder} using the OutputStream provided for writing
 * data conforming to the Schema provided with optional pretty printing.
 * <p/>
 * {@link JsonEncoder} buffers its output. Data may not appear on the
 * underlying OutputStream until {@link Encoder#flush()} is called.
 * <p/>
 * {@link JsonEncoder} is not thread-safe.
 *
 * @param schema
 *          The Schema for data written to this JsonEncoder. Cannot be null.
 * @param out
 *          The OutputStream to write to. Cannot be null.
 * @param pretty
 *          Pretty print encoding.
 * @return A JsonEncoder configured with <i>out</i>, <i>schema</i> and <i>pretty</i>
 * @throws IOException
 */
public JsonEncoder jsonEncoder(Schema schema, OutputStream out, boolean pretty)
  throws IOException {
 return new JsonEncoder(schema, out, pretty);
}
origin: apache/avro

/**
 * Creates a {@link JsonEncoder} using the OutputStream provided for writing
 * data conforming to the Schema provided.
 * <p/>
 * {@link JsonEncoder} buffers its output. Data may not appear on the
 * underlying OutputStream until {@link Encoder#flush()} is called.
 * <p/>
 * {@link JsonEncoder} is not thread-safe.
 *
 * @param schema
 *          The Schema for data written to this JsonEncoder. Cannot be null.
 * @param out
 *          The OutputStream to write to. Cannot be null.
 * @return A JsonEncoder configured with <i>out</i> and <i>schema</i>
 * @throws IOException
 */
public JsonEncoder jsonEncoder(Schema schema, OutputStream out)
  throws IOException {
 return new JsonEncoder(schema, out);
}
origin: apache/avro

/**
 * Creates a {@link JsonEncoder} using the {@link JsonGenerator} provided for
 * output of data conforming to the Schema provided.
 * <p/>
 * {@link JsonEncoder} buffers its output. Data may not appear on the
 * underlying output until {@link Encoder#flush()} is called.
 * <p/>
 * {@link JsonEncoder} is not thread-safe.
 *
 * @param schema
 *          The Schema for data written to this JsonEncoder. Cannot be null.
 * @param gen
 *          The JsonGenerator to write with. Cannot be null.
 * @return A JsonEncoder configured with <i>gen</i> and <i>schema</i>
 * @throws IOException
 */
JsonEncoder jsonEncoder(Schema schema, JsonGenerator gen)
  throws IOException {
 return new JsonEncoder(schema, gen);
}
origin: org.apache.avro/avro

/**
 * Creates a {@link JsonEncoder} using the OutputStream provided for writing
 * data conforming to the Schema provided.
 * <p/>
 * {@link JsonEncoder} buffers its output. Data may not appear on the
 * underlying OutputStream until {@link Encoder#flush()} is called.
 * <p/>
 * {@link JsonEncoder} is not thread-safe.
 *
 * @param schema
 *          The Schema for data written to this JsonEncoder. Cannot be null.
 * @param out
 *          The OutputStream to write to. Cannot be null.
 * @return A JsonEncoder configured with <i>out</i> and <i>schema</i>
 * @throws IOException
 */
public JsonEncoder jsonEncoder(Schema schema, OutputStream out)
  throws IOException {
 return new JsonEncoder(schema, out);
}
origin: org.apache.avro/avro

/**
 * Creates a {@link JsonEncoder} using the OutputStream provided for writing
 * data conforming to the Schema provided with optional pretty printing.
 * <p/>
 * {@link JsonEncoder} buffers its output. Data may not appear on the
 * underlying OutputStream until {@link Encoder#flush()} is called.
 * <p/>
 * {@link JsonEncoder} is not thread-safe.
 *
 * @param schema
 *          The Schema for data written to this JsonEncoder. Cannot be null.
 * @param out
 *          The OutputStream to write to. Cannot be null.
 * @param pretty
 *          Pretty print encoding.
 * @return A JsonEncoder configured with <i>out</i>, <i>schema</i> and <i>pretty</i>
 * @throws IOException
 */
public JsonEncoder jsonEncoder(Schema schema, OutputStream out, boolean pretty)
  throws IOException {
 return new JsonEncoder(schema, out, pretty);
}
origin: org.apache.avro/avro

/**
 * Creates a {@link JsonEncoder} using the {@link JsonGenerator} provided for
 * output of data conforming to the Schema provided.
 * <p/>
 * {@link JsonEncoder} buffers its output. Data may not appear on the
 * underlying output until {@link Encoder#flush()} is called.
 * <p/>
 * {@link JsonEncoder} is not thread-safe.
 *
 * @param schema
 *          The Schema for data written to this JsonEncoder. Cannot be null.
 * @param gen
 *          The JsonGenerator to write with. Cannot be null.
 * @return A JsonEncoder configured with <i>gen</i> and <i>schema</i>
 * @throws IOException
 * @deprecated internal method
 */
@Deprecated
public JsonEncoder jsonEncoder(Schema schema, JsonGenerator gen)
  throws IOException {
 return new JsonEncoder(schema, gen);
}
origin: linkedin/kafka-monitor

public static String jsonFromGenericRecord(GenericRecord record) {
 ByteArrayOutputStream out = new ByteArrayOutputStream();
 GenericDatumWriter<GenericRecord> writer = new GenericDatumWriter<>(DefaultTopicSchema.MESSAGE_V0);
 try {
  Encoder encoder = new JsonEncoder(DefaultTopicSchema.MESSAGE_V0, out);
  writer.write(record, encoder);
  encoder.flush();
 } catch (IOException e) {
  LOG.error("Unable to serialize avro record due to error " + e);
 }
 return out.toString();
}
origin: com.linkedin.pegasus/data-avro

 @Override
 public Encoder createJsonEncoder(Schema schema, OutputStream outputStream) throws IOException
 {
  Encoder jsonEncoder = new JsonEncoder(schema, outputStream);
  return jsonEncoder;
 }
}
origin: com.facebook.presto.hive/hive-apache

/**
 * Creates a {@link JsonEncoder} using the OutputStream provided for writing
 * data conforming to the Schema provided.
 * <p/>
 * {@link JsonEncoder} buffers its output. Data may not appear on the
 * underlying OutputStream until {@link Encoder#flush()} is called.
 * <p/>
 * {@link JsonEncoder} is not thread-safe.
 * 
 * @param schema
 *          The Schema for data written to this JsonEncoder. Cannot be null.
 * @param out
 *          The OutputStream to write to. Cannot be null.
 * @return A JsonEncoder configured with <i>out</i> and <i>schema</i>
 * @throws IOException
 */
public JsonEncoder jsonEncoder(Schema schema, OutputStream out)
  throws IOException {
 return new JsonEncoder(schema, out);
}
origin: com.facebook.presto.hive/hive-apache

/**
 * Creates a {@link JsonEncoder} using the {@link JsonGenerator} provided for
 * output of data conforming to the Schema provided.
 * <p/>
 * {@link JsonEncoder} buffers its output. Data may not appear on the
 * underlying output until {@link Encoder#flush()} is called.
 * <p/>
 * {@link JsonEncoder} is not thread-safe.
 * 
 * @param schema
 *          The Schema for data written to this JsonEncoder. Cannot be null.
 * @param gen
 *          The JsonGenerator to write with. Cannot be null.
 * @return A JsonEncoder configured with <i>gen</i> and <i>schema</i>
 * @throws IOException
 */
public JsonEncoder jsonEncoder(Schema schema, JsonGenerator gen)
  throws IOException {
 return new JsonEncoder(schema, gen);
}

origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.avro

/**
 * Creates a {@link JsonEncoder} using the OutputStream provided for writing
 * data conforming to the Schema provided.
 * <p/>
 * {@link JsonEncoder} buffers its output. Data may not appear on the
 * underlying OutputStream until {@link Encoder#flush()} is called.
 * <p/>
 * {@link JsonEncoder} is not thread-safe.
 *
 * @param schema
 *          The Schema for data written to this JsonEncoder. Cannot be null.
 * @param out
 *          The OutputStream to write to. Cannot be null.
 * @return A JsonEncoder configured with <i>out</i> and <i>schema</i>
 * @throws IOException
 */
public JsonEncoder jsonEncoder(Schema schema, OutputStream out)
  throws IOException {
 return new JsonEncoder(schema, out);
}
origin: stackoverflow.com

 use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;

$encoders = array(new JsonEncoder());
$normalizers = array(new GetSetMethodNormalizer());

$serializer = new Serializer($normalizers, $encoders);

$jsonContent = $serializer->serialize($object, 'json');
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.avro

/**
 * Creates a {@link JsonEncoder} using the OutputStream provided for writing
 * data conforming to the Schema provided with optional pretty printing.
 * <p/>
 * {@link JsonEncoder} buffers its output. Data may not appear on the
 * underlying OutputStream until {@link Encoder#flush()} is called.
 * <p/>
 * {@link JsonEncoder} is not thread-safe.
 *
 * @param schema
 *          The Schema for data written to this JsonEncoder. Cannot be null.
 * @param out
 *          The OutputStream to write to. Cannot be null.
 * @param pretty
 *          Pretty print encoding.
 * @return A JsonEncoder configured with <i>out</i>, <i>schema</i> and <i>pretty</i>
 * @throws IOException
 */
public JsonEncoder jsonEncoder(Schema schema, OutputStream out, boolean pretty)
  throws IOException {
 return new JsonEncoder(schema, out, pretty);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.avro

/**
 * Creates a {@link JsonEncoder} using the {@link JsonGenerator} provided for
 * output of data conforming to the Schema provided.
 * <p/>
 * {@link JsonEncoder} buffers its output. Data may not appear on the
 * underlying output until {@link Encoder#flush()} is called.
 * <p/>
 * {@link JsonEncoder} is not thread-safe.
 *
 * @param schema
 *          The Schema for data written to this JsonEncoder. Cannot be null.
 * @param gen
 *          The JsonGenerator to write with. Cannot be null.
 * @return A JsonEncoder configured with <i>gen</i> and <i>schema</i>
 * @throws IOException
 * @deprecated internal method
 */
@Deprecated
public JsonEncoder jsonEncoder(Schema schema, JsonGenerator gen)
  throws IOException {
 return new JsonEncoder(schema, gen);
}
origin: stackoverflow.com

$encoders = array(new JsonEncoder());
$normalizers = array(new GetSetMethodNormalizer());
origin: org.apache.cassandra.deps/avro

private void dumpJson(PrintStream out, Schema schema, Object datum) 
throws IOException {
 DatumWriter<Object> writer = new GenericDatumWriter<Object>(schema);
 JsonGenerator g =
  new JsonFactory().createJsonGenerator(out, JsonEncoding.UTF8);
 g.useDefaultPrettyPrinter();
 writer.write(datum, new JsonEncoder(schema, g));
 g.flush();
 out.println();
 out.flush();
}
origin: org.apache.hadoop/avro

private void dumpJson(PrintStream out, Schema schema, Object datum) 
throws IOException {
 DatumWriter<Object> writer = new GenericDatumWriter<Object>(schema);
 JsonGenerator g =
  new JsonFactory().createJsonGenerator(out, JsonEncoding.UTF8);
 g.useDefaultPrettyPrinter();
 writer.write(datum, new JsonEncoder(schema, g));
 g.flush();
 out.println();
 out.flush();
}
origin: org.apache.hadoop/avro

@Override
public int run(InputStream stdin, PrintStream out, PrintStream err,
  List<String> args) throws Exception {
 if (args.size() != 1) {
  // Unlike other commands, "-" can't be used for stdin, because
  // we can only use seekable files.
  err.println("Expected 1 argument: input_file.");
  return 1;
 }
 GenericDatumReader<Object> reader = new GenericDatumReader<Object>();
 DataFileReader<Object> fileReader =
  new DataFileReader<Object>(new File(args.get(0)), reader);
 try {
  Schema schema = fileReader.getSchema();
  DatumWriter<Object> writer = new GenericDatumWriter<Object>(schema);
  Encoder encoder = new JsonEncoder(schema, (JsonGenerator)null);
  for (Object datum : fileReader) {
   // init() recreates the internal Jackson JsonGenerator
   encoder.init(out);
   writer.write(datum, encoder);
   encoder.flush();
   out.println();
  }
  out.flush();
 } finally {
  fileReader.close();
 }
 return 0;
}
origin: org.apache.cassandra.deps/avro

@Override
public int run(InputStream stdin, PrintStream out, PrintStream err,
  List<String> args) throws Exception {
 if (args.size() != 1) {
  // Unlike other commands, "-" can't be used for stdin, because
  // we can only use seekable files.
  err.println("Expected 1 argument: input_file.");
  return 1;
 }
 GenericDatumReader<Object> reader = new GenericDatumReader<Object>();
 DataFileReader<Object> fileReader =
  new DataFileReader<Object>(new File(args.get(0)), reader);
 try {
  Schema schema = fileReader.getSchema();
  DatumWriter<Object> writer = new GenericDatumWriter<Object>(schema);
  Encoder encoder = new JsonEncoder(schema, (JsonGenerator)null);
  for (Object datum : fileReader) {
   // init() recreates the internal Jackson JsonGenerator
   encoder.init(out);
   writer.write(datum, encoder);
   encoder.flush();
   out.println();
  }
  out.flush();
 } finally {
  fileReader.close();
 }
 return 0;
}
origin: org.apache.cassandra.deps/avro

JsonGenerator jsonGenerator = new JsonFactory().createJsonGenerator(
  out, JsonEncoding.UTF8);
JsonEncoder jsonEncoder = new JsonEncoder(message.getRequest(), jsonGenerator);
org.apache.avro.ioJsonEncoder<init>

Popular methods of JsonEncoder

  • flush
  • configure
    Reconfigures this JsonEncoder to output to the JsonGenerator provided. If the JsonGenerator provided
  • depth
  • getJsonGenerator
  • pop
  • push
  • writeByteArray
  • writeBytes
  • writeString

Popular in Java

  • Reactive rest calls using spring rest template
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • runOnUiThread (Activity)
  • addToBackStack (FragmentTransaction)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • JLabel (javax.swing)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now