summaryrefslogtreecommitdiff
path: root/core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java')
-rw-r--r--core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java b/core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java
index df34ec726f..189e9d3c8d 100644
--- a/core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java
+++ b/core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java
@@ -964,21 +964,60 @@ public final class XContentBuilder implements BytesStream, Releasable, Flushable
// Raw fields
//////////////////////////////////
+ /**
+ * Writes a raw field with the value taken from the bytes in the stream
+ * @deprecated use {@link #rawField(String, InputStream, XContentType)} to avoid content type auto-detection
+ */
+ @Deprecated
public XContentBuilder rawField(String name, InputStream value) throws IOException {
generator.writeRawField(name, value);
return this;
}
+ /**
+ * Writes a raw field with the value taken from the bytes in the stream
+ */
+ public XContentBuilder rawField(String name, InputStream value, XContentType contentType) throws IOException {
+ generator.writeRawField(name, value, contentType);
+ return this;
+ }
+
+ /**
+ * Writes a raw field with the given bytes as the value
+ * @deprecated use {@link #rawField(String name, BytesReference, XContentType)} to avoid content type auto-detection
+ */
+ @Deprecated
public XContentBuilder rawField(String name, BytesReference value) throws IOException {
generator.writeRawField(name, value);
return this;
}
+ /**
+ * Writes a raw field with the given bytes as the value
+ */
+ public XContentBuilder rawField(String name, BytesReference value, XContentType contentType) throws IOException {
+ generator.writeRawField(name, value, contentType);
+ return this;
+ }
+
+ /**
+ * Writes a value with the source coming directly from the bytes
+ * @deprecated use {@link #rawValue(BytesReference, XContentType)} to avoid content type auto-detection
+ */
+ @Deprecated
public XContentBuilder rawValue(BytesReference value) throws IOException {
generator.writeRawValue(value);
return this;
}
+ /**
+ * Writes a value with the source coming directly from the bytes
+ */
+ public XContentBuilder rawValue(BytesReference value, XContentType contentType) throws IOException {
+ generator.writeRawValue(value, contentType);
+ return this;
+ }
+
public XContentBuilder copyCurrentStructure(XContentParser parser) throws IOException {
generator.copyCurrentStructure(parser);
return this;