com.github.xpenatan.gdx.backends.teavm.filesystem.FileData Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of backend-teavm Show documentation
Show all versions of backend-teavm Show documentation
Tool to generate libgdx to javascript using teaVM
package com.github.xpenatan.gdx.backends.teavm.filesystem;
public class FileData {
public static final int TYPE_DIRECTORY = 1;
public static final int TYPE_FILE = 2;
private final String path;
private final byte[] bytes;
private final int type;
public FileData(String path) {
this(path, TYPE_DIRECTORY, null);
}
public FileData(String path, byte[] bytes) {
this(path, TYPE_FILE, bytes);
}
public FileData(String path, int type, byte[] bytes) {
if(bytes != null && path.endsWith("/")) {
int length = path.length();
path = path.substring(0, length-1);
}
this.path = path;
this.bytes = bytes;
this.type = type;
}
public String getPath() {
return path;
}
public byte[] getBytes() {
return bytes;
}
public boolean isDirectory() {
return type == TYPE_DIRECTORY;
}
public int getType() {
return type;
}
public int getBytesSize() {
return bytes != null ? bytes.length : 0;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy