Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6254847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:15:21+00:00 2026-05-24T14:15:21+00:00

I have to do a HTTP post in java every second after building a

  • 0

I have to do a HTTP post in java every second after building a json object.
The json object is built from reading a CSV file which is huge (200Mbs+), so my problem is
how do I read x number of lines build x objects and post that every second(as it is not possible to parse the whole 200mb file in less than a second) and continue reading the next x lines.

Please let me know your thoughts..

Can I use Java timer class, and keep reading the CSV file and at the same time post the json object to the server every second with the formed json?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T14:15:21+00:00Added an answer on May 24, 2026 at 2:15 pm

    I would make it depending on the file size and not depending on time.

    BufferedReader fin = null; //create it
        Gson gson=new Gson();  //Google code open source library for JSON in Java  
        ArrayList<JSONObject> jsonList=new ArrayList<JSONObject>();    
        while (((line = fin.readLine()) != null)) {
                                if ( line.length()==0 ){
                                    //"Blank line;
                                }else{
                                            currJSON=loadJSON(line);//You have to load it in a Java Object
    
                                   if ( jsonList.size()<MAX_JSON){
                                   jsonList.add(currJSON);
                                }
    
            if (JsonList.size()==MAX_JSON){ //Define the maximum size of the list you want to post
            gson.toJson(jsonList); //Convert to JSON
            //You should post your Json with some Http Connection to your server
        jsonList.clear();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all! I am trying to post a file over Http using Java 1.4.2.
I'm sending an image file from an iPhone application to a http Post application.
I'd like to have one server make an http post request to another server.
I have an HTTP server that returns large bodies in response to POST requests
I have seen: http://www... ftp://blah.blah... file://blah.blah... unreal://blah.blah... mailto://blah.blah... What is that first section where
I just wanted some opinions from people that have run Selenium ( http://selenium.openqa.org )
I have problem with fb sdk for Android (downloaded from http://github.com/facebook/facebook-android-sdk ). Tried to
I have written one proxy for intercepting the http requests for my tomcat. every
I have a page that lists all from my Post table, it looks like
I have an HTTP server which is in our internal network and accessible only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.