zoukankan      html  css  js  c++  java
  • 使用inputStream读取文件

    public class DemoT {

    public static void main(String[] args) throws Exception {
    ClassPathResource resource = new ClassPathResource("20200916_order_detail.csv");
    String path = resource.getPath();
    InputStream in = resource.getInputStream();
    byte[] b = new byte[2048];

    int c = 0;

    String str = "";

    while((c = in.read(b)) != -1){
    str += new String(b,0,c);//在此拼接
    }

    String[] s = str.split(" ");//以 来截取!转化为数组!
    System.out.println(s.length);
    System.out.println(s[1]);
    System.out.println(s[2]);
    }
    }

    如果是文件是其他路径下的

  • 相关阅读:
    RabbitMQ
    RabbitMQ
    RabbitMQ
    RabbitMQ
    RabbitMQ
    RabbitMQ
    RabbitMQ
    .net 5.0
    redis
    分布式同步服务中间件
  • 原文地址:https://www.cnblogs.com/you-hun/p/13706423.html
Copyright © 2011-2022 走看看