Anonymous committed e4811f3

rename FileReader into File. TODO: make File an interface ?

  • Participants
  • Parent commits da5c16e

Comments (0)

Files changed (4)

File pkg/groot/directory.go

 // Directory is a directory inside a ROOT file
 type Directory struct {
-	file        *FileReader
+	file        *File
 	keys        []Key
 	ctime       time.Time // time of directory's creation
 	mtime       time.Time // time of directory's last modification
 	seek_keys   int64     // location of keys record on file
-func NewDirectory(f *FileReader, buf []byte) (d *Directory, err error) {
+func NewDirectory(f *File, buf []byte) (d *Directory, err error) {
 	d = &Directory{file:f}
 	err = d.from_buffer(bytes.NewBuffer(buf))
 	if err != nil {
 	panic("groot.Directory.ROOTEncode: sorry, not implemented")
-func (d *Directory) SetFile(f *FileReader) error {
+func (d *Directory) SetFile(f *File) error {
 	d.file = f
 	return nil

File pkg/groot/ifaces.go

 // FileSetter is the interface allowing to reset the ownership of a ROOT object
 // w.r.t a given file
-// FIXME: this (obviously) shouldn't be restricted to a FileReader
 type FileSetter interface {
-	SetFile(f *FileReader) error
+	SetFile(f *File) error
 // EOF

File pkg/groot/key.go

 //    - to write an object in the Current Directory
 //    - to write a new ntuple buffer
 type Key struct {
-	file *FileReader
+	file *File
 	//bufsz  uint32
 	//buffer []byte
 	title           string    // title of the object
-func NewKey(f *FileReader, pos int64, nbytes uint32) (k *Key, err error) {
+func NewKey(f *File, pos int64, nbytes uint32) (k *Key, err error) {
 	k = &Key{
 		file:     f,
 		seek_key: pos,

File pkg/groot/reader.go

 type unzip_fct func()
-type FileReader struct {
+type File struct {
 	name        string               // path to this file
 	f           *os.File             // handle to the raw file
 	order       binary.ByteOrder     // file endianness
 	nbytes_info uint32 // number of bytes for streamerinfos?
-func NewFileReader(name string) (f *FileReader, err error) {
-	f = &FileReader{
+func NewFileReader(name string) (f *File, err error) {
+	f = &File{
 		name:     name,
 		order:    binary.BigEndian,
 		unzipers: make(map[string]unzip_fct),
 	return f, err
-func (f *FileReader) breader() breader {
+func (f *File) breader() breader {
 	return breader{f.order}
-func (f *FileReader) seek(offset int64, pos int) (ret int64, err error) {
+func (f *File) seek(offset int64, pos int) (ret int64, err error) {
 	switch pos {
 	case os.SEEK_SET:
 		return f.f.Seek(offset, os.SEEK_SET)
-func (f *FileReader) initialize() (err error) {
+func (f *File) initialize() (err error) {
 	err = f.read_header()
 	if err != nil {
 		return err
 	return nil
-func (f *FileReader) read_header() (err error) {
+func (f *File) read_header() (err error) {
 	cur, err := f.f.Seek(0, os.SEEK_CUR)
 	if err != nil {
 		return err
 	return f.read_streamer_infos()
-func (f *FileReader) read_streamer_infos() (err error) {
+func (f *File) read_streamer_infos() (err error) {
 	buf := make([]byte, int(f.nbytes_info))
 	_, err = f.f.ReadAt(buf, f.seek_info)
 	if err != nil {
 	return err
-func (f *FileReader) Name() string {
+func (f *File) Name() string {
-func (f *FileReader) Version() uint32 {
+func (f *File) Version() uint32 {
 	return f.version
-func (f *FileReader) Dir() *Directory {
+func (f *File) Dir() *Directory {
 	return &f.root_dir
-func (f *FileReader) ByteOrder() binary.ByteOrder {
+func (f *File) ByteOrder() binary.ByteOrder {
 	return f.order