use of org.elixir_lang.beam.chunk.Chunk in project intellij-elixir by KronicDeth.
the class Beam method from.
/*
* Static Methods
*/
@Nullable
public static Beam from(@NotNull DataInputStream dataInputStream) {
String header;
try {
header = typeID(dataInputStream);
} catch (IOException ioException) {
LOGGER.error("Could not read header from BEAM DataInputStream", ioException);
return null;
}
if (!HEADER.equals(header)) {
return null;
}
try {
length(dataInputStream);
} catch (IOException ioException) {
LOGGER.error("Could not read length from BEAM DataInputStream", ioException);
return null;
}
String section;
try {
section = typeID(dataInputStream);
} catch (IOException ioException) {
LOGGER.error("Could not read section header from BEAM DataInputStream", ioException);
return null;
}
if (!"BEAM".equals(section)) {
LOGGER.error("Section header is not BEAM");
return null;
}
List<Chunk> chunkList = new ArrayList<Chunk>();
int i = 1;
while (true) {
Chunk chunk;
try {
chunk = Chunk.from(dataInputStream);
} catch (IOException ioException) {
LOGGER.error("Could not read chunk number " + i + "from BEAM DataInputStream. " + "Returning truncated Beam object", ioException);
break;
}
if (chunk != null) {
chunkList.add(chunk);
} else {
break;
}
}
return new Beam(chunkList);
}
use of org.elixir_lang.beam.chunk.Chunk in project intellij-elixir by KronicDeth.
the class Beam method atoms.
/*
* Instance Methods
*/
@Nullable
public Atoms atoms() {
Atoms atoms = null;
Chunk chunk = chunk(ATOM);
if (chunk != null) {
atoms = Atoms.from(chunk);
}
return atoms;
}
use of org.elixir_lang.beam.chunk.Chunk in project intellij-elixir by KronicDeth.
the class Beam method exports.
@Nullable
public Exports exports() {
Exports exports = null;
Chunk chunk = chunk(EXPT);
if (chunk != null) {
exports = Exports.from(chunk);
}
return exports;
}