Search in sources :

Example 6 with Utf8String

use of com.yahoo.text.Utf8String in project vespa by vespa-engine.

the class FeedResponse method render.

@Override
public void render(OutputStream outputStream) throws IOException {
    if (!errorMessages.isEmpty())
        setStatus(VespaHeaders.getStatus(false, errorMessages.get(0), errorMessages.iterator()));
    XMLWriter writer = new XMLWriter(new OutputStreamWriter(outputStream));
    writer.openTag("result");
    if (metrics != null) {
        metrics.printXml(writer, 0, 0);
    }
    if (traces.length() > 0) {
        writer.openTag("trace");
        writer.append(traces);
        writer.closeTag();
    }
    if (!errors.isEmpty()) {
        writer.openTag("errors");
        writer.attribute(new Utf8String("count"), errors.size());
        for (int i = 0; i < errors.size() && i < 10; ++i) {
            writer.openTag("error");
            writer.attribute(new Utf8String("message"), errors.get(i));
            writer.closeTag();
        }
        writer.closeTag();
    }
    writer.closeTag();
    writer.flush();
    outputStream.close();
}
Also used : Utf8String(com.yahoo.text.Utf8String) OutputStreamWriter(java.io.OutputStreamWriter) XMLWriter(com.yahoo.text.XMLWriter)

Example 7 with Utf8String

use of com.yahoo.text.Utf8String in project vespa by vespa-engine.

the class VespaDocumentDeserializer42 method readDocumentType.

public DocumentType readDocumentType() {
    Utf8Array docTypeName = parseNullTerminatedString();
    // used to hold the version
    int ignored = getShort(null);
    DocumentType docType = manager.getDocumentType(new DataTypeName(docTypeName));
    if (docType == null) {
        throw new DeserializationException("No known document type with name " + new Utf8String(docTypeName).toString());
    }
    return docType;
}
Also used : Utf8String(com.yahoo.text.Utf8String) DocumentType(com.yahoo.document.DocumentType) DataTypeName(com.yahoo.document.DataTypeName) Utf8Array(com.yahoo.text.Utf8Array)

Aggregations

Utf8String (com.yahoo.text.Utf8String)7 XMLWriter (com.yahoo.text.XMLWriter)2 OutputStreamWriter (java.io.OutputStreamWriter)2 DataTypeName (com.yahoo.document.DataTypeName)1 DocumentType (com.yahoo.document.DocumentType)1 GrowableByteBuffer (com.yahoo.io.GrowableByteBuffer)1 MetricSnapshot (com.yahoo.metrics.MetricSnapshot)1 Grouping (com.yahoo.searchlib.aggregation.Grouping)1 Utf8Array (com.yahoo.text.Utf8Array)1 BufferSerializer (com.yahoo.vespa.objects.BufferSerializer)1 IOException (java.io.IOException)1