Java-dagi FileOutputStream sinfi
Download 18.53 Kb.
|
9-Amaliy mashg\'ulot
- Bu sahifa navigatsiya:
- Misol
Misol: Java FileOutputStream yordamida bitta baytli ma'lumotlarni yozingQuyidagi misol ko'rsatilgan faylga bitta bayt ma'lumotni qanday yozishni ko'rsatadi. U chiqish oqimiga yozish paytida baytni belgiga aylantiradi. Shuning uchun Chiqish faylida 75 baytning satr ekvivalenti bo'lgan "K" ma'lumotlar bo'ladi. import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class WriteFile { public static void main(String[] args) throws FileNotFoundException { FileOutputStream fo = new FileOutputStream("OutputFile.txt"); byte b = 75; try { fo.write(b); fo.close(); System.out.println("Single byte data successfully written to the file"); } catch (IOException e) { e.printStackTrace(); } }
} Single byte data successfully written to the file Download 18.53 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling