Appends a {@link JsonDocument}'s content to an existing one.

@param documentId the unique ID of the document
@param json       the JSON String representing the document to append
@return the updated {@link Document}
@see Bucket#append(Document)
495340
public JsonDocument append(String documentId, String json) {
        this.bucket.append(JsonDocument.create(documentId, JsonObject.fromJson(json)));
        return this.get(documentId);
    }
1179606
private void readFromStream(InputStream in) throws IOException {
        document = DocumentFactory.newDocument(Json.read(in));
    }
269831
@Override
    public void appendJSON(Appendable a) throws IOException {
        a.append('{');
        int n = list.size();
        if (n > 0) {
            int i = 0;
            for (;;) {
                Entry<String, V> entry = list.get(i++);
                a.append('"');
                Strings.appendEscaped(a, entry.getKey(), JSON.charMapper);
                a.append('"').append(':');
                JSON.appendJSON(a, entry.getValue());
                if (i >= n)
                    break;
                a.append(',');
            }
        }
        a.append('}');
    }
382522
@SafeVarargs
    public static JsonDocument toJsonDocument(final Object... a) {
        return a.length == 1 ? toJsonDocument(a[0], toJsonObject(a[0])) : toJsonDocument(a, toJsonObject(a));
    }
480374
public void write( Document document ) {
        assert document != null;
        ++count;
        ++totalCount;
        if (count > maxDocumentsPerFile) {
            // Close the stream (we'll open a new one later in the method) ...
            close();
            count = 1;
        }
        try {
            if (stream == null) {
                // Open the stream to the next file ...
                ++fileCount;
                String suffix = StringUtil.justifyRight(Long.toString(fileCount), BackupService.NUM_CHARS_IN_FILENAME_SUFFIX, '0');
                String filename = filenamePrefix + "_" + suffix + DOCUMENTS_EXTENSION;
                if (compress) filename = filename + GZIP_EXTENSION;
                currentFile = new File(parentDirectory, filename);
                OutputStream fileStream = new FileOutputStream(currentFile);
                if (compress) fileStream = new GZIPOutputStream(fileStream);
                stream = new BufferedOutputStream(fileStream);
            }
            Json.write(document, stream);
            // Need to append a non-consumable character so that we can read multiple JSON documents per file
            stream.write((byte)'\n');
        } catch (IOException e) {
            problems.addError(JcrI18n.problemsWritingDocumentToBackup, currentFile.getAbsolutePath(), e.getMessage());
        }
    }
1066499
public String addDateDocumentWithId(String indexName, String indexType, Object bean,Object docId) throws ElasticSearchException{
		return addDocumentWithId(this.indexNameBuilder.getIndexName(indexName),   indexType,     bean,docId);
	}
1089015
public JSONObject addObject(JSONObject obj, String objectID) throws AlgoliaException {
    return this.addObject(obj, objectID, RequestOptions.empty);
  }
508280
private JSONWriter append(String s) throws JSONException {

        if (s == null) {
            throw new JSONException("Null pointer");
        }
        if ((m_mode == 'o') || (m_mode == 'a')) {
            try {
                if (m_comma && (m_mode == 'a')) {
                    m_writer.write(',');
                }
                m_writer.write(s);
            } catch (IOException e) {
                throw new JSONException(e);
            }
            if (m_mode == 'o') {
                m_mode = 'k';
            }
            m_comma = true;
            return this;
        }
        throw new JSONException("Value out of sequence.");
    }
572152
public Vector addDocument(int id, String content)
    {
        Vector result = query(content);
        if (result == null) return null;
        storage.put(id, result);
        return result;
    }
246218
public static DocumentContext parse(File json, Configuration configuration) throws IOException {
        return new ParseContextImpl(configuration).parse(json);
    }
1153488
public static JsonBooleanDocument create(String id, Boolean content) {
        return new JsonBooleanDocument(id, 0, content, 0, null);
    }
392985
public void document_id_PUT(String id, OvhDocument body) throws IOException {
		String qPath = "/me/document/{id}";
		StringBuilder sb = path(qPath, id);
		exec(qPath, "PUT", sb.toString(), body);
	}
222209
public static DocumentContext parse(String json, Configuration configuration) {
        return new ParseContextImpl(configuration).parse(json);
    }
1030465
public Document<K> addDocument(K id, List<String> document)
    {
        SparseVector vector = toVector(document);
        Document<K> d = new Document<K>(id, vector);
        return documents_.put(id, d);
    }
570083
public JsonLdOptions copy() {
        final JsonLdOptions copy = new JsonLdOptions(base);

        copy.setCompactArrays(compactArrays);
        copy.setExpandContext(expandContext);
        copy.setProcessingMode(processingMode);
        copy.setDocumentLoader(documentLoader);
        copy.setEmbed(embed);
        copy.setExplicit(explicit);
        copy.setOmitDefault(omitDefault);
        copy.setOmitGraph(omitGraph);
        copy.setFrameExpansion(frameExpansion);
        copy.setPruneBlankNodeIdentifiers(pruneBlankNodeIdentifiers);
        copy.setRequireAll(requireAll);
        copy.setAllowContainerSetOnType(allowContainerSetOnType);
        copy.setUseRdfType(useRdfType);
        copy.setUseNativeTypes(useNativeTypes);
        copy.setProduceGeneralizedRdf(produceGeneralizedRdf);
        copy.format = format;
        copy.useNamespaces = useNamespaces;
        copy.outputForm = outputForm;

        return copy;
    }
1064162
function(json){
  
  // Protect against forgetting the new keyword when calling the constructor
  if(!(this instanceof Document)){
    return new Document(json);
  }
  
  // If the given object is already an instance then just return it. DON'T copy it.
  if(Document.isInstance(json)){
    return json;
  }
  
  this.init(json);
}
27097
@SuppressWarnings("unchecked")
    public void addDoc(Map<String, Object> jsonFields, String collName,
            String docId) {
        if (!mCollections.containsKey(collName)) {
            // add new collection
            log.debug("Added collection " + collName);
            mCollections.put(collName, new ConcurrentHashMap<String, Map<String,Object>>());
        }
        Map<String, Map<String,Object>> collection = mCollections.get(collName);

        Map<String, Object> fields;

        if(jsonFields.get(DdpMessageField.FIELDS) == null) {
            fields = new ConcurrentHashMap<>();
        } else {
            fields = (Map<String, Object>) jsonFields.get(DdpMessageField.FIELDS);
        }

        collection.put(docId, fields);

        if (BuildConfig.DEBUG) {
            log.debug("Added docid " + docId + " to collection " + collName);
        }
    }