Example usage for java.io ByteArrayInputStream read

List of usage examples for java.io ByteArrayInputStream read

Introduction

In this page you can find the example usage for java.io ByteArrayInputStream read.

Prototype

public synchronized int read() 

Source Link

Document

Reads the next byte of data from this input stream.

Usage

From source file:com.flexoodb.common.FlexUtils.java

static public void saveStringToFile(String filepath, String content) throws Exception {
    ByteArrayInputStream is = new ByteArrayInputStream(content.getBytes());
    java.io.FileOutputStream fos = new java.io.FileOutputStream(new File(filepath));
    while (is.available() > 0) {
        fos.write(is.read());
    }/*from w w  w  . jav a2  s  .  c o  m*/
    fos.close();
    is.close();
}