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

How to programmatically zip a file in Android?

I know this question already exists, but I'm not sure how to implement it in my case... First I created an DataOutuputStream that will write in a file with .uedl extension: private static DataOutputStream os; public static final String BASE_PATH =…
joe
  • 1,341
  • 4
  • 21
  • 32
0
votes
0 answers

How can I connect to tcpclient?

I am trying to connect to the tcp client and I keep getting ioexception connection refused error. I don't know what I am doing wrong. I am trying to enable tcp notification. I am connecting to a rfid reader and trying to get the data back to my…
Roro
  • 427
  • 2
  • 8
  • 20
0
votes
2 answers

writing DataOutputStream in Android

I am trying to set up a socket client to send just an int for the time being with DataOutputStream to a server. My app works fine when I run it from my PC but I get this error message on Android emulator on Eclipse: "The application SOCKET has…
kotsosh
  • 47
  • 1
  • 5
0
votes
1 answer

Android DataOutputStream Flush method does not seem to actually flush

Here's some quick code I am doing. (I removed some of it to make it more readable.) Essentially, I'm opening a file, and processing 3k chunks at a time. These get encoded to Base64 (4k chunk now) and uploaded via HTTP post. After each call to…
Paul
  • 5,700
  • 5
  • 43
  • 67
0
votes
2 answers

How to write a binary file from a String and retrieve it again to a String?

I have a string and want to persist it into a file and be able to retrieve it again into a String. Something is wrong with my code because It's supposing that I must write something binary non readable but when i Open the file I can read…
0
votes
0 answers

Slow Execution of Function - DataOutPutStream

private void sendCommand(String cmd) { Process process = null; try { process = Runtime.getRuntime().exec("su"); DataOutputStream os = new DataOutputStream(process.getOutputStream()); …
CodeGuru
  • 3,645
  • 14
  • 55
  • 99
0
votes
1 answer

DataOutputStream works only preceded by System.out.println

I got another problem with input/output streams. Here i'm sending data from a server to a client. Before sending the data, the server send a little string just to say to the client what he'll send, and so the client know which function he should use…
Ablia
  • 317
  • 1
  • 3
  • 14
0
votes
0 answers

Crash when using dataoutputstream by button

In my app when I use dataoutputstream without button it works but when I use it with button it crashes! I've needed permissions in manifest. At first dataoutputstream works but when I use button it crashes. private DataOutputStream…
0
votes
1 answer

how to use writeUTF() method the right way?

I am trying to make simple client and server that exchanges files, so, I am trying to use the writeUtf() method to send the file name as a String, but it is not working at all. public class Client { public static void main(String[] args) throws…
Dimitry
  • 41
  • 1
  • 2
  • 7
0
votes
1 answer

Difference between DataOutputStream and OutputStreamWriter: String compatibility?

I'm quite new to Java, but I have different results when using OutputStreamWriter and DataOutputStream with a POST request of HttpUrlConnection. I can append parameters when I use DataOutputStream. URL url = new…
0
votes
0 answers

HttpURLConnection returning 400 status on post call without payload

Actually there are two POST URLs. First POST url is login as follows and even it contains body as json as follows. String loginUrl = "http://00.00.00.00:0000/url/vs1/login"; json = `{"email": "qqqq@mail.com", "password":…
0
votes
1 answer

Data loss in TCP Java DataOutputStream

CLIENT SENDING SIDE if((readerInput = bufferedReaderFromCMD.readLine()) != null ){ if(readerInput.equals("-file")){ System.out.println("Checking If condition.."); String receiver,filename; …
0
votes
1 answer

Connection to server is ok, but I'm writing an empty string to the OutputStream

I can't figure out what is up with this code. First of all, as it is here, it works. But I'm afraid I have missed an important concept and I don't want it to come back and bite me later. My code below will write a blank line to a text log that I…
user8910699
0
votes
2 answers

cannot get android app to connect to my server on my local computer

Hi I'm new to android and Im Trying to get my android app to connect to a my server that is running on my local computer. Im just trying to get the app to send a simple string message to the server first but keep getting an error. From the print out…
0
votes
1 answer

How do you handle the HttpUrlConnection on server side?

I'm trying to send the file through HttpUrlConnection method. URL url = new URL(SERVER_URL); connection = (HttpURLConnection) url.openConnection(); connection.setDoInput(true);//Allow Inputs …
kong kim
  • 29
  • 1
  • 4