diff options
author | Eric Roth <rothes.work@gmail.com> | 2015-09-15 22:31:07 -0400 |
---|---|---|
committer | Eric Roth <rothes.work@gmail.com> | 2015-09-15 22:52:10 -0400 |
commit | eb15b339a3a688cbb3b9a0c99dc1f062a5c5276b (patch) | |
tree | 29f8fd552cfdcfffdc3603708c0f59449461d523 /core/src/main/java | |
parent | ece85f5c231d97828d861610ffddb12e6da7f6c2 (diff) | |
download | nanohttpd-eb15b339a3a688cbb3b9a0c99dc1f062a5c5276b.tar.gz |
Remove PushBackInputStream.
Diffstat (limited to 'core/src/main/java')
-rw-r--r-- | core/src/main/java/fi/iki/elonen/NanoHTTPD.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/core/src/main/java/fi/iki/elonen/NanoHTTPD.java b/core/src/main/java/fi/iki/elonen/NanoHTTPD.java index da87bbb..4da8c58 100644 --- a/core/src/main/java/fi/iki/elonen/NanoHTTPD.java +++ b/core/src/main/java/fi/iki/elonen/NanoHTTPD.java @@ -49,7 +49,7 @@ import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; -import java.io.PushbackInputStream; +import java.io.BufferedInputStream; import java.io.RandomAccessFile; import java.io.UnsupportedEncodingException; import java.net.InetAddress; @@ -485,7 +485,7 @@ public abstract class NanoHTTPD { private final OutputStream outputStream; - private final PushbackInputStream inputStream; + private final BufferedInputStream inputStream; private int splitbyte; @@ -509,13 +509,13 @@ public abstract class NanoHTTPD { public HTTPSession(TempFileManager tempFileManager, InputStream inputStream, OutputStream outputStream) { this.tempFileManager = tempFileManager; - this.inputStream = new PushbackInputStream(inputStream, HTTPSession.BUFSIZE); + this.inputStream = new BufferedInputStream(inputStream, HTTPSession.BUFSIZE); this.outputStream = outputStream; } public HTTPSession(TempFileManager tempFileManager, InputStream inputStream, OutputStream outputStream, InetAddress inetAddress) { this.tempFileManager = tempFileManager; - this.inputStream = new PushbackInputStream(inputStream, HTTPSession.BUFSIZE); + this.inputStream = new BufferedInputStream(inputStream, HTTPSession.BUFSIZE); this.outputStream = outputStream; this.remoteIp = inetAddress.isLoopbackAddress() || inetAddress.isAnyLocalAddress() ? "127.0.0.1" : inetAddress.getHostAddress().toString(); this.headers = new HashMap<String, String>(); @@ -703,6 +703,7 @@ public abstract class NanoHTTPD { this.rlen = 0; int read = -1; + this.inputStream.mark(HTTPSession.BUFSIZE); try { read = this.inputStream.read(buf, 0, HTTPSession.BUFSIZE); } catch (Exception e) { @@ -726,7 +727,8 @@ public abstract class NanoHTTPD { } if (this.splitbyte < this.rlen) { - this.inputStream.unread(buf, this.splitbyte, this.rlen - this.splitbyte); + this.inputStream.reset(); + this.inputStream.skip(this.splitbyte); } this.parms = new HashMap<String, String>(); |