Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Java FileOutputStream to write data to a File

import java.io.FileOutputStream;
public class Main {
    public static void main(String[] args) {
       String data = "This is a line of text inside the file.";
        try {
            FileOutputStream output = new FileOutputStream("output.txt");

            byte[] array = data.getBytes();

            // Writes byte to the file
            output.write(array);

            output.close();
        }
        catch(Exception e) {
            e.getStackTrace();
        }
    }
}
Comment

Java Create a FileOutputStream

// Including the boolean parameter
FileOutputStream output = new FileOutputStream(String path, boolean value);

// Not including the boolean parameter
FileOutputStream output = new FileOutputStream(String path);
Comment

PREVIOUS NEXT
Code Example
Java :: java formatted output 
Java :: android sha1 key 
Java :: Java Writer Using FileWriter 
Java :: math.absolute java 
Java :: spring filter exception handling 
Java :: programmatically click button javafx 
Java :: getcolor deprecated android 
Java :: boucle for avec un tableau java 
Java :: java constructor overloading 
Java :: map java 
Java :: mapping over a list of promises in javaascript 
Java :: Binary tree using linked list in Java 
Java :: linkedhashmap in java 
Java :: convert a int to string in java 
Java :: java list select field 
Java :: how to copy array in java 
Java :: nosuchelementexception 
Java :: Java printf() Method using PrintWriter 
Java :: json array get json object 
Java :: How to efficiently reverse a linked list, in Java? 
Java :: switch case enum java 
Java :: integer.tobinarystring returns 
Java :: recursion in java 
Java :: how to put string in char array in java tutorialspoint 
Java :: Cannot find a class with the main method. 
Java :: get input in java 
Java :: largest number in an array in java 
Java :: list java 
Java :: debug in java 
Java :: how to create an entry in java 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =