multipartFile转写入流循环读取每行的内容

 Reader reader = null;
        reader = new InputStreamReader(multipartFile.getInputStream(), "utf-8");
        BufferedReader br = new BufferedReader( reader);
        Date time=new Date();
            String line;
            while ((line = br.readLine()) != null) {
                // 一次读入一行数据
                EvWordGroup wordGroup=new EvWordGroup();
                if(line!=null && line!=""){
                    wordGroup.setId(UUIDGenerator.generate());
                    wordGroup.setTextContent(line);
                    wordGroup.setTypeId(typeId);
                    wordGroup.setCreateTime(time);
                    wordGroup.setCreateUser(getSySUserRowId());
                    wordGroup.setDeleteFlag(0);
                }
                lists.add(wordGroup);
            }
            reader.close();

你可能感兴趣的:(java实用)