Questions tagged [dataoutputstream]

A mechanism for writing abstract data to a stream

A DataOutputStream is a mechanism for writing any abstract data to a stream, regardless of the type of the data. A stream is usually comprised of data to write to a local file, or data being transmitted to a remote server over a network protocol such as HTTP or FTP.

An DataOutputStream is abstract, and doesn't describe the type of data that is being written. Typically, if you are able to, you would implement one of the subclasses instead, such as FileOutputStream, which more appropriately describes the type of data being handled, and provides additional methods appropriate for that data type.

257 questions
0
votes
0 answers

Upload File via DataOutputStream does not work

Im writing an Android App. This App should upload some pictures to my server via POST. It is working if I use picture smaller then 1MB. But if i use larger images the log says me that the image was uploaded but the image is not on the server. The…
Dennis
  • 143
  • 5
  • 17
0
votes
6 answers

Issue with FileOutputStream and DataOutput Stream

The problem is when I write a character using FileOutputStream it is readable. But when I chain it with DataOutputStream the written data becomes unreadable. Why is that ? Since both FileOutputStream and DataInputStream write in bytes to the file. …
Jeevan Varughese
  • 2,159
  • 2
  • 15
  • 20
0
votes
0 answers

Empty lines when writing binary data to file with DataOutputStream

I'm working on an iOS and Android app where I have to download PDF files from the server in the form of binary data and write them to the disk. When I try to open the files with Adobe Reader on Android devices I get an invalid format error whilst it…
Jerry
  • 13
  • 1
  • 4
0
votes
1 answer

WriteUTF and ReadUTF, how can i write a string and get a short exception in another side?

Basically i'm doing a socket connection between two sides. A Java server and a Android client. I'm converting objects to String Json using Gson library , and sending them through method WriteUTF from Android client. But when i try to get response…
0
votes
2 answers

DataOutputStream.write(int b) doesn't write

i'm writing a java program in eclipse that take a file as input and write a new file as output follow some logic. i use datainputstream for the input file and dataoutputstream for the output file. i use those for the readln() method that works…
user3179805
0
votes
1 answer

Java: String Comparison between FileOutputStream and ByteArrayOutputStream

I have a piece of code that writes to a file using a DataOutputStream wrapped around a FileOutputStream, and writes to a string using a DataOutputStream wrapped around a ByteArrayOutputStream, both using the writeDouble() method. I then try to read…
0
votes
0 answers

DataOutPutstream Http GET request stream order

The following code statement works properly, I am expecting it does not work properly since "GET /index.html HTTP/1.0\n\n" text has to be send first then other parameters have to be send in correct scenario. Is there any streaming reverse order…
Ahmet Karakaya
  • 9,899
  • 23
  • 86
  • 141
0
votes
3 answers

Problems reading from binary file or creating it

When I create the file I use the dataoutputstream to write one 'int' at a time: Database.write(0) Of course it doesn't say 0 it's a variable there but I printed it and the first one is 0 so I'm taking that one as an example. Now I'm not 100% sure,…
David Ekermann
  • 87
  • 3
  • 13
0
votes
1 answer

Why do I get a (java) NullPointerException when writing to a socket's output, defined on another thread?

I'm trying to create a simple client/server app in java, it has a main that starts a thread - the listener thread and a runnable - the sender thread. They communicate with a working program. The socket is created on the Listener thread, as are the…
0
votes
1 answer

Java update server not receiving client input

I'm writing a server in Java that will give a response to the client, which sends the server the client name. Looking at the command line output from the server, it succesfully creates a connection to the client, but it's just stuck on waiting for…
0
votes
0 answers

Why there's broken pipe in my dos.write(buffer, 0, bufferSize)?

I'm having a big problem in writing in my dos.write it gives me a broken pipe and I don't know how to fix it. Can anyone suggest the proper way of handling this type of error. I search to the web and says the problem is the connection but when I…
NewDroidDev
  • 1,656
  • 5
  • 19
  • 33
0
votes
3 answers

DataOutputStream not flushing

I have a Java Client which sends UTF-8 strings to a C# TCP-Server, I'm using a DataOutputStream to send the strings. The code looks like this: public void sendUTF8String(String ar) { if (socket.isConnected()) { try { …
Alexander Stolz
  • 7,454
  • 12
  • 57
  • 64
0
votes
1 answer

How to send chunk files in web api in android?

I'm sending a files that is greater than 2mb. In able to send this file I need to divide this file into smaller pieces with the size of 2mb per pieces[chunks] and send it by chunk. I already divided the files into smaller chunks and send it to web…
NewDroidDev
  • 1,656
  • 5
  • 19
  • 33
0
votes
2 answers

Why it returns Internal Server Error on httpUrlConnection?

I'm developing an application that can send different files to web server.Also I want to send large files, in able to do this I need to chunk the files. But when I'm sending the files to server nothing is uploaded. I don't know if there's error on…
NewDroidDev
  • 1,656
  • 5
  • 19
  • 33
0
votes
1 answer

Why does this DataOutputStream print gibberish after my name?

everything in the question is in the title. there's a lot of gibberish after "my name" in the output. import java.io.*; public class DOStry { public static void main(String[] args) { String file = "file.txt"; String stra = "my name"; …
novalsi
  • 71
  • 1
  • 11