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

Transposing data from automatically created lists

I am trying to transpose data from lists that are automatically created for each text file. Each text file gets its own version of the listsR list. I then place the lists into another list, listlist so that I can manage a list of lists. I know how…
user3044431
1
vote
2 answers

TextView settext showing single line instead of all

Context: textview should display all the saved data in file, which is in the form of lines Problem: Displaying only current data not the previous all records. FileInputStream fin = new …
Aryan Sharma
  • 119
  • 1
  • 1
  • 11
1
vote
2 answers

Set DataInputStream to String Value

I am trying to write a junit test for a method that depads a word. I am having the problem that the method is returning symbols instead of the depadded word. My test method is @Test public void testReadString() throws IOException { String…
Michael Grinnell
  • 922
  • 1
  • 12
  • 32
1
vote
1 answer

FullContact Webhook Callback Fails

I'm using the FullContact Card Reader API. From what I can tell when making a request to process a business card I need to send the FullContact API a image of a business card along with a webhook. sending script:
Austin
  • 1,619
  • 7
  • 25
  • 51
1
vote
1 answer

Finding certian byte data from InputStream

I have a navigation unit that is spiting out 3 messages at 200 Hz I am trying to capture these messages in the order they are sent and take certain data from within these messages and update variables that are being sent out serially in a byte…
user546749
  • 13
  • 4
1
vote
0 answers

How to check for EOF before actually reading?

DataInputStream dis = new DataInputStream(con.getInputStream()); while(dis.available() > 0 { long mydata = dis.readLong(); // read more data for a record ... workOnOneRecord(); } I read multiple binary variable size records of data…
datafiddler
  • 1,755
  • 3
  • 17
  • 30
1
vote
1 answer

Can not receive a response from a remote server

I am trying to write a code that will allow me to connect to a remote server and receive a response from it. The remote address is : www.euref-ip.net:2101 When trying to connect to it from a web page it works fine. However when i am trying to…
user4559332
1
vote
1 answer

DataInputStream hangs on reading

I am trying to create a chat application between Android and a Windows 10 device. I have successfully sent text from Android using DataOutputStream and read it in Windows 10 using a data reader class. My problem is Android is not able to recognize…
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
2 answers

Using DataInputStream after BufferedReader

A sample binary PGM file is as follows: P5 # This is a comment 10 10 255 #image intensity information in bytes that I am unable to copy paste here like When I try to read the file using the following code: import java.io.*; public class…
cnova
  • 725
  • 2
  • 9
  • 22
1
vote
1 answer

DataInputStream over DatagramSocket

I have wrote a generic program that can accept data from DataInputStream. But recently I was trying to receive data from UDP using DatagramSocket. I have searched a lot, but I could nor fina a way to manipulate the incoming data from DatagramSocket…
Anand
  • 693
  • 1
  • 8
  • 26
1
vote
1 answer

How to skip primitive data values while reading from file

I wrote a Java program that reads integers from a file. Five integers were written to that file earlier using the following code: Scanner s=new Scanner(System.in); DataOutputStream d=null; System.out.println("Enter 5 integers"); try{ d=new…
user5794376
1
vote
2 answers

How to read a DataInputStream twice or more than twice?

I have a Socket connection to an application that I hosted elsewhere. Once I connected I made a OutputStream and DataInputStream. Once the connection has been made, I use the OutputStream to send out a handshake packet to the application. Once this…
Max
  • 2,354
  • 2
  • 14
  • 27
1
vote
1 answer

DataInputStream hangs on read

I have a socket client that hangs whenever I try to read the input stream from the socket. DataInputStream dis = new DataInputStream(socket.getInputStream()); int singleByte; while((singleByte = dis.read()) != -1) { //<-- hangs here char c =…
Roy Hinkley
  • 10,111
  • 21
  • 80
  • 120
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…