src/org/ohmage/request/observer/StreamReadRequest.java
private static void handleObject(
			final JsonGenerator generator,
			final ObjectNode object,
			final ColumnNode<String> currColumn,
			final String fieldName) 
			throws JsonGenerationException, IOException {
		
		// Start the object.
		if(fieldName == null) {
			generator.writeStartObject();
		}
		else {
			generator.writeObjectFieldStart(fieldName);
		}
		
		// Add the values of all of the requested keys.
		if(currColumn.isLeaf()) {
			Iterator<String> fields = object.getFieldNames();
			while(fields.hasNext()) {
				String field = fields.next();
				
				handleGeneric(
					generator,
					object.get(field),
					currColumn,
					field);
			}
		}
		// Add only the requested columns.
		else {
			for(String key : currColumn.getChildrenValues()) {
				JsonNode currObject = object.get(key);
				
				if(currObject != null) {
					handleGeneric(
						generator,
						currObject, 
						currColumn.getChild(key),
						key);
				}
			}
		}
		
		// End the object.
		generator.writeEndObject();
	}
/**
	 * Feeds an object into an output stream and limits the keys in the object
	 * based on the given columns.
	 * 
	 * @param generator The output stream to feed the object into.
	 * 
	 * @param encoder The encoder to convert Avro data to JSON data.
	 * 
	 * @param object The object to be fed out.
	 * 
	 * @param currColumn The columns to restrict the output. If this is null,
	 * 					 all data in the object will be output.
	 *
	 * @throws JsonGenerationException Could not serialize the data into JSON.
	 * 
	 * @throws IOException Could not write to the output stream.
	 */
Feeds an object into an output stream and limits the keys in the object
based on the given columns.

@param generator The output stream to feed the object into.

@param encoder The encoder to convert Avro data to JSON data.

@param object The object to be fed out.

@param currColumn The columns to restrict the output. If this is null,
all data in the object will be output.

@throws JsonGenerationException Could not serialize the data into JSON.

@throws IOException Could not write to the output stream.
Feeds an object into an output stream and limits the keys in the object based on the given columns . @param generator The output stream to feed the object into . @param encoder The encoder to convert Avro data to JSON data . @param object The object to be fed out . @param currColumn The columns to restrict the output . If this is null all data in the object will be output . @throws JsonGenerationException Could not serialize the data into JSON . @throws IOException Could not write to the output stream .
private static void handleObject(
			final JsonGenerator generator,
			final ObjectNode object,
			final ColumnNode<String> currColumn,
			final String fieldName) 
			throws JsonGenerationException, IOException {
		if(fieldName == null) {
			generator.writeStartObject();
		}
		else {
			generator.writeObjectFieldStart(fieldName);
		}
		if(currColumn.isLeaf()) {
			Iterator<String> fields = object.getFieldNames();
			while(fields.hasNext()) {
				String field = fields.next();
				handleGeneric(
					generator,
					object.get(field),
					currColumn,
					field);
			}
		}
		else {
			for(String key : currColumn.getChildrenValues()) {
				JsonNode currObject = object.get(key);
				if(currObject != null) {
					handleGeneric(
						generator,
						currObject, 
						currColumn.getChild(key),
						key);
				}
			}
		}
		generator.writeEndObject();
	}
private static void handleObject ( final JsonGenerator generator , final ObjectNode object , final ColumnNode < String > currColumn , final String fieldName ) throws JsonGenerationException , IOException { if ( fieldName == null ) { generator . writeStartObject ( ) ; } else { generator . writeObjectFieldStart ( fieldName ) ; } if ( currColumn . isLeaf ( ) ) { Iterator < String > fields = object . getFieldNames ( ) ; while ( fields . hasNext ( ) ) { String field = fields . next ( ) ; handleGeneric ( generator , object . get ( field ) , currColumn , field ) ; } } else { for ( String key : currColumn . getChildrenValues ( ) ) { JsonNode currObject = object . get ( key ) ; if ( currObject != null ) { handleGeneric ( generator , currObject , currColumn . getChild ( key ) , key ) ; } } } generator . writeEndObject ( ) ; }
Feeds an object into an output stream and limits the keys in the object
 based on the given columns.
Feeds an object into an output stream and limits the keys in the object based on the given columns .
// Start the object. // Add the values of all of the requested keys. // Add only the requested columns. // End the object.