private synchronized void init()
  {
    // already initialized
    if(_resourceInfo != null)
      return;

    // make a local copy of the file
    try
    {
      InputStream is = _resource.getInputStream();
      try
      {
        File file = GCFile.createTempFile(LocalCacheLeafResource.class.getName(),
                                          _resource.getFilename());
        FileOutputStream fos = new FileOutputStream(file);
        try
        {
          BufferedOutputStream out = new BufferedOutputStream(fos);
          IOUtils.copy(new BufferedInputStream(is), out);
          out.flush();
        }
        finally
        {
          fos.close();
        }

        ResourceInfo info = _resource.getInfo();

        _localFile = file;
        _resourceInfo = new StaticInfo(info.getContentLength(), info.getLastModified());
        _ioException = null;
      }
      finally
      {
        is.close();
      }
    }
    catch(IOException e)
    {
      _localFile = null;
      _resourceInfo = new StaticInfo(0, 0);
      _ioException = e;
    }

  }
private synchronized void init()
  {
    
    if(_resourceInfo != null)
      return;

    
    try
    {
      InputStream is = _resource.getInputStream();
      try
      {
        File file = GCFile.createTempFile(LocalCacheLeafResource.class.getName(),
                                          _resource.getFilename());
        FileOutputStream fos = new FileOutputStream(file);
        try
        {
          BufferedOutputStream out = new BufferedOutputStream(fos);
          IOUtils.copy(new BufferedInputStream(is), out);
          out.flush();
        }
        finally
        {
          fos.close();
        }

        ResourceInfo info = _resource.getInfo();

        _localFile = file;
        _resourceInfo = new StaticInfo(info.getContentLength(), info.getLastModified());
        _ioException = null;
      }
      finally
      {
        is.close();
      }
    }
    catch(IOException e)
    {
      _localFile = null;
      _resourceInfo = new StaticInfo(0, 0);
      _ioException = e;
    }

  }
private synchronized void init ( ) { // already initialized if ( _resourceInfo != null ) return ; // make a local copy of the file try { InputStream is = _resource . getInputStream ( ) ; try { File file = GCFile . createTempFile ( LocalCacheLeafResource . class . getName ( ) , _resource . getFilename ( ) ) ; FileOutputStream fos = new FileOutputStream ( file ) ; try { BufferedOutputStream out = new BufferedOutputStream ( fos ) ; IOUtils . copy ( new BufferedInputStream ( is ) , out ) ; out . flush ( ) ; } finally { fos . close ( ) ; } ResourceInfo info = _resource . getInfo ( ) ; _localFile = file ; _resourceInfo = new StaticInfo ( info . getContentLength ( ) , info . getLastModified ( ) ) ; _ioException = null ; } finally { is . close ( ) ; } } catch ( IOException e ) { _localFile = null ; _resourceInfo = new StaticInfo ( 0 , 0 ) ; _ioException = e ; } }
Initializes the fields (safe to call multiple times). Thread safe.
Initializes the fields ( safe to call multiple times ) . Thread safe .