com.daxie.xops.bd1.BD1Writer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xopsmanipulator Show documentation
Show all versions of xopsmanipulator Show documentation
XOPSManipulator is a Java library that offers several functions to manipulate matters relating to X operations.
The newest version!
package com.daxie.xops.bd1;
import java.io.BufferedOutputStream;
import java.io.DataOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import com.daxie.basis.vector.Vector;
import com.daxie.log.LogFile;
import com.daxie.tool.ByteFunctions;
import com.daxie.tool.ExceptionFunctions;
/**
* Writes data to a BD1 file.
* @author Daba
*
*/
class BD1Writer {
private List blocks;
private Map texture_filenames_map;
public BD1Writer(List blocks,Map texture_filenames_map) {
this.blocks=blocks;
this.texture_filenames_map=texture_filenames_map;
}
public void Write(String bd1_filename) throws FileNotFoundException{
if(blocks==null||texture_filenames_map==null) {
LogFile.WriteWarn("[BD1Writer-Write] Data is null.",true);
return;
}
DataOutputStream dos;
dos=new DataOutputStream(
new BufferedOutputStream(
new FileOutputStream(bd1_filename)));
try {
//Texture filenames
Map sorted_texture_filenames_map=new TreeMap<>(texture_filenames_map);
int texture_count=0;
for(int texture_id:sorted_texture_filenames_map.keySet()) {
String texture_filename=sorted_texture_filenames_map.get(texture_id);
if(texture_filename.length()>30) {
texture_filename=texture_filename.substring(0, 30);
}
byte[] texture_filename_buffer=new byte[31];
int pos;
for(pos=0;pos
© 2015 - 2025 Weber Informatics LLC | Privacy Policy