package jazz.io;

///////////////////////////////////////////////////////////////////////////////
//
//                                 Readers
//
// Readers read their input stream atomically and return a single string.
//
///////////////////////////////////////////////////////////////////////////////

public abstract class Reader {
  // Underlying native reader
  reader: native;
  
  // Reads the file and closes it
  public readString(): String;
}

///////////////////////////////////////////////////////////////////////////////
//
//                               Implementation
//
///////////////////////////////////////////////////////////////////////////////

readString@Reader() = native("java.lang.String "
                             "fr.ensmp.cma.jazz.runtime.Primitive.readString"
                             "(java.io.Reader)",
                             reader);