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
1
vote
1 answer

DataOutputStream write causing outofmemory error

I am doing a https post of large file using HttpsURLConnection in chunks using link - file upload using httppost android I am getting fatal exception - 06-09 11:44:47.041 E/AndroidRuntime( 6250): FATAL EXCEPTION: Thread-712 06-09 11:44:47.041…
1
vote
3 answers

Java DataOutputStream / DataInputStream OutOfMemoryError

I'm trying to send a byte array containing 16 items over sockets using DataOutputStream on the client and DataInputStream on the server. These are the methods I am using for sending/receiving. public void sendBytes(byte[] myByteArray) throws…
pjmil
  • 2,087
  • 8
  • 25
  • 41
1
vote
3 answers

Java reading from file and sending using DataOutputStream

I'm trying to write a mini FTP application that reads binary data from a file and sends it to a client. My program usually does not behave as desired and usually ends up sending the file, but not doing it completely (i.e. send text file and the…
James
  • 107
  • 9
1
vote
3 answers

Reading a .dat file into an array in Java

The code that I'm writing has two classes: writeInts and readInts. I wrote writeInts to randomly generate 100 numbers between 0 and 1000 and output them to a data.dat file. readInts is supposed to open a DataInputStream object and read in the "raw"…
Ben
  • 95
  • 1
  • 4
  • 16
1
vote
1 answer

DataOutputStream stucks

I've made a simple server application for sending images to the connected clients. I have a loop in the main thread, which accepts the incoming connections, and make a Client object from the corresponding socket. I have a list for the active…
Rothens
  • 755
  • 7
  • 18
1
vote
2 answers

unable to input data to dataoutputstream

i'm creating a program that reads from file then change it to an arraylist of item and send it to to a client. A client chooses an item by id and enter amount needed. then it gets updated in the server. the server runs multithreading. when another…
1
vote
2 answers

Why I get java.io.FileNotFoundException in getting the response to my httpUrlConnection?

I don't know if Im sending my file right to web api. Because nothing gives an error to client request code. But when I'm getting the response to the server it gives me a java.io.FileNotFoundException. So I think that there's wrong in my request code…
1
vote
3 answers

Progress bar implementation with write method of dataoutputstream

Is it possible to incorporate a horizontal progress bar in the following code? I was thinking os AsyncTask but then I realized, I can't pass an integer value to ProgressUpdate() method inside doInBackground(). Please help! public void sendFileDOS()…
Vinit Shandilya
  • 1,643
  • 5
  • 24
  • 44
1
vote
0 answers

Java sockets and dataoutputstream delay

I am a beginner in Java and I am working at a project involving sockets and external devices. I have done a small listener for the units and I am having some problems sending messages to the devices. The unit has 2 messages that is sending to the…
Liviu
  • 51
  • 5
1
vote
0 answers

Android - Timeout in DataOutputStream.writeUTF

I have an Android app that connects to a TCP Java Server. The data is written with DataOutputStream.writeUTF. I want to simulate a failing GPRS connection, so I did the following: Start up the Java TCP Server Connect the Android app Turn-off the…
victorino
  • 11
  • 1
1
vote
0 answers

Couldn't send the image to the web server database for android

I was instructed to send a report in this format Name=tan ah kow Email=myemail@google.com Contact=81234567 Block=123 Street=Tampines Central Description=Dirty water puddle uploadedfile=a5fa23423-4907098 (BASE64-ENCODED STRING) index=1 Set…
1
vote
1 answer

Equivalent of DataOutputStream and DataInputStream in C

I wrote this code in java public class Client { private static int _port; private static Socket _socket; public static void main(String[] args) { try { _port = 8071; _socket = new…
user2328999
  • 91
  • 3
  • 12
1
vote
2 answers

Ugly characters displayed when saving byte array to a file

I have a Text file in the server. I am downloading that file from the client. I have given the file path where to it should be saved fi. The text file created, and it has some ugly characters in it, and not Strings. How can i correct it ? The format…
Illep
  • 16,375
  • 46
  • 171
  • 302
0
votes
1 answer

Can I make a DataOutputStream method for an abstract class and use this for the subclasses?

I have a book class: public abstract class Book { private String author, title; private int pages; private double price; Book next; public Book( String f, String t, int sider, double p ) { author = a; title = t; pages = pa; price =…
user938773
  • 13
  • 3
0
votes
1 answer

J2ME DataOutputStream from FileConnection encoding

I'm trying to write some data into DataOutputStream from FileConnection. FileConnection con = (FileConnection)Connector.open("file:///C:/file.txt"); if (!con.exists()) con.create(); DataOutputStream out =…
Daniel Cisek
  • 931
  • 3
  • 9
  • 23