Posts

Showing posts with the label binary data storage

Handling Primitive Data Types in Java I/O जावा I/O में प्रिमिटिव डेटा टाइप्स को संभालना

Java provides special Data Streams to read and write primitive data types like int , float , boolean , and char . जावा डाटा स्ट्रीम्स प्रदान करता है जो प्रिमिटिव डेटा टाइप्स जैसे int , float , boolean , और char को पढ़ने और लिखने के लिए उपयोग होती हैं। Key Points / मुख्य बिंदु:- DataOutputStream writes primitive data types to a file. DataOutputStream फाइल में प्रिमिटिव डेटा टाइप्स लिखता है। DataInputStream reads primitive data types from a file. DataInputStream फाइल से प्रिमिटिव डेटा टाइप्स पढ़ता है। These are useful for structured data storage. यह स्ट्रक्चर्ड डेटा स्टोरेज के लिए उपयोगी हैं। 💻 Example 1: Writing Primitive Data Types import java.io.*; public class WritePrimitives { public static void main(String[] args) { try { FileOutputStream fos = new FileOutputStream("data.bin"); DataOutputStream dos = new DataOutputStream(fos); dos.writeInt(101); dos.writeUTF("Ajay"); ...