Browse Source

update

master
许孟阳 4 years ago
parent
commit
ed6279f300
  1. 1
      src/main/java/vip/xumy/core/pojo/com/PageResponse.java
  2. 23
      src/main/java/vip/xumy/core/utils/FileUtil.java

1
src/main/java/vip/xumy/core/pojo/com/PageResponse.java

@ -14,6 +14,5 @@ import lombok.Setter; @@ -14,6 +14,5 @@ import lombok.Setter;
@Getter
public class PageResponse<E>{
private List<E> rows; // 每页记录集合
private String status;
private Long total;
}

23
src/main/java/vip/xumy/core/utils/FileUtil.java

@ -71,6 +71,29 @@ public class FileUtil { @@ -71,6 +71,29 @@ public class FileUtil {
}
return null;
}
public static byte[] read(InputStream is) {
byte[] body = null;
try{
byte[] buf = new byte[20480];
int len = -1;
while ((len = is.read(buf)) != -1) {
if(body == null) {
body = new byte[len];
System.arraycopy(buf, 0, body, 0, len);
}else {
byte[] tmp = body;
body = new byte[len + tmp.length];
System.arraycopy(tmp, 0, body, 0, tmp.length);
System.arraycopy(buf, 0, body, tmp.length, len);
}
}
return body;
} catch (IOException e) {
log.error("Read file error.", e);
}
return null;
}
/**
* Read file and return content in string;

Loading…
Cancel
Save