0

If i feed html files in the form of Array[Byte] at producer side in kafka then how to reconstruct html file at consumer side in kafka ?

This is how i am converting html files into Array[Byte]

def getByteArray(fileName: String): Array[Byte] =
 {
   val file: File = new File(fileName)
   val fileinputstream: FileInputStream = new FileInputStream(file)
   IOUtils.toByteArray(fileinputstream)
 }

suggest me solution which will give the file back at consumer side by applying that function. e.g.

def byteArrayToFile(data:Array[Byte]):String={
//suggest
}
7
  • 1
    Do the opposite of what you did on the client to get to the byte array format? This doesn't sound like it's specific to kafka. Commented Oct 3, 2019 at 12:21
  • @cricket_007 please provide some way , i am blocked Commented Oct 5, 2019 at 16:42
  • @500 - Internal Server Error Commented Oct 5, 2019 at 16:43
  • new String(data, "UTF-8")?? Commented Oct 5, 2019 at 18:23
  • this is not working @cricket_007 and gives output like-[B@4e04a765 Commented Oct 7, 2019 at 6:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.