Class JsonStreamWriter
java.lang.Object
com.google.cloud.bigquery.storage.v1beta2.JsonStreamWriter
- All Implemented Interfaces:
AutoCloseable
Deprecated.
A StreamWriter that can write JSON data (JSONObjects) to BigQuery tables. The JsonStreamWriter is
built on top of a StreamWriter, and it simply converts all JSON data to protobuf messages then
calls StreamWriter's append() method to write to BigQuery tables.
This client lib is deprecated, please use v1 instead.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptioncom.google.api.core.ApiFuture<AppendRowsResponse>append(org.json.JSONArray jsonArr) Deprecated.Writes a JSONArray that contains JSONObjects to the BigQuery table by first converting the JSON data to protobuf messages, then using StreamWriter's append() to write the data.com.google.api.core.ApiFuture<AppendRowsResponse>append(org.json.JSONArray jsonArr, long offset) Deprecated.Writes a JSONArray that contains JSONObjects to the BigQuery table by first converting the JSON data to protobuf messages, then using StreamWriter's append() to write the data.voidclose()Deprecated.Closes the underlying StreamWriter.com.google.protobuf.Descriptors.DescriptorDeprecated.Gets current descriptorDeprecated.Gets streamNamestatic JsonStreamWriter.BuildernewBuilder(String streamOrTableName, TableSchema tableSchema) Deprecated.newBuilder that constructs a JsonStreamWriter builder with BigQuery client being initialized by StreamWriter by default.static JsonStreamWriter.BuildernewBuilder(String streamOrTableName, TableSchema tableSchema, BigQueryWriteClient client) Deprecated.newBuilder that constructs a JsonStreamWriter builder.
-
Method Details
-
append
Deprecated.Writes a JSONArray that contains JSONObjects to the BigQuery table by first converting the JSON data to protobuf messages, then using StreamWriter's append() to write the data.- Parameters:
jsonArr- The JSON array that contains JSONObjects to be written- Returns:
ApiFuture<AppendRowsResponse>returns an AppendRowsResponse message wrapped in an ApiFuture
-
append
public com.google.api.core.ApiFuture<AppendRowsResponse> append(org.json.JSONArray jsonArr, long offset) Deprecated.Writes a JSONArray that contains JSONObjects to the BigQuery table by first converting the JSON data to protobuf messages, then using StreamWriter's append() to write the data.- Parameters:
jsonArr- The JSON array that contains JSONObjects to be writtenoffset- Offset for deduplication- Returns:
ApiFuture<AppendRowsResponse>returns an AppendRowsResponse message wrapped in an ApiFuture
-
getStreamName
Deprecated.Gets streamName- Returns:
- String
-
getDescriptor
public com.google.protobuf.Descriptors.Descriptor getDescriptor()Deprecated.Gets current descriptor- Returns:
- Descriptor
-
newBuilder
public static JsonStreamWriter.Builder newBuilder(String streamOrTableName, TableSchema tableSchema) Deprecated.newBuilder that constructs a JsonStreamWriter builder with BigQuery client being initialized by StreamWriter by default.- Parameters:
streamOrTableName- name of the stream that must follow "projects/[^/]+/datasets/[^/]+/tables/[^/]+/streams/[^/]+" or table name "projects/[^/]+/datasets/[^/]+/tables/[^/]+"tableSchema- The schema of the table when the stream was created, which is passed back throughWriteStream- Returns:
- Builder
-
newBuilder
public static JsonStreamWriter.Builder newBuilder(String streamOrTableName, TableSchema tableSchema, BigQueryWriteClient client) Deprecated.newBuilder that constructs a JsonStreamWriter builder.- Parameters:
streamOrTableName- name of the stream that must follow "projects/[^/]+/datasets/[^/]+/tables/[^/]+/streams/[^/]+"tableSchema- The schema of the table when the stream was created, which is passed back throughWriteStreamclient-- Returns:
- Builder
-
close
public void close()Deprecated.Closes the underlying StreamWriter.- Specified by:
closein interfaceAutoCloseable
-