ImageIO.read()无限循环

时间:2015-09-17 16:47:51

标签: java loading bufferedimage javax.imageio

ImageIO.read()似乎陷入无限循环。

我的代码:

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

public class Texture {
    BufferedImage _img;

    public Texture(String path) {
        try {
            _img = ImageIO.read(new File(path));
        } catch (final IOException e) {
            e.printStackTrace();
        }
    }
}

其他课程:

private Texture _tex;
_tex = new Texture("/res/img.png");

我已尝试加载此网址和文件的图片,但无效。

我在mac上使用eclipse,如果与任何事情有任何关系,我正在使用LWJGL 3.

希望你能帮助我! : - )

1 个答案:

答案 0 :(得分:0)

尝试使用如下输入流,而不是使用文件:

  <!-- my controller -->
   public function show()
      {
            $genres = new genres;
             $y = $genre->with("movie")->where("genre","Romance")->get();
             return $y;
       }
    <!-- model -->
   <?php

   namespace App;

   use Illuminate\Database\Eloquent\Model;
    use App\movies;
     class genres extends Model
       {
         public $table ="genres";
         public function movie(){
             return $this->belongsToMany(movies::class,
                   "relation","genre_id","movie_id");
                                 }
       }

我实际上遇到了类似的问题,但它与BufferedImages的创建有关。