Exemplo n.º 1
0
func (d *CompoundFileDirectory) FileExists(name string) bool {
	d.ensureOpen()
	// if d.writer != nil {
	// 	return d.writer.FileExists(name)
	// }
	_, ok := d.entries[util.StripSegmentName(name)]
	return ok
}
Exemplo n.º 2
0
func (d *CompoundFileDirectory) OpenInput(name string, context IOContext) (in IndexInput, err error) {
	d.ensureOpen()
	// assert !d.openForWrite
	id := util.StripSegmentName(name)
	if entry, ok := d.entries[id]; ok {
		is := d.handle.openSlice(name, entry.offset, entry.length)
		return is, nil
	}
	keys := make([]string, 0)
	for k := range d.entries {
		keys = append(keys, k)
	}
	panic(fmt.Sprintf("No sub-file with id %v found (fileName=%v files: %v)", id, name, keys))
}