Loads all bytes and information of the exception section.

The file on disk is read to fetch the information.

@return {@link ExceptionSection} of the given file, absent if file doesn't
have this section
@throws IOException
if unable to read the file
198412
@SuppressWarnings("unchecked")
    public Optional<ExceptionSection> maybeLoadExceptionSection()
            throws IOException {
        return (Optional<ExceptionSection>) maybeLoadSpecialSection(DataDirectoryKey.EXCEPTION_TABLE);
    }
268455
public String loadAsString() throws IOException {
        long sizeGuess;
        if(file.exists())
            sizeGuess = file.length();
        else
        if(gz.exists())
            sizeGuess = gz.length()*2;
        else
            return "";

        StringBuilder str = new StringBuilder((int)sizeGuess);

        try (InputStream is = read();
             Reader r = new InputStreamReader(is)) {
            char[] buf = new char[8192];
            int len;
            while((len=r.read(buf,0,buf.length))>0)
                str.append(buf,0,len);
        }

        return str.toString();
    }
576959
synchronized void openInfo() throws IOException {
    if (src == null && blocks == null) {
      throw new IOException("No file provided to open");
    }

    LocatedBlocks newInfo = src != null ? 
                            getLocatedBlocks(src, 0, prefetchSize) : blocks;
                            
    if (newInfo == null) {
      throw new FileNotFoundException("Cannot open filename " + src);
    }

    // I think this check is not correct. A file could have been appended to
    // between two calls to openInfo().
    if (locatedBlocks != null && !locatedBlocks.isUnderConstruction() &&
        !newInfo.isUnderConstruction()) {
      Iterator<LocatedBlock> oldIter = locatedBlocks.getLocatedBlocksCopy()
          .iterator();
      Iterator<LocatedBlock> newIter = newInfo.getLocatedBlocks().iterator();
      while (oldIter.hasNext() && newIter.hasNext()) {
        if (! oldIter.next().getBlock().equals(newIter.next().getBlock())) {
          throw new IOException("Blocklist for " + src + " has changed!");
        }
      }
    }

    // if the file is under construction, then fetch size of last block
    // from datanode.
    if (newInfo.isUnderConstruction() && newInfo.locatedBlockCount() > 0) {
      LocatedBlock last = newInfo.get(newInfo.locatedBlockCount()-1);
      if (last.getLocations().length > 0) {
        try {
          Block newBlock = getBlockInfo(last);
          // only if the block has data (not null)
          if (newBlock != null) {
            long newBlockSize = newBlock.getNumBytes();
            newInfo.setLastBlockSize(newBlock.getBlockId(), newBlockSize);
          }
        } catch (IOException e) {
          DFSClient.LOG.debug("DFSClient file " + src + 
                    " is being concurrently append to" +
                    " but datanodes probably does not have block " +
                    last.getBlock(), e);
        }
      }
    }
    this.locatedBlocks = new DFSLocatedBlocks(newInfo, locatedBlockExpireTimeout);
    this.currentNode = null;
    if (!newInfo.isUnderConstruction()) {
      // No block should be under construction if the file is finalized.
      isCurrentBlockUnderConstruction = false;
    }
  }
69681
public void loadParamFile() throws IOException {
		SeekableLineReaderFactory fact = null;
		SeekableLineReaderIterator iter = null;

		try {
			fact = GeneralURIStreamFactory.createSeekableStreamFactory(
				paramFile, false);
			iter = new SeekableLineReaderIterator(fact.get());

			paramSet = new HashSet<String>();

			while (iter.hasNext()) {
				String param = iter.next();
				param = param.trim();

				if (param.isEmpty() || param.startsWith("#")) {
					continue;
				}

				// Use only the first word, ignore the rest
				int wordEnd = param.indexOf(delim);

				if (wordEnd > 0) {
					param = param.substring(0, wordEnd);
				}

				paramSet.add(param);
			}
		} finally {
			if (iter != null) {
				iter.close();
			}

			if (fact != null) {
				fact.close();
			}
		}
	}
867427
@Override
  public Configuration loadConfig() throws ConfigurationException, IOException {

    Configuration resultConfig = new Configuration();

    if (!Utils.localFileExists(this.getConfigFileName())) {
      // String configFileName = System.getenv(ConfigConstant.DDF_INI_ENV_VAR.getValue());
      File file = new File(this.locateConfigFileName(this.getConfigDir(), this.getConfigFileName()));
      mConfigDir = file.getParentFile().getName();
      mConfigFileName = file.getCanonicalPath();
    }

    if (!Utils.localFileExists(this.getConfigFileName())) return null;

    HierarchicalINIConfiguration config = new HierarchicalINIConfiguration(this.getConfigFileName());

    @SuppressWarnings("unchecked")
    Set<String> sectionNames = config.getSections();
    for (String sectionName : sectionNames) {
      SubnodeConfiguration section = config.getSection(sectionName);
      if (section != null) {
        Configuration.Section resultSection = resultConfig.getSection(sectionName);

        @SuppressWarnings("unchecked")
        Iterator<String> keys = section.getKeys();
        while (keys.hasNext()) {
          String key = keys.next();
          String value = section.getString(key);
          if (value != null) {
            resultSection.set(key, value);
          }
        }
      }
    }

    mConfig = resultConfig;
    return mConfig;
  }
187730
public static byte[] readFile(File file) throws IOException
    {
        //create stream to file
        InputStream inputStream=new FileInputStream(file);

        //read data
        byte[] data=IOHelper.readStream(inputStream);

        return data;
    }
