Loads the icon from the file system once we get a reference to Vert.x

@param yoke
@param mount
549301
@Override
    public Middleware init(@NotNull final Yoke yoke, @NotNull final String mount) {
        try {
            super.init(yoke, mount);
            if (path == null) {
                icon = new Icon(Utils.readResourceToBuffer(getClass(), "favicon.ico"));
            } else {
                icon = new Icon(fileSystem().readFileBlocking(path));
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        return this;
    }
514039
public void load() {
		int resp = loadChooser.showOpenDialog(this);
		if (resp == JFileChooser.APPROVE_OPTION) {
			lastSelected = loadChooser.getSelectedFile();
			saveChooser.setCurrentDirectory(loadChooser.getCurrentDirectory());
			try {
				BufferedImage image = ImageIO.read(lastSelected);
				imagePanel.setImage(image);
			} catch (Exception e) {
				e.printStackTrace();
				JOptionPane.showMessageDialog(this, "Unable to load image "+lastSelected.getName()+" ");
			}
		}
	}
831626
private static ReuseResult loadBitmapReuseExact(ImageSource source, Bitmap dest) throws ImageLoadException {
        ImageMetadata metadata = source.getImageMetadata();
        boolean tryReuse = false;
        if (dest.isMutable()
                && dest.getWidth() == metadata.getW()
                && dest.getHeight() == metadata.getH()) {
            if (Build.VERSION.SDK_INT >= 19) {
                tryReuse = true;
            } else if (Build.VERSION.SDK_INT >= 11) {
                if (metadata.getFormat() == ImageFormat.JPEG || metadata.getFormat() == ImageFormat.PNG) {
                    tryReuse = true;
                }
            }
        }

        if (tryReuse) {
            return source.loadBitmap(dest);
        } else {
            return new ReuseResult(loadBitmap(source), false);
        }
    }
1203091
private void sendDirectory(final YokeRequest request, final String dir, final Handler<Object> next) {
        final FileSystem fileSystem = vertx().fileSystem();

        fileSystem.readDir(dir, new AsyncResultHandler<List<String>>() {
            @Override
            public void handle(AsyncResult<List<String>> asyncResult) {
                if (asyncResult.failed()) {
                    next.handle(asyncResult.cause());
                } else {
                    String accept = request.getHeader("accept", "text/plain");

                    if (accept.contains("html")) {
                        String normalizedDir = dir.substring(root.length());
                        if (!normalizedDir.endsWith("/")) {
                            normalizedDir += "/";
                        }

                        String file;
                        StringBuilder files = new StringBuilder("<ul id=\"files\">");

                        for (String s : asyncResult.result()) {
                            file = s.substring(s.lastIndexOf('/') + 1);
                            // skip dot files
                            if (!includeHidden && file.charAt(0) == '.') {
                                continue;
                            }
                            files.append("<li><a href=\"");
                            files.append(normalizedDir);
                            files.append(file);
                            files.append("\" title=\"");
                            files.append(file);
                            files.append("\">");
                            files.append(file);
                            files.append("</a></li>");
                        }

                        files.append("</ul>");

                        StringBuilder directory = new StringBuilder();
                        // define access to root
                        directory.append("<a href=\"/\">/</a> ");

                        StringBuilder expandingPath = new StringBuilder();
                        String[] dirParts = normalizedDir.split("/");
                        for (int i = 1; i < dirParts.length; i++) {
                            // dynamic expansion
                            expandingPath.append("/");
                            expandingPath.append(dirParts[i]);
                            // anchor building
                            if (i > 1) {
                                directory.append(" / ");
                            }
                            directory.append("<a href=\"");
                            directory.append(expandingPath.toString());
                            directory.append("\">");
                            directory.append(dirParts[i]);
                            directory.append("</a>");
                        }

                        request.response().setContentType("text/html");
                        request.response().end(
                                directoryTemplate.replace("{title}", (String) request.get("title")).replace("{directory}", normalizedDir)
                                        .replace("{linked-path}", directory.toString())
                                        .replace("{files}", files.toString()));
                    } else if (accept.contains("json")) {
                        String file;
                        JsonArray json = new JsonArray();

                        for (String s : asyncResult.result()) {
                            file = s.substring(s.lastIndexOf('/') + 1);
                            // skip dot files
                            if (!includeHidden && file.charAt(0) == '.') {
                                continue;
                            }
                            json.add(file);
                        }

                        request.response().end(json);
                    } else {
                        String file;
                        StringBuilder buffer = new StringBuilder();

                        for (String s : asyncResult.result()) {
                            file = s.substring(s.lastIndexOf('/') + 1);
                            // skip dot files
                            if (!includeHidden && file.charAt(0) == '.') {
                                continue;
                            }
                            buffer.append(file);
                            buffer.append('\n');
                        }

                        request.response().setContentType("text/plain");
                        request.response().end(buffer.toString());
                    }
                }
            }
        });
    }
972435
function copyIcon() {
		var dest = path.join(process.env.PWD, 'res');

		// Make sure the destination exists
		mkdir(dest);

		return pify(fs.copy.bind(fs), Promise)(src, path.join(dest, 'icon.' + mime.extension(mimetype)));
	}
1244961
public static void loadParser(String path) throws LoadModelException {
		if(parser==null){
			String file = path+parseModel;
			parser = new JointParser(file);
		}
	}
732414
public void renderIconImage(ImageTag.State state, TreeElement elem)
    {
        ArrayList al = _lists[TreeHtmlAttributeInfo.HTML_LOCATION_ICON];

        assert(al != null);
        if (al.size() == 0)
            return;

        int cnt = al.size();
        for (int i = 0; i < cnt; i++) {
            TreeHtmlAttributeInfo attr = (TreeHtmlAttributeInfo) al.get(i);
            state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, attr.getAttribute(), attr.getValue());
        }
    }
157856
public static void renderDOTExternal(File dotFile, String format) throws IOException {
        renderDOTExternal(IOUtil.asBufferedUTF8Reader(dotFile), format);
    }
780308
private function _fillDevice(SimpleXMLExtended $mount, DiskDevice $dev, $i)
    {
        $mount->addAttribute('MountPointID', $i);
        if ($dev->getFsType()!=="") $mount->addAttribute('FSType', $dev->getFsType());
        $mount->addAttribute('Name', $dev->getName());
        $mount->addAttribute('Free', sprintf("%.0f", $dev->getFree()));
        $mount->addAttribute('Used', sprintf("%.0f", $dev->getUsed()));
        $mount->addAttribute('Total', sprintf("%.0f", $dev->getTotal()));
        $mount->addAttribute('Percent', $dev->getPercentUsed());
        if ($dev->getIgnore() > 0) $mount->addAttribute('Ignore', $dev->getIgnore());
        if (PSI_SHOW_MOUNT_OPTION === true) {
            if ($dev->getOptions() !== null) {
                $mount->addAttribute('MountOptions', preg_replace("/,/", ", ", $dev->getOptions()));
            }
        }
        if ($dev->getPercentInodesUsed() !== null) {
            $mount->addAttribute('Inodes', $dev->getPercentInodesUsed());
        }
        if (PSI_SHOW_MOUNT_POINT === true) {
            $mount->addAttribute('MountPoint', $dev->getMountPoint());
        }
    }
13172
def load(file)
      if File.exist? file
        symbolize_keys(YAML.load_file(File.expand_path('.', file)))
      else
        {}
      end
    end
95498
def bindmount(self, mountpoint):
        

        if not self.mountpoint:
            raise NotMountedError(self)
        try:
            _util.check_call_(['mount', '--bind', self.mountpoint, mountpoint], stdout=subprocess.PIPE)
            if 'bindmounts' in self._paths:
                self._paths['bindmounts'].append(mountpoint)
            else:
                self._paths['bindmounts'] = [mountpoint]
            return True
        except Exception as e:
            logger.exception("Error bind mounting {0}.".format(self))
            raise SubsystemError(e)
453474
public Yoke listen(final @NotNull HttpServer server) {
        server.requestHandler(new Handler<HttpServerRequest>() {
            @Override
            public void handle(HttpServerRequest req) {
                // the context map is shared with all middlewares
                final YokeRequest request = requestWrapper.wrap(req, new Context(defaultContext), engineMap, store);

                // add x-powered-by header is enabled
                Boolean poweredBy = request.get("x-powered-by");
                if (poweredBy != null && poweredBy) {
                    request.response().putHeader("x-powered-by", "yoke");
                }

                new Handler<Object>() {
                    int currentMiddleware = -1;

                    @Override
                    public void handle(Object error) {
                        if (error == null) {
                            currentMiddleware++;
                            if (currentMiddleware < middlewareList.size()) {
                                final MountedMiddleware mountedMiddleware = middlewareList.get(currentMiddleware);

                                if (!mountedMiddleware.enabled) {
                                    // the middleware is disabled
                                    handle(null);
                                } else {
                                    if (request.path().startsWith(mountedMiddleware.mount)) {
                                        mountedMiddleware.middleware.handle(request, this);
                                    } else {
                                        // the middleware was not mounted on this uri, skip to the next entry
                                        handle(null);
                                    }
                                }
                            } else {
                                HttpServerResponse response = request.response();
                                // reached the end and no handler was able to answer the request
                                response.setStatusCode(404);
                                response.setStatusMessage(HttpResponseStatus.valueOf(404).reasonPhrase());
                                if (errorHandler != null) {
                                    errorHandler.handle(request, null);
                                } else {
                                    response.end(HttpResponseStatus.valueOf(404).reasonPhrase());
                                }
                            }
                        } else {
                            request.put("error", error);
                            if (errorHandler != null) {
                                errorHandler.handle(request, null);
                            } else {
                                HttpServerResponse response = request.response();

                                int errorCode;
                                // if the error was set on the response use it
                                if (response.getStatusCode() >= 400) {
                                    errorCode = response.getStatusCode();
                                } else {
                                    // if it was set as the error object use it
                                    if (error instanceof Number) {
                                        errorCode = ((Number) error).intValue();
                                    } else if (error instanceof YokeException) {
                                        errorCode = ((YokeException) error).getErrorCode().intValue();
                                    } else if (error instanceof JsonObject) {
                                        errorCode = ((JsonObject) error).getInteger("errorCode", 500);
                                    } else if (error instanceof Map) {
                                        Integer tmp = (Integer) ((Map) error).get("errorCode");
                                        errorCode = tmp != null ? tmp : 500;
                                    } else {
                                        // default error code
                                        errorCode = 500;
                                    }
                                }

                                response.setStatusCode(errorCode);
                                response.setStatusMessage(HttpResponseStatus.valueOf(errorCode).reasonPhrase());
                                response.end(HttpResponseStatus.valueOf(errorCode).reasonPhrase());
                            }
                        }
                    }
                }.handle(null);
            }
        });
        return this;
    }
1143586
void submit(final LoadAndDisplayImageTask task) {
		taskDistributor.execute(new Runnable() {
			@Override
			public void run() {
				File image = configuration.diskCache.get(task.getLoadingUri());
				boolean isImageCachedOnDisk = image != null && image.exists();
				initExecutorsIfNeed();
				if (isImageCachedOnDisk) {
					taskExecutorForCachedImages.execute(task);
				} else {
					taskExecutor.execute(task);
				}
			}
		});
	}
1172530
public void setIcon(final Image IMAGE) {
        if (null == icon) {
            _icon = IMAGE;
        } else {
            icon.set(IMAGE);
        }
    }
1086347
@Override
    public void onBindViewHolder(@NonNull DirViewHolder vh, int position, @NonNull File file) {
        // Let the super method do its thing with checkboxes and text
        super.onBindViewHolder(vh, position, file);

        // Here we load the preview image if it is an image file
        final int viewType = getItemViewType(position, file);
        if (viewType == VIEWTYPE_IMAGE_CHECKABLE || viewType == VIEWTYPE_IMAGE) {
            // Need to set it to visible because the base code will set it to invisible by default
            vh.icon.setVisibility(View.VISIBLE);
            // Just load the image
            Glide.with(this).load(file).into((ImageView) vh.icon);
        }
    }
116082
def load_dir(src_dir)
      merged_content = ""

      Pathname.glob("#{src_dir}/*.yml").sort.each do |yaml_path|
        content = yaml_path.read.gsub(/^---$/, "")
        merged_content << content
      end

      YAML.load(merged_content)
    end
239755
public ImageHelper load(ImageView v, Request request) {
        loadInternal(v, request, listener, null);

        return this;
    }