Writing Binary Data : File Save Load « JSP « Java Tutorial

<%@ page import="java.io.*" %>
        <TITLE>Writing Binary Data</TITLE>

        <H1>Writing Binary Data</H1>
        This page writes binary data to a file.

            byte data[] = {1, 2, 3, 4};
            String file = application.getRealPath("/") + "test.dat";
            FileOutputStream fileoutputstream = new FileOutputStream(file);

            for (int i = 0; i < data.length; i++) {

        Four byte values were written to a file byte by byte.

23.51.File Save Load
23.51.1.Save Form Input to File using JSP
23.51.2.Index of Files
23.51.3.Read file
23.51.4.Writing Binary Data
23.51.5.Reading Binary Data