public String startUserStream()throws Exception
  {
    ConfigurationBuilder builder = new ConfigurationBuilder();
    builder.setOAuthConsumerKey(KEY);
    builder.setOAuthConsumerSecret(SECRET);
    AccessToken accessToken=null;
    Configuration conf = builder.build();
    TwitterFactory factory = new TwitterFactory(conf);
    Twitter twitter= factory.getInstance(); 
    try{
      ObjectInputStream ois = new ObjectInputStream(new FileInputStream(ClientModel.ACCESS_FILENAME));
      EnigmaToken enigmaToken = (EnigmaToken)ois.readObject();
      ois.close();
      accessToken = new AccessToken(enigmaToken.getToken(),enigmaToken.getSecret());
      //System.out.println(accessToken.getTokenSecret());
    }catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      RequestToken requestToken = twitter.getOAuthRequestToken();
      /*
      System.out.println("Open the following URL and grant access to your account:");
      System.out.println(requestToken.getAuthorizationURL());
      System.out.print("Enter the PIN(if aviailable) or just hit enter.[PIN]:");
      String pin = br.readLine();
      */
      JFrame frame = new JFrame();
      JOptionPane.showMessageDialog(frame, "OKボタンを押すと、ブラウザで認証ページを開きます。\n認証後に表示されたPINコードを入力してください。");
      Desktop desktop = Desktop.getDesktop();
      String uriString = requestToken.getAuthorizationURL();
      try {
        URI uri = new URI(uriString);
        desktop.browse(uri);
      } catch (URISyntaxException e1) {
        e1.printStackTrace();
      } catch (IOException e1) {
        e1.printStackTrace();
      }
      String pin = JOptionPane.showInputDialog("PINコードを入力してください");
      if (pin == null){
        System.exit(1);
      }
      try{
         if(pin.length() > 0){
           accessToken = twitter.getOAuthAccessToken(requestToken, pin);
         }else{
           accessToken = twitter.getOAuthAccessToken();
         }
         //将来の参照用に accessToken を永続化する
         storeAccessToken(accessToken);
      } catch (TwitterException te) {
        if(401 == te.getStatusCode()){
          System.out.println("Unable to get the access token.");
        }else{
          te.printStackTrace();
        }
      }
    }
    //twitter.setOAuthConsumer(KEY, SECRET);
    twitter.setOAuthAccessToken(accessToken);
    ClientFactory clientFactory= new ClientFactory(twitter,this.mode);
    ClientModel model = clientFactory.getClientModel();
    List<Status> statuses = twitter.getHomeTimeline();
    for (Status status : statuses) {
      model.post(status);
    }
    TwitterStreamFactory twitterStreamFactory = new TwitterStreamFactory(conf);
    TwitterStream twitterStream = twitterStreamFactory.getInstance();
    twitterStream.addListener(new MyUserStreamAdapter(model));
    twitterStream.setOAuthAccessToken(accessToken);
    twitterStream.user();
    model.show();
    splash.setVisible(false);
    return null;
  }