This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to read a whole plain text file


This doesn't sound like a problem where Scheme is gonna be very helpful (most especially since you want the result in a Java array). I'ld just call the usual Java function (probably DataInputStream.readFully).

Jim

Victor Anyakin wrote:
Greetings to all,

I have a problem again.

  What I need is to read plain text file and represent its contents as
  an array of bytes (byte[]) so that it could be passed to another
  Java function (void setData(byte[] data)).

  I have tried different approaches, but failed. (I have tried to
  `read' it, but `read' reads only the first line of the file, with
  read-line I am failing to `glue' the lines into a single one,
  opening an output string and then (write-char (read-char infile)
  outstr) causes a class cast exception).

  What is the preferred/right way to read a whole file? Our, how would
  you solve that task?

With best regards,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]