java.lang.Object
java.io.OutputStream
java.io.FileOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
- See Also:
- Top Examples, Source Code,
File
,
FileDescriptor
,
FileInputStream
public void close()
throws IOException
- See Also:
- OutputStream, Closeable
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[415]Write a string as bytes to a file
By Anonymous on 2005/04/05 11:04:02 Rate
OutputStream bos = new FileOutputStream ( "a file name" ) ;
bos.write ( "a string".getBytes ( ) ) ;
bos.close ( ) ;
bos = null;
public FileOutputStream(File file)
throws FileNotFoundException
- See Also:
SecurityManager.checkWrite(java.lang.String)
, SecurityException
, File.getPath()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[328]Create an PrintWriter that uses the given charset
By kuntal on 2003/12/22 14:29:28 Rate
PrintWriter out = new PrintWriter ( new OutputStreamWriter ( new FileOutputStream ( outfile, true ) , "UTF-8" ) ) ;
[700]Write to a file in UTF-8 format
By Anonymous on 2005/05/03 17:06:45 Rate
import java.io.*;
import java.lang.*;
import java.util.*;
import java.sql.*;
import java.io.StringReader;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.html.*;
import javax.swing.text.html.parser.*;
public class MultiType {
public static void main ( String [ ] args ) {
try
{
FileOutputStream outFile = new FileOutputStream ( "abc.txt" ) ;
DataOutputStream outData = new DataOutputStream ( outFile ) ;
String [ ] favList = { "Explorer", "Cabin", "Athlon PC" } ;
String here = null;
double [ ] priceList = { 2499.99, 45000.00, 995.95 } ;
here = "hi";
for ( int i=0;i < 3;i++ ) {
outData.writeUTF ( favList [ i ] ) ;
//outData.writeDouble ( priceList [ i ] ) ;
}
outData.writeUTF ( here ) ;
outData.close ( ) ;
}
catch ( Exception e )
{
e.printStackTrace ( ) ;
}
} // end main
}
public FileOutputStream(File file,
boolean append)
throws FileNotFoundException
- See Also:
SecurityManager.checkWrite(java.lang.String)
, SecurityException
, File.getPath()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public FileOutputStream(FileDescriptor fdObj)
- See Also:
SecurityManager.checkWrite(java.io.FileDescriptor)
, SecurityException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public FileOutputStream(String name)
throws FileNotFoundException
- See Also:
SecurityManager.checkWrite(java.lang.String)
, SecurityException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public FileOutputStream(String name,
boolean append)
throws FileNotFoundException
- See Also:
SecurityManager.checkWrite(java.lang.String)
, SecurityException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void finalize()
throws IOException
- See Also:
FileInputStream.close()
, Object
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public FileChannel getChannel()
- See Also:
position
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public final FileDescriptor getFD()
throws IOException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void write(byte[] b)
throws IOException
- See Also:
OutputStream.write(byte[], int, int)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[1349]Write byte array to a file
By shamaz on 2005/03/15 11:38:09 Rate
public static void store ( byte [ ] data, File file ) throws IOException
{
FileOutputStream fos = new FileOutputStream ( file ) ;
fos.write ( data ) ;
fos.close ( ) ;
}
public void write(byte[] b,
int off,
int len)
throws IOException
- See Also:
- OutputStream
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void write(int b)
throws IOException
- See Also:
- OutputStream
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples