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

FSDataOutputStream.writeUTF() adds extra characters at the start of the data on hdfs. How to avoid this extra data?

What I am trying to is to convert a sequence file on hdfs which has xml data into .xml files on hdfs. Searched on Google and found the below code. I made modifications according to my need and the following is the code.. public class…
sk7979
  • 140
  • 2
  • 18
1
vote
1 answer

Can you prevent a BufferedOutputStream (java) from transmitting?

I"m trying to write a string to an OutputStream using public SSLSocket mClient; private BufferedOutputStream mOutputStream; .... mOutputStream = new BufferedOutputStream( mClient.getOutputStream() ); public synchronized void…
Alex
  • 11
  • 3
1
vote
1 answer

PHP read input stream from Java DataOutputStream?

For a while, I've been working on a Java client that sends level information to save online. I have managed using printwriter, but it is really inefficient, and a simple 300KB level turns out to be 3MB after the transfer, and is rather slow. I know…
Hello234
  • 175
  • 2
  • 12
1
vote
1 answer

Writing Enums to a File Using DataOutputStream

I'm currently writing a Java game and need to save some data to a file. I'm using DataInputStream and DataOutputStream to do the reading and writing for the file. However, while most of the data needing to be written are primitive types, I also have…
Thomas
  • 1,123
  • 3
  • 13
  • 36
1
vote
1 answer

Unexpected values with writeUTF and readUTF in Java

I have a server listening to two different ports, after a connection is accepted, it saves the combination nameOfClient - Socket into an hashMap. After that it starts a method in a loop to check which client is sending a message and who is the…
1
vote
2 answers

java, writing data size with DataOutputStream

I have a series of objects which write their data out to a file via DataOutputStream. As my application file format evolves, I will be adding further data objects to it, which should be able to be read by "older" versions of the application. To be…
Simon
  • 2,208
  • 4
  • 32
  • 47
1
vote
1 answer

Why Bytes written by writeByte() of DataOutputStream and writeByte() of ObjectOutputStream are different?

As the purpose of writeByte() is same in both classes. But both are writing different contents. import java.io.*; class First { public static void main(String[] args) throws IOException { FileOutputStream fos = new…
my name is GYAN
  • 1,269
  • 13
  • 27
1
vote
1 answer

Progress of dataOutputStream.readFully

I'm receiving a file using dataInputStream.readFully, so i'd like to show the progress of the transmision. Is it possible to know the progress of readFully method? Thank you.
MM Manuel
  • 375
  • 2
  • 4
  • 16
1
vote
1 answer

Read wrong .txt binary data in matlab

I wrote a Java program to output numeric data to binary .txt file and plan to use Matlab to process that data file. In the Java program, I used DataOutputStream to write float numbers to data.txt file and test by using DataInputStream to read …
1
vote
1 answer

How to maintain consistency in the binary data written to a file?

I am trying to write a binary string into a file and afterwords read it and present it in a hex representation. This is my code: import java.io.*; import java.math.BigInteger; public class TestByte { public static void main(String[] argv)…
user4559332
1
vote
1 answer

Send a 0 byte using DataOutputStream?

I'm creating an server for an existing client. This client reads input from server using a socket and DataInputStream. It checks for end of server message using: byte c = in.readByte(); if( c == 0) { //the end. On the server i'm using a…
Tinus Tate
  • 2,237
  • 2
  • 12
  • 33
1
vote
1 answer

Serializing and Deserializing data with Double value in Java

I am using the function toByteBuffer() to serialize some data. Please note that I am using DataOutputStream to write the serialized data. public ByteBuffer toByteBuffer() throws IOException { ByteArrayOutputStream bs = new…
1
vote
0 answers

Sending data from android app to server using DataOutPut/InputStream

Currently, I'm developing an android app.My app allows users to send an Image and some additional details to server(a servlet). Here is codes to take picture from gallery public void loadImagefromGallery(View view) { Intent galleryIntent = new…
lanpm
  • 11
  • 3
1
vote
2 answers

Having problems with .getInputStream()

I am trying to program a TCP chat server, but am having difficulties with the .getInputStream() and .getOutputStream() methods, the compiler says it "Cannot find symbol- method .getInputStream(). Here is my code, I have not progressed very far…
Alon and Idan
  • 87
  • 1
  • 10
1
vote
3 answers

Fortran output large array to netCDF nf90_enddef

Hi first question on stackoverflow. I've been stuck on this for 5 days. I want to write a netcdf file in Fortran. I'm using netcdf/3.6.3 I am trying to output a large 43000x 18000 array named frech and some smaller ones (1d arrays). a sample of my…
Weatherman
  • 13
  • 4