Box-SDK-java :While uploading the file >2.15GB to folders throwing "Stream end while upload progress
Box-SDK-java :While uploading the file >2.15GB to folders in box for enterprise account using uploadLargeFile API it is throwing Stream ended while upload was progressing.
Code:
BoxDeveloperEditionAPIConnection serviceConnection = BoxDeveloperEditionAPIConnection.getAppEnterpriseConnection(boxConfig);
BoxDeveloperEditionAPIConnection userConnection = BoxDeveloperEditionAPIConnection.getAppUserConnection(serviceAccountUserId, boxConfig);
try {
/*//
break;*/
BoxFolder folder = new BoxFolder(userConnection, "7***phone number removed for privacy***");
FileInputStream stream= null;
String filePath = "C:\\Arokia\\box\\upload\\2.6GB.zip";
File myFile = new File(filePath);
stream = new FileInputStream(filePath);
String fileName = FilenameUtils.getBaseName(filePath.toString());
long startTime = System.currentTimeMillis();
for (BoxItem.Info itemInfo : folder) {
BoxFile.Info fileInfo = (BoxFile.Info) itemInfo;
BoxFile file = new BoxFile(userConnection, fileInfo.getID());
if(fileInfo.getName().equalsIgnoreCase(dirName)) {
file.delete();
}
}
System.out.println("Time Start For Uploading file "+startTime);
// BoxFile.Info fileInfo = folder.uploadLargeFile(stream,fileName, myFile.length());
final Duration timeout = Duration.ofSeconds(360);
System.out.println(timeout.toMillis());
BoxFile.Info fileInfo = folder.uploadLargeFile(stream,fileName, myFile.length(),3,timeout.toMillis(),TimeUnit.HOURS);
long endTime = System.currentTimeMillis() - startTime;
System.out.println("Time Taken For Uploading file "+endTime);
Please sign in to leave a comment.
Comments
1 comment