Windows have a command line utility called Fsutil that can help you to create the respective file size you want.
The following command create a dummy file called “test.txt” with 1 GB file size. Just copy and paste into your cmd.
public final class ManuallyCastorGeneratorKeyUUID {
private DecimalFormat _df = new DecimalFormat();
private String _sHost = null;
private static long _staticCounter = 0;
// Method extracted from UUIDKeyGenerator
public String generateKey() {
String sUUID = null;
try {
// getting IP (fixed length: 12 character)
if(_sHost == null)
_sHost = InetAddress.getLocalHost().getHostAddress();
StringTokenizer st = new StringTokenizer(_sHost, ".");
_df.applyPattern("000");
while(st.hasMoreTokens()) {
if(sUUID == null)
sUUID = _df.format(new Integer(st.nextToken()));
else
sUUID += _df.format(new Integer(st.nextToken()));
}
// getting currentTimeMillis (fixed length: 13 character)
_df.applyPattern("0000000000000");
sUUID += _df.format(System.currentTimeMillis());
// getting static counter (fixed length: 15 character)
if(_staticCounter >= 99999) // 99999 generated keys in one timer interval? no...
_staticCounter = 0;
_staticCounter++;
_df.applyPattern("00000");
sUUID += _df.format(_staticCounter);
} catch ( Exception ex ) {
ex.printStackTrace();
}
return sUUID;
}
public static void main(String args[]) {
ManuallyCastorGeneratorKeyUUID g = new ManuallyCastorGeneratorKeyUUID();
for(int i=0; i<10; i++) {
System.out.println("insert into table (uuid, column1, column2) values ('" + g.generateKey() +"', value1, value2);");
}
}
}
public class DynamicJasperTemplate {
protected JasperPrint jp;
protected JasperReport jr;
protected Map params = new HashMap();
protected DynamicReport dr;
public void buildReport() throws Exception {
params.put("ReportTitle1", "Report Title");
DynamicReportBuilder drb = new DynamicReportBuilder();
Font font = new Font(10,"Sarif",true);
Style headerStyle = new Style();
headerStyle.setFont(font);
headerStyle.setHorizontalAlign(HorizontalAlign.LEFT);
headerStyle.setVerticalAlign(VerticalAlign.MIDDLE);
font = new Font(8,"Sarif",false);
Style detailStyle = new Style();
detailStyle.setFont(font);
detailStyle.setHorizontalAlign(HorizontalAlign.LEFT);
detailStyle.setVerticalAlign(VerticalAlign.MIDDLE);
for(int i=1; i<=10; i++) {
AbstractColumn column = ColumnBuilder.getInstance()
.setColumnProperty("Column"+i, String.class.getName())
.setTitle("Column "+i+" Title").setWidth(200)
.setStyle(detailStyle).setHeaderStyle(headerStyle).build();
drb.addColumn(column);
}
drb.setUseFullPageWidth(true);
// Pass the JasperReport Template to DynamicJasper
drb.setTemplateFile("C:/DynamicJasperTemplate.jrxml");
DynamicReport dr = drb.build();
JRDataSource ds = getDataSource();
jr = DynamicJasperHelper.generateJasperReport(dr, new ClassicLayoutManager(), params);
if (ds != null) {
jp = JasperFillManager.fillReport(jr, params, ds);
} else {
jp = JasperFillManager.fillReport(jr, params);
}
JasperExportManager.exportReportToPdfFile(jp,"C:/report-out.pdf");
}
protected JRDataSource getDataSource() {
// Generate dummy data to show in the report.
List records = new ArrayList();
for(int i=1; i<10; i++) {
Map columns = new HashMap();
for (int j=1; j<=10; j++) {
// The HashMap Key must save with ColumnProperty Name
columns.put("Column"+j, "Record "+i+" Column "+j+" data.");
}
records.add(columns);
}
JRDataSource ds = new JRMapCollectionDataSource(records);
return ds;
}
public static void main(String[] args) throws Exception {
DynamicJasperTemplate djt = new DynamicJasperTemplate();
djt.buildReport();
}
}
public class BasicJasperReportTest {
public static void main(String[] args) {
try {
JasperDesign jasperDesign = JRXmlLoader.load("C:/report1.jrxml");
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), new JREmptyDataSource());
JasperExportManager.exportReportToPdfFile(jasperPrint,"C:/report1.pdf");
JasperViewer.viewReport(jasperPrint);
} catch (JRException e) {
e.printStackTrace();
}
}
}
Recently I deployed a class file to production and this class file contains only Public Final Static Variables (I am not sure why they design it this way but I think the purpose is for easy to change in future) to be call by other classes. Then I notice the changes no taken place, no matter what I do. I delete the catch in Tomcat and Broswer but still the same. Until I do a full recompile and deploy to production it take the changes in place.
For example, you have 2 files called MainClass.java and StaticVariable.java. The MainClass.java file is calling the variable in StaticVariable.java file to get the value from the static variable. If you make some changes on the value in StaticVariable.java file without compiling MainClass.java, it will always remain the old value in MainClass.java. You have to recompile MainClass.java for the changes to take effect.
public class MainClass {
public static void main(String args[]) {
System.out.println(StaticVariable.HELLO);
}
}
public class StaticVariable {
public final static String HELLO = "HELLO";
//public final static String HELLO = "hello";
}
In order to get the new value in the variable, you have to recompile all the java files that calling the StaticVariable.java. That is a compile time constant.