filebot/source/net/filebot/vfs/MemoryFile.java

40 lines
594 B
Java
Raw Normal View History

2014-04-19 02:30:29 -04:00
package net.filebot.vfs;
import java.nio.ByteBuffer;
public class MemoryFile {
2015-07-25 18:47:19 -04:00
private final String path;
2015-07-25 18:47:19 -04:00
private final ByteBuffer data;
2015-07-25 18:47:19 -04:00
public MemoryFile(String path, ByteBuffer data) {
// normalize folder separator
this.path = path.replace('\\', '/');
this.data = data;
}
2015-07-25 18:47:19 -04:00
public String getName() {
return path.substring(path.lastIndexOf("/") + 1);
}
2015-07-25 18:47:19 -04:00
public String getPath() {
return path;
}
2015-07-25 18:47:19 -04:00
public int size() {
return data.remaining();
}
public ByteBuffer getData() {
return data.duplicate();
}
2015-07-25 18:47:19 -04:00
@Override
public String toString() {
return path;
}
2015-07-25 18:47:19 -04:00
}