🎉 VideoCache 1.0 released

This commit is contained in:
Alexey Danilov
2015-04-01 14:24:35 +03:00
commit 70baa564c0
37 changed files with 2042 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
package com.danikula.videocache;
import java.io.ByteArrayInputStream;
/**
* Simple memory based {@link Source} implementation.
*
* @author Alexey Danilov (danikula@gmail.com).
*/
public class ByteArraySource implements Source {
private final byte[] data;
private ByteArrayInputStream arrayInputStream;
public ByteArraySource(byte[] data) {
this.data = data;
}
@Override
public int read(byte[] buffer) throws ProxyCacheException {
return arrayInputStream.read(buffer, 0, buffer.length);
}
@Override
public int available() throws ProxyCacheException {
return data.length;
}
@Override
public void open(int offset) throws ProxyCacheException {
arrayInputStream = new ByteArrayInputStream(data);
arrayInputStream.skip(offset);
}
@Override
public void close() throws ProxyCacheException {
}
}