@@ -133,7 +133,7 @@ public void setUserToken(String userToken) {
133
133
134
134
/**
135
135
* List all existing indexes
136
- * return an JSON Object in the form:
136
+ * @ return a JSON Object in the form:
137
137
* { "items": [ {"name": "contacts", "createdAt": "2013-01-18T15:33:13.556Z"},
138
138
* {"name": "notes", "createdAt": "2013-01-18T15:33:13.556Z"}]}
139
139
*/
@@ -145,7 +145,7 @@ protected JSONObject listIndexes() throws AlgoliaException {
145
145
* Delete an index
146
146
*
147
147
* @param indexName the name of index to delete
148
- * return an object containing a "deletedAt" attribute
148
+ * @ return an object containing a "deletedAt" attribute
149
149
*/
150
150
protected JSONObject deleteIndex (String indexName ) throws AlgoliaException {
151
151
try {
@@ -317,6 +317,13 @@ protected JSONObject putRequest(String url, String obj) throws AlgoliaException
317
317
return _request (Method .PUT , url , obj , writeHostsArray , httpConnectTimeoutMS , httpSocketTimeoutMS );
318
318
}
319
319
320
+ /**
321
+ * Reads the answer and return it as a String
322
+ *
323
+ * @param istream the InputStream to read
324
+ * @return the stream's content
325
+ * @throws IOException
326
+ */
320
327
private String _getAnswer (InputStream istream ) throws IOException {
321
328
InputStreamReader is = new InputStreamReader (istream , "UTF-8" );
322
329
StringBuilder builder = new StringBuilder ();
@@ -338,6 +345,18 @@ private JSONObject _getAnswerObject(InputStream istream) throws IOException, JSO
338
345
return _getJSONObject (_getAnswer (istream ));
339
346
}
340
347
348
+ /**
349
+ * Send the query according to parameters and returns its result as a JSONObject
350
+ *
351
+ * @param m HTTP Method to use
352
+ * @param url endpoint URL
353
+ * @param json optional JSON Object to send
354
+ * @param hostsArray array of hosts to try successively
355
+ * @param connectTimeout maximum wait time to open connection
356
+ * @param readTimeout maximum time to read data on socket
357
+ * @return a JSONObject containing the resulting data or error
358
+ * @throws AlgoliaException
359
+ */
341
360
private synchronized JSONObject _request (Method m , String url , String json , List <String > hostsArray , int connectTimeout , int readTimeout ) throws AlgoliaException {
342
361
String requestMethod ;
343
362
HashMap <String , String > errors = new HashMap <String , String >();
0 commit comments