Helper method for reading an asset file into a string.

@param context   current context.
@param assetName the asset name
@return a string representation of a file in assets.
549422
public static String getAssetFile(final Context context, final String assetName) {
        // if the file is not found create it and return that.
        // if we do not have a file we copy our asset out to create one.
        AssetManager assetManager = context.getAssets();
        BufferedReader in = null;
        try {
            StringBuilder buf = new StringBuilder();
            InputStream is = assetManager.open(assetName);
            in = new BufferedReader(new InputStreamReader(is));

            String str;
            boolean isFirst = true;
            while ((str = in.readLine()) != null) {
                if (isFirst)
                    isFirst = false;
                else
                    buf.append('\n');
                buf.append(str);
            }
            return buf.toString();
        } catch (IOException e) {
            BoxLogUtils.e("getAssetFile", assetName, e);
        } finally {
            try {
                if (in != null) {
                    in.close();
                }
            } catch (Exception e) {
                BoxLogUtils.e("getAssetFile", assetName, e);
            }
        }
        // should never get here unless the asset file is inaccessible or cannot be copied out.
        return null;
    }
80307
public String read(final String filename) {
        if (isFresh(filename)) {
            String cachedValue = getFileFromCache(filename);
            if (cachedValue != null) {
                return cachedValue;
            }
        }
        // either fresh is false or cachedValue is null
        loadToCache(filename);
        return getFileFromCache(filename);
    }
51984
function get_assets(name, extension = 'js')
	{
		let chunk = json.assetsByChunkName[name]

		// a chunk could be a string or an array, so make sure it is an array
		if (!(Array.isArray(chunk)))
		{
			chunk = [chunk]
		}

		return chunk
			// filter by extension
			.filter(name => path.extname(extract_path(name)) === `.${extension}`)
			// adjust the real path (can be http, filesystem)
			.map(name => options.assets_base_url + name)
	}
985194
protected static String getFileName(final Map<String, String> properties) {
		String fileName = properties.get("file");
		if (fileName == null) {
			throw new IllegalArgumentException("File name is missing for file writer");
		} else {
			return fileName;
		}
	}
605926
public static function asset($string, $name = null, $return = true)
    {

        $filePath = '';
        if (!file_exists($filePath)) {
            $filePath = BASE_DIR . $string;
        }
        $filenamePath = AssetsParser::findDomainPath($string, $filePath);

        $filePath = self::processAsset($string, $name, $return, $filenamePath);
        $basePath = Config::getParam('resources.cdn.url', Request::getInstance()->getRootUrl());
        $returnPath = empty($name) ? $basePath . '/' . $filePath : $name;
        return $return ? $returnPath : '';
    }
21161
public static String getResourceString(Context context, String key) {
    int id = getIdentifier(context, "string", key);
    if (id != 0) {
      return context.getResources().getString(id);
    } else {
      return null;
    }
  }
1140177
private String readResource(final String resourceName) throws IOException {
      return new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(resourceName), DEFAULT_CHARSET)).lines().collect(Collectors.joining("\n"));
   }
202245
def retrieve_asset(filename):
    

    record = model.Image.get(asset_name=filename)
    if not record:
        raise http_error.NotFound("File not found")
    if not record.is_asset:
        raise http_error.Forbidden()

    return flask.send_file(record.file_path, conditional=True)
1206211
public static String getFilename(@NotNull Rendition rendition) {
    boolean isOriginal = isOriginal(rendition);
    if (isOriginal) {
      return rendition.getAsset().getName();
    }
    else {
      return rendition.getName();
    }
  }
959803
public static JSONObject loadJSONAsset(Context context, final String asset) {
        if (asset == null) {
            return new JSONObject();
        }
        return getJsonObject(org.gearvrf.widgetlib.main.Utility.readTextFile(context, asset));
    }
1144331
public static InputStream getResourceAsStream(UimaContext context, String name)
      throws ResourceInitializationException {

    InputStream inResource = getOptionalResourceAsStream(context, name);

    if (inResource == null) {
      throw new ResourceInitializationException(
          ExceptionMessages.MESSAGE_CATALOG,
          ExceptionMessages.IO_ERROR_MODEL_READING, new Object[] { name
              + " could not be found!" });
    }

    return inResource;
  }
1340404
@Override
    public AssetPage addAsset(AssetPage asset, boolean renderImmediately) {
        final String assetKey = asset.getReference().toString();
        if(assets.containsKey(assetKey)) {
            return assets.get(assetKey);
        }
        else {
            assets.put(assetKey, asset);
            if(renderImmediately) {
                context.get().renderAsset(asset);
            }

            return asset;
        }
    }
1114753
public String readFromFile(String fileName) {
    String content = null;
    BufferedReader br = null;
    try {
      File inFile = new File(fileName);
      br = new BufferedReader(new InputStreamReader(
          new FileInputStream(inFile)));
      content = "";
      while(br.ready()) {
      	content += br.readLine();
      }
      br.close();
    } catch (FileNotFoundException ex) {
    	log.error("Failed to find file.", ex);
    } catch (IOException ex) {
    	log.error("Failed to read file.", ex);
    } finally {
    	if(br != null) {
    		try {
    			br.close();
    		} catch(Exception e){}
    	}
    }
    return content;
  }
49196
public static String getBaseName(String fileName) {
        if (fileName == null)
            return null;

        String[] tokens = split(fileName);
        return tokens[0];
    }
121178
@NonNull
  public static File getFile(@NonNull Context context, @NonNull String fileName) {
    return new File(context.getFilesDir(), fileName);
  }
1320957
public static String fileToString(String fileName, String charsetName) {
		return fileToString(new File(fileName), charsetName);
	}
99044
public AssetInfo getImplAsset(String className) throws ServiceException {
        int lastDot = className.lastIndexOf('.');
        if (lastDot > 0 && lastDot < className.length() - 1) {
            String assetRoot = className.substring(0, lastDot) + "/" + className.substring(lastDot + 1);
                AssetInfo implAsset = getAsset(assetRoot + ".java");
                if (implAsset == null)
                    return getAsset(assetRoot + ".kt");
        }
        return null;
    }