ScrapExplorer - HelloWorld.java

Home / lab / FileConstruct / demos Lines: 1 | Size: 1365 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1/* FileConstruct 2 * Construct custom files with ease. 3 * 4 * Examples/HelloWorld.java 5 * 6 * COPYRIGHT NOTICE 7 * Copyright (C) 2024 0x4248 and contributors 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the license is not changed. 10 * 11 * This software is free and open source. Licensed under the GNU general 12 * public license version 3.0 as published by the Free Software Foundation. 13 */ 14 15package lab.FileConstruct.demos; 16 17import lab.FileConstruct.FileConstructor; 18 19public class HelloWorld { 20 21 public static void main(String[] args) { 22 // Basic strings 23 String HELLO = "Hello"; 24 String COMMA = ","; 25 26 // Single byte 27 byte SPACE = (byte) 0x20; 28 29 // Byte array 30 byte[] WORLD = new byte[] { 31 (byte) 0x57, 32 (byte) 0x6F, 33 (byte) 0x72, 34 (byte) 0x6C, 35 (byte) 0x64, 36 }; 37 38 // Hex string 39 String ENDING = "21 0A"; 40 41 // Create a new file constructor 42 FileConstructor FC = new FileConstructor(); 43 FC.filename = "hello_world.txt"; 44 45 // Add the bytes to the file 46 FC.PutASCII(HELLO); 47 FC.PutASCII(COMMA); 48 FC.PutByte(SPACE); 49 FC.PutBytes(WORLD); 50 FC.PutHexStr(ENDING); 51 52 // Write the file 53 FC.Dump(); 54 } 55} 56
[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.