Example usage for twitter4j JSONArray toString

List of usage examples for twitter4j JSONArray toString

Introduction

In this page you can find the example usage for twitter4j JSONArray toString.

Prototype

@Override
public String toString() 

Source Link

Document

Encodes this array as a compact JSON string, such as:
[94043,90210]

Usage

From source file:com.epsi.twitterdashboard.utils.JsonFile.java

/**
 * Writes dashboard data to json file/*w  w w .  j  a  v  a2s .c  o  m*/
 * @param database 
 */
public static void WriteDatabase(String username, JSONArray database) {
    Write(String.format(JsonFile.TweetsPath, username), database.toString());
}

From source file:com.epsi.twitterdashboard.utils.JsonFile.java

/**
 * Add dashboard bookmark to json file/*from   w w w.  java  2s. c  o  m*/
 * @param user
 */
public static void AddUser(User user) {
    List<User> users = ReadUsers();
    if (users == null) {
        users = new ArrayList<User>();
    }
    users.add(user);
    JSONArray jsonUsers = new JSONArray(users);
    Write(JsonFile.UsersPath, jsonUsers.toString());
}

From source file:com.epsi.twitterdashboard.utils.JsonFile.java

/**
 * Add dashboard bookmark to json file//from w w w  .  j  a  v a  2s.co m
 * @param id 
 */
public static void DeleteUser(int id) {
    List<User> users = ReadUsers();
    if (users == null) {
        users.remove(ListFinder.FindUserById(users, id));
        JSONArray jsonUsers = new JSONArray(users);
        Write(JsonFile.UsersPath, jsonUsers.toString());
    }
}

From source file:com.epsi.twitterdashboard.utils.JsonFile.java

/**
 * Add dashboard bookmark to json file/*from w w w  .jav  a  2s .  c om*/
 * @param id 
 */
public static void AddBookmark(String username, int id) {
    List<Tweet> database = ReadDatabase(username);
    List<Tweet> bookmarks = ReadBookmarks(username);
    if (bookmarks == null) {
        bookmarks = new ArrayList<Tweet>();
    }
    bookmarks.add(ListFinder.FindTweetById(database, id));
    JSONArray jsonBookmark = new JSONArray(bookmarks);
    Write(String.format(JsonFile.BookmarkPath, username), jsonBookmark.toString());
}

From source file:com.epsi.twitterdashboard.utils.JsonFile.java

/**
 * Delete dashboard bookmark from json file
 * @param id /*  w w  w.  j a v a 2s  . co m*/
 */
public static void DeleteBookmark(String username, int id) {
    List<Tweet> bookmarks = ReadBookmarks(username);
    if (bookmarks == null) {
        bookmarks.remove(ListFinder.FindTweetById(bookmarks, id));
        JSONArray jsonBookmark = new JSONArray(bookmarks);
        Write(String.format(JsonFile.BookmarkPath, username), jsonBookmark.toString());
    }
}