Questions tagged [datainputstream]

A DataInputStream lets an application read primitive Java data types from an underlying input stream in a machine-independent way.

The DataInputStream class enables you to read Java primitives from InputStream's instead of only bytes. Wrap an InputStream in a DataInputStream and then you can read primitives from it. DataInputStreams represent Unicode strings in a format that is a slight modification of UTF-8.

339 questions
0
votes
4 answers

How to find the number of each elements in the row and store the mean of each row in another array using C#?

I am using the below code to read data from a text file row by row. I would like to assign each row into an array. I must be able to find the number or rows/arrays and the number of elements on each one of them. I would also like to do some…
Next Door Engineer
  • 2,818
  • 4
  • 20
  • 33
0
votes
1 answer

Does DataInputStream receives only 2048 bytes of data in Android?

From PC (server side) the C#.Net application has to sent 22000 bytes of data to an Android device (client side) via Wi-Fi. But dataInputStream in Android device is showing only 2048 bytes of it. dataInputStream = new…
krishh
  • 1,551
  • 15
  • 28
0
votes
3 answers

Is there any way to send an array of Point with DataOutputStream over a Socket?

I want to send an array of point (Point points[] = new point[20]) with DataOutputStream over a socket and be able to correctly read it with DataInputStream on the other side. I CANNOT send each element separately, it must be sent as a whole array…
KeatonB
  • 213
  • 2
  • 10
0
votes
4 answers

Read byte[] from server

I am trying to read byte[] that is being send from a client to a server. This is my client code... din = new DataInputStream(socket.getInputStream()); dout = new DataOutputStream(socket.getOutputStream()); Cipher cipher =…
hkguile
  • 4,235
  • 17
  • 68
  • 139
0
votes
2 answers

How do I pass a list to a Java input stream?

public class parseFiles { public static void main(String... aArgs) throws FileNotFoundException { File startingDirectory= new File("CGT"); List files = FileListing2.getFileListing(startingDirectory); for(File…
dwwilson66
  • 6,806
  • 27
  • 72
  • 117
-1
votes
2 answers

How to implement a reader class with the use of DataInputStream

I'm trying to learn how to implement a reader class to only implement needed methods to read certain data type inputs. I came across the following code on geeksforgeeks, but I don't really understand the use of buffersize or bytes or datainputstream…
potato
  • 1
-1
votes
1 answer

nullPointerException while using DataInputStream and DataOutputStream to send and int

I'm practicing on a simple Client / Server connection. The client is supposed to send an Int to the server, and the server is supposed to print this int. However, the server encounters a NullPointerException and doesn't print the int sent by the…
-1
votes
2 answers

How do I show data in Textview for a 2 second (android Studio)?

I want to show data in Textview for 2 second time.So I recieved data from arduino that not have a delay between I use serialwrite.I use InputStream and DatainputStream for recieved data.It's still have a problem when data show in textview.It will…
-1
votes
1 answer

Need Help in taking Input from DataInputStream in java

Here's my code : import java.io.*; class InterestCalcs { public static void main(String arg[]) { Float prinAmount = new Float(0); Float ROI = new Float(0); DataInputStream in = new DataInputStream(System.in); …
Aps
  • 13
  • 5
-1
votes
1 answer

How to read and write Bytes without skipping the zeros in Java

Does anyone know how to input or output bytes without skipping the zeros I am trying to write a program that exports an array of ints to unsigned shorts. I have written code to write and read wave files, but they aren't formatted right. Read…
-1
votes
1 answer

Receive string message using BufferedReader and Images using DataInputStream in same socket

I have two projects, one reads string messages using BufferedReader and the other reads images using DataInputStream. I want to merge these two projects to receive messages and images from the same socket, but I am confused how to do this as I am…
Bilal Hassan
  • 37
  • 1
  • 6
-1
votes
1 answer

Java socket receives more bytes than expected

I have just started with Java and am trying to communicate with an external device via TCP/IP. I send a command to the device and receive an appropriate response. The communication works so far, if I wait 1 second between sending and receiving. What…
Henning
  • 421
  • 2
  • 11
  • 22
-1
votes
2 answers

Is it possible to read bits in a loop by determining the amount to read?

There is a DataInputStream from which to read I met a specific algorithm: int[] nmbrs = new int[64]; Read a 4-bit unsigned integer. Assign Length the value read for (int i = 0; i < 64; i++) 3.1 Read an Length-bit unsigned integer as nmbrs[i] Is it…
Shklyar
  • 140
  • 1
  • 12
-1
votes
1 answer

Write data from datainputstream to a file in Java

I am learning about socket programming in Java from the below link: https://www.geeksforgeeks.org/socket-programming-in-java/ The code for server from the tutorial is as follows(I have added extra lines to copy in a file): // A Java program for a…
Lax_Sam
  • 1,099
  • 2
  • 14
  • 32
-1
votes
1 answer

How to listen DataInputStream Socket in Android without sending data?

I wrote a class in which I can send and receive data via socket. In this class, first of all, I connect to socket with a specific port and IP then, I initialize outputstrem and inputstram. I can easily send and receive data, but I can only receive…
Mohsen Hatami
  • 317
  • 3
  • 14