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;
@Getter @Getter
public class PageResponse<E>{ public class PageResponse<E>{
private List<E> rows; // 每页记录集合 private List<E> rows; // 每页记录集合
private String status;
private Long total; private Long total;
} }

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

@ -72,6 +72,29 @@ public class FileUtil {
return null; 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; * Read file and return content in string;
* @param file * @param file

Loading…
Cancel
Save