Reputation: 939
I am new to file handling. I want to read the uploaded text or CSV file. The controller loooks like this:
@PostMapping("/{testid}/consumers")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@ResponseStatus(HttpStatus.OK)
public Subscription createConsumer(@PathVariable String cid, @FormParam("file") InputStream inputStream)
And I am reading this in service like this:
public Subscription createSubscription(String campaingid, InputStream file) {
BufferedReader br = new BufferedReader(new InputStreamReader(file));
log.debug("Write File--------------------------- ");
String line = null;
try {
while ((line=br.readLine()) != null) {
log.debug("Line: " + line);
} catch (IOException ioe) {
log.error("Exception while reading input " + ioe);
}
}
But I am getting null value in 'br' object. What is wrong I am doing here? I am not using jersey framework. I am using spring boot rest.
Upvotes: 0
Views: 5742
Reputation:
List<Map<String, Object>> mList = CommonCSVParser.getMapFromCSV(reapExcelDataFile);
@Autowired
SUBDetailsValyuStagingRepo sUBDetailsValyuStagingRepo;
System.out.println("----- CSVDisbursmentFileImport ===");
String Client = "";
String ValyuApplicationId = "";// new
String LenderLoanId = "";// new
String EmpId = "";
String BorrowerFirstName = "";
String BorrowerLastName = "";
String PhoneNumber = "";
String DateOfBirth = "";
String MaritalStatus = "";
String Gender = "";
String AddressLine1 = "";
String AddressLine2 = "";
String AddressCity = "";
String AddressState = "";
String AddressPinCode = "";
String PanNumber = "";
String AadhhaarNumber = "";
String LoanAgreemenCopy = "";
String SalaryConsentCopy = ""; // new
String KycReportCopy = "";
String DataDocCopy = "";
String PanCardCopy = "";
String AadhaarCardCopy = "";
String Selfie = "";
String EmployerName = "";
String DateOfJoining = "";
String EmployementType = "";
String EmployementStatus = "";
String Designation = "";
String SalaryPayoutDate = "";
Double GrossSalary = 0.0;
Double NetSalary = 0.0;
String BankAccountName = "";
String BankName = "";
String IfscCode = "";
String BankAccountNumber = "";
Double Eligibility = 0.0;
String EligibilityPercentage = "";
String DisbursementTranche = "";
String AvailableLimit = "";
String SubscriptionFee = "";
String Gst = "";
String LenderLoanAmount = "";
String SettlementAmount = "";
String RepaymentDate = "";
String DisbursementDate = "";
ActivationStaging ActivationStaging;
List<ActivationStaging> ActivationStagingList = new ArrayList<ActivationStaging>();
for (int i = 0; i < mList.size(); i++) {
try {
ActivationStaging = new ActivationStaging();
for (Entry<String, Object> entry : mList.get(i).entrySet()) {
try {
System.out.println(entry);
if (entry.getKey().toLowerCase().contains(Keys[0].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[0])) {
System.out.println(entry.getValue().toString().trim());
Client = entry.getValue().toString().trim();
System.out.println("----- Client ---- " + Client);
}
/*
* if (Date != null && Date != "") {
* String DateOfTxnformateedSt = DateUtlis.getYYYYMMDDFromddMMMYYYY(Date);
*
* SimpleDateFormat fmtOut = new SimpleDateFormat("yyyy-MM-dd HH:ss");
*
* Date = fmtOut.parse(DateOfTxnformateedSt);
*
* System.out.println("----- DateOfTxnSt ---- " + DateOfTxnSt);
* }
*/
}
if (entry.getKey().toLowerCase().contains(Keys[1].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[1])) {
System.out.println(entry.getValue().toString().trim());
ValyuApplicationId = entry.getValue().toString().trim();
}
System.out.println("----- ValyuApplicationId ---- " + ValyuApplicationId);
}
if (entry.getKey().toLowerCase().contains(Keys[2].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[2])) {
System.out.println(entry.getValue().toString().trim());
LenderLoanId = entry.getValue().toString().trim();
}
System.out.println("----- LenderLoanId ---- " + LenderLoanId);
}
if (entry.getKey().toLowerCase().contains(Keys[3].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[3])) {
System.out.println(entry.getValue().toString().trim());
EmpId = entry.getValue().toString().trim();
}
System.out.println("----- EmpId ---- " + EmpId);
}
if (entry.getKey().toLowerCase().contains(Keys[4].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[4])) {
System.out.println(entry.getValue().toString().trim());
BorrowerFirstName = entry.getValue().toString().trim();
}
System.out.println("----- BorrowerFirstName ---- " + BorrowerFirstName);
}
if (entry.getKey().toLowerCase().contains(Keys[5].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[5])) {
System.out.println(entry.getValue().toString().trim());
BorrowerLastName = entry.getValue().toString().trim();
}
System.out.println("----- BorrowerLastName ---- " + BorrowerLastName);
}
if (entry.getKey().toLowerCase().contains(Keys[6].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[6])) {
System.out.println(entry.getValue().toString().trim());
PhoneNumber = entry.getValue().toString().trim();
}
System.out.println("----- PhoneNumber ---- " + PhoneNumber);
}
if (entry.getKey().toLowerCase().contains(Keys[7].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[7])) {
System.out.println(entry.getValue().toString().trim());
DateOfBirth = entry.getValue().toString().trim();
}
System.out.println("----- DateOfBirth ---- " + DateOfBirth);
}
if (entry.getKey().toLowerCase().contains(Keys[8].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[8])) {
System.out.println(entry.getValue().toString().trim());
MaritalStatus = entry.getValue().toString().trim();
}
System.out.println("----- MaritalStatus ---- " + MaritalStatus);
}
if (entry.getKey().toLowerCase().contains(Keys[9].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[9])) {
System.out.println(entry.getValue().toString().trim());
Gender = entry.getValue().toString().trim();
}
System.out.println("----- Gender ---- " + Gender);
}
if (entry.getKey().toLowerCase().contains(Keys[10].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[10])) {
System.out.println(entry.getValue().toString().trim());
AddressLine1 = entry.getValue().toString().trim();
}
System.out.println("----- AddressLine1 ---- " + AddressLine1);
}
if (entry.getKey().toLowerCase().contains(Keys[11].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[11])) {
System.out.println(entry.getValue().toString().trim());
AddressLine2 = entry.getValue().toString().trim();
}
System.out.println("----- AddressLine2 ---- " + AddressLine2);
}
if (entry.getKey().toLowerCase().contains(Keys[12].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[12])) {
System.out.println(entry.getValue().toString().trim());
AddressCity = entry.getValue().toString().trim();
}
System.out.println("----- AddressCity ---- " + AddressCity);
}
if (entry.getKey().toLowerCase().contains(Keys[13].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[13])) {
System.out.println(entry.getValue().toString().trim());
AddressState = entry.getValue().toString().trim();
}
System.out.println("----- AddressState ---- " + AddressState);
}
if (entry.getKey().toLowerCase().contains(Keys[14].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[14])) {
System.out.println(entry.getValue().toString().trim());
AddressPinCode = entry.getValue().toString().trim();
}
System.out.println("----- AddressPinCode ---- " + AddressPinCode);
}
if (entry.getKey().toLowerCase().contains(Keys[15].toLowerCase())) {
if (entry.getKey().toString().toLowerCase().equalsIgnoreCase(Keys[15].toLowerCase())) {
PanNumber = entry.getValue().toString().trim();
}
System.out.println("----- PanNumber ---- " + PanNumber);
}
if (entry.getKey().toLowerCase().contains(Keys[16].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[16])) {
AadhhaarNumber = entry.getValue().toString().trim();
}
System.out.println("----- AadhhaarNumber ---- " + AadhhaarNumber);
}
if (entry.getKey().toLowerCase().contains(Keys[17].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[17])) {
LoanAgreemenCopy = entry.getValue().toString().trim();
}
System.out.println("----- LoanAgreemenCopy ---- " + LoanAgreemenCopy);
}
if (entry.getKey().toLowerCase().contains(Keys[18].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[18])) {
SalaryConsentCopy = entry.getValue().toString().trim();
}
System.out.println("----- SalaryConsentCopy ---- " + SalaryConsentCopy);
}
if (entry.getKey().toLowerCase().contains(Keys[19].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[19])) {
KycReportCopy = entry.getValue().toString().trim();
}
System.out.println("----- KycReportCopy ---- " + KycReportCopy);
}
if (entry.getKey().toLowerCase().contains(Keys[20].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[20])) {
DataDocCopy = entry.getValue().toString().trim();
}
System.out.println("----- DataDocCopy ---- " + DataDocCopy);
}
if (entry.getKey().toLowerCase().contains(Keys[21].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[21])) {
PanCardCopy = entry.getValue().toString().trim();
}
System.out.println("----- PanCardCopy ---- " + PanCardCopy);
}
if (entry.getKey().toLowerCase().contains(Keys[22].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[22])) {
AadhaarCardCopy = entry.getValue().toString().trim();
}
System.out.println("----- AadhaarCardCopy ---- " + AadhaarCardCopy);
}
if (entry.getKey().toLowerCase().contains(Keys[23].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[23])) {
Selfie = entry.getValue().toString().trim();
}
System.out.println("----- Selfie ---- " + Selfie);
}
if (entry.getKey().toLowerCase().contains(Keys[24].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[24])) {
EmployerName = entry.getValue().toString().trim();
}
System.out.println("----- EmployerName ---- " + EmployerName);
}
if (entry.getKey().toLowerCase().contains(Keys[25].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[25])) {
DateOfJoining = entry.getValue().toString().trim();
}
System.out.println("----- DateOfJoining ---- " + DateOfJoining);
}
if (entry.getKey().toLowerCase().contains(Keys[26].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[26])) {
EmployementType = entry.getValue().toString().trim();
}
System.out.println("----- EmployementType ---- " + EmployementType);
}
if (entry.getKey().toLowerCase().contains(Keys[27].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[27])) {
EmployementStatus = entry.getValue().toString().trim();
}
System.out.println("----- EmployementStatus ---- " + EmployementStatus);
}
if (entry.getKey().toLowerCase().contains(Keys[28].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[28])) {
Designation = entry.getValue().toString().trim();
}
System.out.println("----- Designation ---- " + Designation);
}
if (entry.getKey().toLowerCase().contains(Keys[29].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[29])) {
SalaryPayoutDate = entry.getValue().toString().trim();
}
System.out.println("----- SalaryPayoutDate ---- " + SalaryPayoutDate);
}
if (entry.getKey().toLowerCase().contains(Keys[30].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[30])) {
GrossSalary = Double.parseDouble(entry.getValue().toString().trim());
}
System.out.println("----- GrossSalary ---- " + GrossSalary);
}
if (entry.getKey().toLowerCase().contains(Keys[31].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[31])) {
NetSalary = Double.parseDouble(entry.getValue().toString().trim());
}
System.out.println("----- NetSalary ---- " + NetSalary);
}
if (entry.getKey().toLowerCase().contains(Keys[32].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[32])) {
BankAccountName = entry.getValue().toString().trim();
}
System.out.println("----- BankAccountName ---- " + BankAccountName);
}
if (entry.getKey().toLowerCase().contains(Keys[33].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[33])) {
BankName = entry.getValue().toString().trim();
}
System.out.println("----- BankName ---- " + BankName);
}
if (entry.getKey().toLowerCase().contains(Keys[34].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[34])) {
IfscCode = entry.getValue().toString().trim();
}
System.out.println("----- IfscCode ---- " + IfscCode);
}
if (entry.getKey().toLowerCase().contains(Keys[35].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[35])) {
BankAccountNumber = entry.getValue().toString().trim();
}
System.out.println("----- BankAccountNumber ---- " + BankAccountNumber);
}
if (entry.getKey().toLowerCase().contains(Keys[36].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[36])) {
Eligibility = Double.parseDouble(entry.getValue().toString().trim());
}
System.out.println("----- Eligibility ---- " + Eligibility);
}
if (entry.getKey().toLowerCase().contains(Keys[37].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[37])) {
EligibilityPercentage = entry.getValue().toString().trim();
}
System.out.println("----- EligibilityPercentage ---- " + EligibilityPercentage);
}
if (entry.getKey().toLowerCase().contains(Keys[38].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[38])) {
DisbursementTranche = entry.getValue().toString().trim();
}
System.out.println("----- DisbursementTranche ---- " + DisbursementTranche);
}
if (entry.getKey().toLowerCase().contains(Keys[39].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[39])) {
AvailableLimit = entry.getValue().toString().trim();
}
System.out.println("----- AvailableLimit ---- " + AvailableLimit);
}
if (entry.getKey().toLowerCase().contains(Keys[40].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[40])) {
SubscriptionFee = entry.getValue().toString().trim();
}
System.out.println("----- SubscriptionFee ---- " + SubscriptionFee);
}
if (entry.getKey().toLowerCase().contains(Keys[41].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[41])) {
Gst = entry.getValue().toString().trim();
}
System.out.println("----- Gst ---- " + Gst);
}
if (entry.getKey().toLowerCase().contains(Keys[42].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[42])) {
LenderLoanAmount = entry.getValue().toString().trim();
}
System.out.println("----- LenderLoanAmount ---- " + LenderLoanAmount);
}
if (entry.getKey().toLowerCase().contains(Keys[43].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[43])) {
SettlementAmount = entry.getValue().toString().trim();
}
System.out.println("----- SettlementAmount ---- " + SettlementAmount);
}
if (entry.getKey().toLowerCase().contains(Keys[44].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[44])) {
RepaymentDate = entry.getValue().toString().trim();
}
System.out.println("----- RepaymentDate ---- " + RepaymentDate);
}
if (entry.getKey().toLowerCase().contains(Keys[45].toLowerCase())) {
if (entry.getKey().toString().equalsIgnoreCase(Keys[45])) {
DisbursementDate = entry.getValue().toString().trim();
}
System.out.println("----- DisbursementDate ---- " + DisbursementDate);
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
// ----------------------------------------- Save data to table
// ---------------------------------------------------------//
ActivationStaging.setClient(Client);
ActivationStaging.setValyu_application_id(ValyuApplicationId);
ActivationStaging.setLender_loan_id(LenderLoanId);
ActivationStaging.setEmp_id(EmpId);
ActivationStaging.setBorrower_first_name(BorrowerFirstName);
ActivationStaging.setBorrower_last_name(BorrowerLastName);
ActivationStaging.setPhone_number(PhoneNumber);
ActivationStaging.setDate_of_birth(DateOfBirth);
ActivationStaging.setMarital_status(MaritalStatus);
ActivationStaging.setGender(Gender);
;
ActivationStaging.setAddress_line1(AddressLine1);
ActivationStaging.setAddress_line2(AddressLine2);
ActivationStaging.setAddress_city(AddressCity);
ActivationStaging.setAddress_state(AddressState);
ActivationStaging.setAddress_pin_code(AddressPinCode);
ActivationStaging.setPan_number(PanNumber);
ActivationStaging.setAadhhaar_number(AadhhaarNumber);
ActivationStaging.setLoan_agreement_copy(LoanAgreemenCopy);
ActivationStaging.setSalary_consent_copy(SalaryConsentCopy);
ActivationStaging.setKyc_report_copy(KycReportCopy);
ActivationStaging.setData_doc_copy(DataDocCopy);
ActivationStaging.setPan_card_copy(PanCardCopy);
ActivationStaging.setAadhaar_card_copy(AadhaarCardCopy);
ActivationStaging.setSelfie(Selfie);
ActivationStaging.setEmployer_name(EmployerName);
ActivationStaging.setDate_of_joining(DateOfJoining);
ActivationStaging.setEmployement_type(EmployementType);
ActivationStaging.setEmployement_status(EmployementStatus);
ActivationStaging.setDesignation(Designation);
ActivationStaging.setSalary_payout_date(SalaryPayoutDate);
ActivationStaging.setGross_salary(GrossSalary);
ActivationStaging.setNet_salary(NetSalary);
ActivationStaging.setBank_account_name(BankAccountName);
ActivationStaging.setBank_name(BankName);
ActivationStaging.setIfsc_code(IfscCode);
ActivationStaging.setBank_account_number(BankAccountNumber);
ActivationStaging.setEligibility(Eligibility);
ActivationStaging.setEligibility_percentage(EligibilityPercentage);
ActivationStaging.setDisbursement_tranche(DisbursementTranche);
ActivationStaging.setAvailable_limit(AvailableLimit);
ActivationStaging.setSubscription_fee(SubscriptionFee);
ActivationStaging.setGst(Gst);
ActivationStaging.setLender_loan_amount(LenderLoanAmount);
ActivationStaging.setSettlement_amount(SettlementAmount);
ActivationStaging.setRepayment_date(RepaymentDate);
ActivationStaging.setDisbursement_date(DisbursementDate);
ActivationStaging.setIs_processed(PROCESSING);
ActivationStaging.setRemarks(MobikwikConstantData.TEXT_PROCESS);
ActivationStaging.setCreated_by(mPartner.getUid());
ActivationStaging.setUpdated_by(mPartner.getUid());
ActivationStaging.setUpated_date(new Date());
// Add data to list//
ActivationStagingList.add(ActivationStaging);
sUBDetailsValyuStagingRepo.save(ActivationStaging);
// ----------------------------------------------------------------------------------------------------------------------//
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
}
//-----------------------------------------------------//
public class CommonCSVParser {
// ------------------------------------------//
public static List<Map<String, Object>> getMapFromCSV(MultipartFile multipartFile) {
try {
CSVParser parser = parseCSV(multipartFile.getInputStream());
return getMap(parser.getRecords(), parser.getHeaderMap());
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
private static List<Map<String, Object>> getMap(List<CSVRecord> records, Map<String, Integer> headers) {
Map<Integer, String> headerMap = formatHeaderMap(headers);
List<Map<String, Object>> data = new ArrayList<>();
for (int i = 0; i < records.size(); i++) {
Map<String, Object> map = new HashMap<>();
try {
CSVRecord record = records.get(i);
for (int j = 0; j < record.size(); j++) {
map.put(headerMap.get(j), record.get(j));
}
data.add(map);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
return data;
}
private static Map<Integer, String> formatHeaderMap(Map<String, Integer> map) {
Map<Integer, String> data = new HashMap<>();
map.forEach((k, v) -> {
data.put(v, k);
});
return data;
}
private static CSVParser parseCSV(InputStream inputStream) {
try {
return new CSVParser(new InputStreamReader(inputStream), CSVFormat.DEFAULT.withFirstRecordAsHeader()
.withIgnoreHeaderCase().withSkipHeaderRecord().withTrim());
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}
Upvotes: 0
Reputation:
public interface SUBDetailsValyuStagingRepo extends CrudRepository<ActivationStaging, Long> {
@Modifying
@Query(value = "UPDATE valyu_user_activation_staging SET is_processed=:is_processed,remarks=:remarks WHERE lender_cif_id=:lender_cif_id", nativeQuery = true)
@Transactional
void updateIsProccess(@Param("lender_cif_id") long lender_cif_id, @Param("is_processed") int is_processed,
@Param("remarks") String remarks);
}
@Entity
@Table(name = "activation_staging")
public class ActivationStaging {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Long lender_cif_id;
String client;
// String product_type;
String valyu_application_id;// new
String lender_loan_id;// new
String emp_id;
String borrower_first_name;
String borrower_last_name;
String phone_number;
String date_of_birth;
String marital_status;
String gender;
String address_line1;
String address_line2;
String address_city;
String address_state;
String address_pin_code;
String pan_number;
String aadhhaar_number;
String loan_agreement_copy;
String salary_consent_copy;// new
String kyc_report_copy;
String data_doc_copy;
String pan_card_copy;
String aadhaar_card_copy;
String selfie;
String employer_name;
String date_of_joining;
String employement_type;
String employement_status;
String designation;
String salary_payout_date;
Double gross_salary;
Double net_salary;
String bank_account_name;
String bank_name;
String Ifsc_code;
String bank_account_number;
Double eligibility;
String eligibility_percentage;
String disbursement_tranche;
String available_limit;
String subscription_fee;
String gst;
String lender_loan_amount;
String settlement_amount;
String repayment_date;
String disbursement_date;
long created_by;
long updated_by;
Date created_date = new Date();
Date upated_date;
int is_processed = 1; // PROCESSING=1 / COMPLETE =2
String remarks;
}
Upvotes: 0
Reputation: 939
I got solution for this ! I modify it as follows:
@PostMapping("/{testid}/consumers")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@ResponseStatus(HttpStatus.OK)
public Subscription createConsumer(@PathVariable String cid, @RequestParam("file") MultipartFile file)
And I am reading it as follows:
InputStream inputStream = file.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
list = br.lines().collect(Collectors.toList());
Upvotes: 1