Examples of toBytesArray()


Examples of org.elasticsearch.common.bytes.BytesReference.toBytesArray()

    initMocks(this);
    BytesReference bytesReference = mock(BytesReference.class);
    BytesStream bytesStream = mock(BytesStream.class);

    when(nameBuilder.getIndexName(any(Event.class))).thenReturn(INDEX_NAME);
    when(bytesReference.toBytesArray()).thenReturn(new BytesArray(MESSAGE_CONTENT));
    when(bytesStream.bytes()).thenReturn(bytesReference);
    when(serializer.getContentBuilder(any(Event.class))).thenReturn(bytesStream);
    fixture = new ElasticSearchRestClient(HOSTS, serializer, httpClient);
  }
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesReference.toBytesArray()

    Gson gson = new Gson();
    synchronized(bulkBuilder) {
      bulkBuilder.append(gson.toJson(parameters));
      bulkBuilder.append("\n");
      bulkBuilder.append(content.toBytesArray().toUtf8());
      bulkBuilder.append("\n");
    }
  }

  @Override
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesReference.toBytesArray()

    Gson gson = new Gson();
    synchronized(bulkBuilder) {
      bulkBuilder.append(gson.toJson(parameters));
      bulkBuilder.append("\n");
      bulkBuilder.append(content.toBytesArray().toUtf8());
      bulkBuilder.append("\n");
    }
  }

  @Override
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesReference.toBytesArray()

                throw new IndexShardClosedException(onGoingRecovery.shardId());
            }

            BytesReference content = request.content();
            if (!content.hasArray()) {
                content = content.toBytesArray();
            }
            transferStatus.outputStream().write(
                content.array(), content.arrayOffset(), content.length()
            );
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesReference.toBytesArray()

                new File(shard.blobContainer().getBaseDirectory(), tmpPath)
            );

            BytesReference content = request.content();
            if (!content.hasArray()) {
                content = content.toBytesArray();
            }
            outputStream.write(content.array(), content.arrayOffset(), content.length());

            if (request.size() == request.content().length()) {  // start request contains the whole file.
                outputStream.close();
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesReference.toBytesArray()

                    context.source(source);
                }
            }
        }
        if (!source.hasArray()) {
            source = source.toBytesArray();
        }
        fields.add(new StoredField(names().indexName(), source.array(), source.arrayOffset(), source.length()));
    }

    @Override
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesReference.toBytesArray()

        } else if (value instanceof ReadableInstant) {
            generator.writeString(XContentBuilder.defaultDatePrinter.print((((ReadableInstant) value)).getMillis()));
        } else if (value instanceof BytesReference) {
            BytesReference bytes = (BytesReference) value;
            if (!bytes.hasArray()) {
                bytes = bytes.toBytesArray();
            }
            generator.writeBinary(bytes.array(), bytes.arrayOffset(), bytes.length());
        } else if (value instanceof BytesRef) {
            BytesRef bytes = (BytesRef) value;
            generator.writeBinary(bytes.bytes, bytes.offset, bytes.length);
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesReference.toBytesArray()

                if (recoverySettings.rateLimiter() != null) {
                    recoverySettings.rateLimiter().pause(request.content().length());
                }
                BytesReference content = request.content();
                if (!content.hasArray()) {
                    content = content.toBytesArray();
                }
                indexOutput.writeBytes(content.array(), content.arrayOffset(), content.length());
                recoveryStatus.state().getIndex().addRecoveredByteCount(content.length());
                RecoveryState.File file = recoveryStatus.state().getIndex().file(request.name());
                if (file != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.