1207236
public static String readContent( File file ) throws IOException
    {
        Reader input = null;
        try
        {
            input = new FileReader( file );
            return readContent( input );
        }
        finally
        {
            closeQuietly( input );
        }
    }
929135
private static void loadFile(String filePath) {
        final Path path = FileSystems.getDefault().getPath(filePath);

        try {
            data.clear();
            data.load(Files.newBufferedReader(path));
        } catch(IOException e) {
            LOG.warn("Exception while loading " + path.toString(), e);
        }
    }
105524
private static FileHeader readHeader(File file) throws IOException {
        InputStream is =null;
        try {
            is = new BufferedInputStream(new FileInputStream(file));
            InputArchive ia=BinaryInputArchive.getArchive(is);
            FileHeader hdr = new FileHeader();
            hdr.deserialize(ia, "fileheader");
            return hdr;
         } finally {
             try {
                 if (is != null) is.close();
             } catch (IOException e) {
                 LOG.warn("Ignoring exception during close", e);
             }
         }
    }
1047202
@Override
    public int read() throws IOException {
        try {
            beforeRead(1);
            int b = in.read();
            afterRead(b != -1 ? 1 : -1);
            return b;
        } catch (IOException e) {
            handleIOException(e);
            return -1;
        }
    }
1306706
public synchronized byte[] readBytes() throws IOException
    {
        final int dataLength = dataInputStream.readInt();
        final byte[] data = new byte[dataLength];

        final int dataRead = dataInputStream.read(data, 0, dataLength);
        if (dataRead != dataLength) throw new IOException("Not enough data available");

        return data;
    }
208365
public static byte[] readAllBytes(File src, int limit) throws IOException {
		byte[] read;

		try (FileInputStream srcStream = new FileInputStream(src)) {
			read = readAllBytes(srcStream, limit);
		}
		return read;
	}
1249763
public InputStream read() throws IOException {
        if(file.exists())
            try {
                return Files.newInputStream(file.toPath());
            } catch (InvalidPathException e) {
                throw new IOException(e);
            }

        // check if the compressed file exists
        if(gz.exists())
            try {
                return new GZIPInputStream(Files.newInputStream(gz.toPath()));
            } catch (InvalidPathException e) {
                throw new IOException(e);
            }

        // no such file
        throw new FileNotFoundException(file.getName());
    }
1137563
public ByteBuffer readAll() throws IOException {
    ByteBuffer bb = ByteBuffer.allocate((int) length);
    if (positionalReadMode) {
      read(0, bb.array(), 0, (int) length);
      return bb;
    } else {
      read(bb.array(), 0, (int) length);
      return bb;
    }
  }
291086
private void rebuildIndex() throws Exception {
      ByteBuffer buf = ByteBuffer.allocate(KEY_POS);
      for (; ; ) {
         // read FileEntry fields from file (size, keyLen etc.)
         buf.clear().limit(KEY_POS);
         channel.read(buf, filePos);
         // return if end of file is reached
         if (buf.remaining() > 0)
            return;
         buf.flip();

         // initialize FileEntry from buffer
         int entrySize = buf.getInt();
         int keyLen = buf.getInt();
         int dataLen = buf.getInt();
         int metadataLen = buf.getInt();
         long expiryTime = buf.getLong();
         FileEntry fe = new FileEntry(filePos, entrySize, keyLen, dataLen, metadataLen, expiryTime);

         // sanity check
         if (fe.size < KEY_POS + fe.keyLen + fe.dataLen + fe.metadataLen) {
            throw log.errorReadingFileStore(file.getPath(), filePos);
         }

         // update file pointer
         filePos += fe.size;

         // check if the entry is used or free
         if (fe.keyLen > 0) {
            // load the key from file
            if (buf.capacity() < fe.keyLen)
               buf = ByteBuffer.allocate(fe.keyLen);

            buf.clear().limit(fe.keyLen);
            channel.read(buf, fe.offset + KEY_POS);

            // deserialize key and add to entries map
            // Marshaller should allow for provided type return for safety
            K key = (K) ctx.getMarshaller().objectFromByteBuffer(buf.array(), 0, fe.keyLen);
            entries.put(key, fe);
         } else {
            // add to free list
            freeList.add(fe);
         }
      }
   }
139268
@FFDCIgnore(IOException.class)
    // The feature manager and kernel only do provisioning from a single thread, so this is paranoia, but should
    // never be contended.
    private synchronized void readCache() {
        if (!!!_cacheRead) {
            BufferedReader reader = null;
            try {
                if (_cacheFile != null && _cacheFile.exists() && _cacheFile.isFile()) {
                    reader = new BufferedReader(new FileReader(_cacheFile));
                    String line;
                    while ((line = reader.readLine()) != null) {
                        try {
                            BundleInfo bInfo = new BundleInfo(line);
                            if (bInfo.file.exists() && bInfo.symbolicName != null) {
                                addToCache(bInfo);
                            }
                        } catch (IOException e) {
                            // IOException creating BundleInfo.
                        }
                    }
                }
            } catch (IOException e) {
                // If we can't load the cache then we just throw everything 
                // away and do the more expensive read from original data.
                _bundleLocations.clear();
                _cacheBySymbolicName.clear();
            } finally {
                Utils.tryToClose(reader);
            }
            _cacheRead = true;
            // now we have read the cache we want to insure all base locations are processed.
            for (String loc : new HashSet<String>(_locations)) {
                includeBaseLocation(loc);
            }
        }
    }
1053682
public static byte[] read(File file) throws IOException {
        FileInputStream is = new FileInputStream(file);
        try {
            return bytes(is);
        } finally {
            closeQuietly(is);
        }
    }