|
|
@@ -36,7 +36,7 @@ public class ObjectServiceImpl implements ObjectService {
|
|
|
// 20MiB
|
|
|
private final int blockSize = 1024*1024*20;
|
|
|
// 10MiB
|
|
|
- private final long partLength = 1024*1024;
|
|
|
+ private final long partLength = 1024*1024*10;
|
|
|
private FileStoreService fileStoreService;
|
|
|
private FileUrlService fileUrlService;
|
|
|
|
|
|
@@ -125,7 +125,10 @@ public class ObjectServiceImpl implements ObjectService {
|
|
|
FileMeta fileMeta = fileMetaMapper.findByObjectName(objectName);
|
|
|
if (fileMeta == null) {
|
|
|
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
|
|
- response.getOutputStream().write("".getBytes(StandardCharsets.UTF_8));
|
|
|
+
|
|
|
+ OutputStream outputStream = response.getOutputStream();
|
|
|
+ outputStream.flush();
|
|
|
+ outputStream.close();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -267,7 +270,7 @@ public class ObjectServiceImpl implements ObjectService {
|
|
|
HttpServletResponse response = ServletUtil.getResponse();
|
|
|
response.setStatus(HttpServletResponse.SC_OK);
|
|
|
response.setContentType(contentType);
|
|
|
- response.setHeader("Content-Length", ""+len);
|
|
|
+ //response.setHeader("Content-Length", ""+len);
|
|
|
|
|
|
OutputStream outputStream = response.getOutputStream();
|
|
|
List<DataBlock> list = dataBlockMapper.findByObjectId(objectId);
|
|
|
@@ -275,16 +278,15 @@ public class ObjectServiceImpl implements ObjectService {
|
|
|
String blockId = dataBlock.getBlockId();
|
|
|
String absolutePath = dataBlock.getAbsolutePath();
|
|
|
RandomAccessFile raf = new RandomAccessFile(absolutePath, "r");
|
|
|
- raf.seek(0);
|
|
|
|
|
|
- // 10MiB
|
|
|
- int bufSize = 1024*1024*10;
|
|
|
+ // 1MiB
|
|
|
+ int bufSize = 1024*1024;
|
|
|
byte[] buf = new byte[bufSize];
|
|
|
int readLen;
|
|
|
while ((readLen = raf.read(buf, 0, bufSize)) != -1) {
|
|
|
outputStream.write(buf, 0, readLen);
|
|
|
- outputStream.flush();
|
|
|
}
|
|
|
+ outputStream.flush();
|
|
|
outputStream.close();
|
|
|
raf.close();
|
|
|
}
|