Questions tagged [fileoutputstream]

FileOutputStream is a Java class used to write bytes directly to a File or to a FileDescriptor.

FileOutputStream is a Java class used to write bytes directly to a File or to a FileDescriptor.

Whether or not a file is available or may be created depends upon the underlying platform. Some platforms, in particular, allow a file to be opened for writing by only one FileOutputStream (or other file-writing object) at a time. In such situations the constructors in this class will fail if the file involved is already open.

FileOutputStream is meant for writing streams of raw bytes such as image data. For writing streams of characters, consider using FileWriter.

1128 questions
-2
votes
1 answer

Using Two OutputStreams and BufferedWriters in Java

I was curious if anyone could help me understand what I'm doing wrong. I'm just learning how to use OutputStreams and BufferedWriters in Java and I'm not sure I'm doing it right. I know how to use one OutputStream and BufferedWriter but my problem…
-2
votes
1 answer

loading file to java application

I am trying to load a file which I saved of a simple class. Below you can find my code which im using to load, the class which I need to cast is NewClientClass. JFileChooser fc = new JFileChooser(); int returnVal = fc.showOpenDialog(null); …
-2
votes
1 answer

Serializing object with java

I am trying to serialize an object with ObjectOutputStream and FileOutputStream, however an error with the class name is being shown. JFileChooser fc = new JFileChooser(); NewClientClass AddClient = new NewClientClass(IDNumber.getText(),…
-3
votes
2 answers

Is there an -1 at the end of an Inputstream?

I am quite new to programming. While reading the article Byte Streams in "Basic I/O" in The Java Tutorials by Oracle, I came accross this code: import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; public…
user14914317
-3
votes
1 answer

Return as ByteArrayOutputStream instead of FileOutputStream

I have a requirement to generate PDF file from JSON Objects and am able to produce PDF document using Apache FOP and Java. But i want to return the PDF file as ByteArrayOutputStream and then i have to encode like this…
Karthikeyan
  • 1,927
  • 6
  • 44
  • 109
-3
votes
1 answer

spring mvc outputStream csv

How to split de code into Service, repository and controller (Spring mvc) this code work for me but not good split. Big table large table to expose API REST @ApiOperation(value = "Search all customers",response = GoldenCustomer.class) …
BBAH
  • 46
  • 1
  • 6
-3
votes
1 answer

Writing a large resultset to an .xlsx file using Apache POI and JDBC

I'm trying to write a large(Total no of rows can be up to 2 million) resultset to an .xlsx file. To over come heap space or memory errors, I decided to fetch some limited set of records from table in each call and append the same to the file. Those…
-3
votes
2 answers

Writer not writing anything to file

public class AddDetails extends Application { private final String FileName = "C:\\Users\\marsh\\OneDrive\\Documents\\CustomPrograms\\CalcProb\\Players.txt"; private String Name; private char Hand1, Hand1; private double Skill1,…
-3
votes
2 answers

FileOutputStream alternative for Java 1.6

I have to retrofit a piece of java code that must be compatible with Java 1.6 and I'm looking for an alternative for fileoutputstream in the following function. I am using apache.commons FTP package. import org.apache.commons.net.ftp.FTP; import…
Tacitus86
  • 1,314
  • 2
  • 14
  • 36
-3
votes
1 answer

How to make a folder which contains many files in Java?

I want to make a folder which contains files that my program made. For example (this example doesn't represent the things that my program actually does): private static HashMap numbers = new HashMap<>(); private static ListIterator…
F.Stan
  • 553
  • 1
  • 10
  • 23
-3
votes
1 answer

Image read/write in Java without imageio between local file systems

I'm very new to Java and I'm recently making a program which reads image files(jpg) from one directory, and write(copy) them to another directory. I can't use imageio or move/copy methods and I also have to check the time consuming caused by the R/W…
hamm.tax
  • 13
  • 3
-3
votes
1 answer

two matrix output into a single txt file in matlab

I've two matrix output from two Matlab scripts and I'd like to write both results in different columns of the same GUI output in a txt file. Could you please help me?
-3
votes
1 answer

Replace Random Access File Logics with FileOutput streams

My code currently use RandomAccessFile to read a ZIP file. The code is taken from a open source project. I need to make RANDOM Access File operation in memory without creating a physical File in the disk. So need to replace functionality of…
user3693532
  • 61
  • 1
  • 3
-3
votes
3 answers

using FileInputStream and FileOutputStream

Hi I had a couple of questions about using the FileInputStream and FileOutputStream classes. How would FileInputStream objects locate a file it is trying to read in? Where would FileOutputStream save a file to? Thanks.
user2910237
  • 133
  • 1
  • 2
  • 7
-4
votes
2 answers

FileNotFoundException:EACCES (Permission denied)

I get data from my service : JSONObject userGuid = new JSONObject(); userGuid.put("userGuid", id); Bitmap bitmap = null; String response = HttpUtil.post(mService + "GetUser", userGuid.toString(), mCookie); …
sayres
  • 361
  • 1
  • 4
  • 15
1 2 3
75
76