如何将文件逐行上传到Java中的Google云存储(PipedInputStream的实现)

我正在编写一个Java方法,以避免在将大文件上传到GCS时将其保存在内存中,我正在遵循how to upload file line by line to google cloud storage in java

中的操作

我想知道如何分配在那里使用的PipedInputStream。难道是来自另一个恐怖?我正在尝试与PipedOutputStream建立连接,但无法从文件中获取整行:

// previosly I stream lines in fileInputStream. Obtaining a variable named line 

PipedInputStream inputStream = new PipedInputStream();
PipedOutputStream outputStream = new PipedOutputStream();

try {
    inputStream.connect(outputStream);
    outputStream.write(line.getBytes());

   System.out.println("INPUT STREAM READING: " + (char)inputStream.read());
} catch (IOException e) {
    e.printStackTrace();
}

我正确使用管道流吗?以前没做过。

zhenggang5685 回答:如何将文件逐行上传到Java中的Google云存储(PipedInputStream的实现)

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3100873.html

大家都在问