Top Description Fields Constructors Methods
org.apache.avro.util

public Class RandomData

extends Object
implements Iterable<Object>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable
Imports
java.io.File, java.nio.Buffer, .ByteBuffer, java.nio.charset.Charset, .StandardCharsets, java.util.HashMap, .Iterator, .List, .Map, .Random, org.apache.avro.Schema, org.apache.avro.file.CodecFactory, .DataFileWriter, org.apache.avro.generic.GenericArray, .GenericData, .GenericDatumWriter, .GenericRecord

Generates schema data as Java objects with random values.

Field Summary

Modifier and TypeField and Description
private final int
private final Schema
private final long
public static final String
private static final Charset
private final boolean

Constructor Summary

AccessConstructor and Description
public
RandomData(Schema schema, int count)

public
RandomData(Schema schema, int count, long seed)

public
RandomData(Schema schema, int count, boolean utf8ForString)

public
RandomData(Schema schema, int count, long seed, boolean utf8ForString)

Method Summary

Modifier and TypeMethod and Description
private Object
generate(Schema schema, Random random, int d)

public Iterator<Object>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.
public static void
main(String[] args)

private static ByteBuffer
randomBytes(Random rand, int maxLength)

private Object
randomString(Random random, int maxLength)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

countback to summary
private final int count
rootback to summary
private final Schema root
seedback to summary
private final long seed
USE_DEFAULTback to summary
public static final String USE_DEFAULT
UTF8back to summary
private static final Charset UTF8
utf8ForStringback to summary
private final boolean utf8ForString

Constructor Detail

RandomDataback to summary
public RandomData(Schema schema, int count)
RandomDataback to summary
public RandomData(Schema schema, int count, long seed)
RandomDataback to summary
public RandomData(Schema schema, int count, boolean utf8ForString)
RandomDataback to summary
public RandomData(Schema schema, int count, long seed, boolean utf8ForString)

Method Detail

generateback to summary
private Object generate(Schema schema, Random random, int d)
Annotations
@SuppressWarnings:unchecked
iteratorback to summary
public Iterator<Object> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<Object>

an Iterator.

Annotations
@Override
mainback to summary
public static void main(String[] args) throws Exception
randomBytesback to summary
private static ByteBuffer randomBytes(Random rand, int maxLength)
randomStringback to summary
private Object randomString(Random random, int maxLength)