org.yelong.support.servlet.wrapper.BufferedServletInputStream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yelong-support Show documentation
Show all versions of yelong-support Show documentation
对各种开源框架的包装、支持、拓展。这里也包含的yelong-core与orm框架的整合。
默认对所有依赖为 scope 为 provided 。您需要针对自己的需要进行再次依赖
/**
*
*/
package org.yelong.support.servlet.wrapper;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
/**
* @author PengFei
*/
public class BufferedServletInputStream extends ServletInputStream {
private ByteArrayInputStream inputStream;
public BufferedServletInputStream(byte[] buffer) {
this.inputStream = new ByteArrayInputStream(buffer);
}
@Override
public int available() throws IOException {
return inputStream.available();
}
@Override
public boolean isFinished() {
return inputStream.available() == 0;
}
@Override
public boolean isReady() {
return true;
}
@Override
public void setReadListener(ReadListener readListener) {
}
@Override
public int read() throws IOException {
return inputStream.read();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy