Memory input stream (Simplified version of ReReadableInputStream, which accepts byte array)

This commit is contained in:
Honfika
2013-11-30 16:00:51 +01:00
parent 2af979dbd9
commit ab569f1dd2
18 changed files with 395 additions and 299 deletions
@@ -16,6 +16,7 @@
*/
package com.jpexs.helpers;
import com.jpexs.helpers.streams.SeekableInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -24,7 +25,7 @@ import java.io.InputStream;
*
* @author JPEXS
*/
public class ReReadableInputStream extends InputStream {
public class ReReadableInputStream extends SeekableInputStream {
InputStream is;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -48,7 +49,8 @@ public class ReReadableInputStream extends InputStream {
this.is = is;
}
public void setPos(long pos) throws IOException {
@Override
public void seek(long pos) throws IOException {
if (pos > count) {
this.pos = count;
skip(pos - count);