Builds the path.

@return the path
@throws javax.imageio.IIOException if the input contains a bad path data.
@throws IOException if a general I/O exception occurs during reading.
17346
public Path2D path() throws IOException {
        List<List<AdobePathSegment>> subPaths = new ArrayList<List<AdobePathSegment>>();
        List<AdobePathSegment> currentPath = null;
        int currentPathLength = 0;

        AdobePathSegment segment;
        while ((segment = nextSegment()) != null) {

            if (DEBUG) {
                System.out.println(segment);
            }

            if (segment.selector == AdobePathSegment.OPEN_SUBPATH_LENGTH_RECORD || segment.selector == AdobePathSegment.CLOSED_SUBPATH_LENGTH_RECORD) {
                if (currentPath != null) {
                    if (currentPathLength != currentPath.size()) {
                        throw new IIOException(String.format("Bad path, expected %d segments, found only %d", currentPathLength, currentPath.size()));
                    }
                    subPaths.add(currentPath);
                }

                currentPath = new ArrayList<AdobePathSegment>(segment.length);
                currentPathLength = segment.length;
            }
            else if (segment.selector == AdobePathSegment.OPEN_SUBPATH_BEZIER_LINKED
                    || segment.selector == AdobePathSegment.OPEN_SUBPATH_BEZIER_UNLINKED
                    || segment.selector == AdobePathSegment.CLOSED_SUBPATH_BEZIER_LINKED
                    || segment.selector == AdobePathSegment.CLOSED_SUBPATH_BEZIER_UNLINKED) {
                if (currentPath == null) {
                    throw new IIOException("Bad path, missing subpath length record");
                }
                if (currentPath.size() >= currentPathLength) {
                    throw new IIOException(String.format("Bad path, expected %d segments, found%d", currentPathLength, currentPath.size()));
                }

                currentPath.add(segment);
            }
        }

        // now add the last one
        if (currentPath != null) {
            if (currentPathLength != currentPath.size()) {
                throw new IIOException(String.format("Bad path, expected %d segments, found only %d", currentPathLength, currentPath.size()));
            }

            subPaths.add(currentPath);
        }

        // now we have collected the PathPoints now create a Shape.
        return pathToShape(subPaths);
    }
1253908
public static CacheConfiguration build() throws IOException {
		File file = new File(ClassLoaderUtils.getResourcePath("") + "cache.properties");
		return build(file);
	}
973124
public String path() {
    if (path == null) {
      if (!hasPath) {
        return path = "";
      }

      int pathEndPos = uri.indexOf('?');
      if (pathEndPos < 0) {
        path = uri;
      } else {
        return path = uri.substring(0, pathEndPos);
      }
    }
    return path;
  }
248290
protected String readHostsFile() throws IOException {
		String path = this.getHostsPath();
		BufferedReader reader = new BufferedReader(new FileReader(path));
		StringBuilder sb = new StringBuilder();
		String line;
		while ((line = reader.readLine()) != null) {
			sb.append(line).append("\n");
		}
		reader.close();
		return sb.toString();
	}
963848
@Override
    public void build() throws IOException{
        generator.writeEndObject();
        generator.close();
        sb.append(baos.toString());
        
    }
1121960
public static InputStream newInputStream(String path) throws IOException
    {
        if (IOAdapter == null) return new FileInputStream(path);
        return IOAdapter.open(path);
    }
108744
@Override
  public void create()
    throws IOException
  {
    Files.createDirectories(_path.getParent());

    if (Files.exists(_path)) {
      throw new IOException(L.l("CREATE for path '{0}' failed, because the file already exists.  CREATE can not override an existing table.",
                                _path));
    }
    
    init();
    /*
    _channel = _path.openFileChannel(StandardOpenOption.CREATE, 
                                     StandardOpenOption.WRITE,
                                     StandardOpenOption.READ);
    
    setFileSize(_path.length());
    
    initImpl();
    */
  }
273115
public Resource addPath(String path)
        throws IOException,MalformedURLException
    {
        if (path==null)
            return null;

        path = URI.canonicalPath(path);

        return newResource(URI.addPaths(_url.toExternalForm(),path));
    }
437943
public InputStream getInputStream()
    throws IOException
  {
    if (_is == null)
      _is = new FileInputStream(_file.getFD());

    return _is;
  }
656550
private String buildClassPath()
  {
    String classPath = null;//_classPath;

    if (classPath != null) {
      return classPath;
    }

    if (classPath == null && _loader instanceof DynamicClassLoader) {
      classPath = ((DynamicClassLoader) _loader).getClassPath();
    }
    else { // if (true || _loader instanceof URLClassLoader) {
      StringBuilder sb = new StringBuilder();
      sb.append(CauchoUtil.getClassPath());

      if (_loader != null)
        buildClassPath(sb, _loader);

      classPath = sb.toString();
    }
    //else if (classPath == null)
      //classPath = CauchoSystem.getClassPath();

    String srcDirName = getSourceDirName();
    String classDirName = getClassDirName();

    char sep = CauchoUtil.getPathSeparatorChar();

    if (_extraClassPath != null)
      classPath = classPath + sep + _extraClassPath;

    // Adding the srcDir lets javac and jikes find source files
    if (! srcDirName.equals(classDirName))
      classPath = srcDirName + sep + classPath;
    classPath = classDirName + sep + classPath;

    return classPath;
  }
691300
public Map<String, Object> build() {
        final ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
        //noinspection unchecked
        ofNullable(uploadOptions).map(x -> builder.putAll(x.build()));
        return builder.build();
    }
235798
@Override
    public String path() {
        try {
            return new URI(request.uri()).getRawPath();
        } catch (URISyntaxException e) { //NOSONAR
            // Should never be the case.
            return uri();
        }
    }
1198410
public static InputStream getStream(String path) throws IOException {
    // the other ways to load the stream like
    // "Tools.class.getClass().getResourceAsStream(filename)"
    // don't work in a web context (using Grails):
    InputStream is = Tools.class.getResourceAsStream(path);
    if (is == null) {
      throw new IOException("Could not load file from classpath: '" + path + "'");
    }
    return is;
  }
852170
protected String findClasspathFile(final String path) throws IOException {
        if (path == null){
            return null;
        }
        final File file = new File(path);
        if (file.exists()){
            return file.getAbsolutePath();
        }
        return createTmpFile(path).getAbsolutePath();
    }
345484
public Object read() throws IOException {
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine("Reading "+file);
        }
        try (InputStream in = new BufferedInputStream(Files.newInputStream(file.toPath()))) {
            return xs.fromXML(in);
        } catch (RuntimeException | Error e) {
            throw new IOException("Unable to read "+file,e);
        }
    }
378560
public FSDataOutputStream create(Path f) throws IOException {
    return create(f, CreateOptions.writeOptions(true, null));
  }
1071152
public static Path getFile(HttpServletRequest request)
            throws IOException {
        Path result = null;

        // Set up the objects that do all the heavy lifting
        DiskFileItemFactory factory = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload(factory);

        try {
            // Read the items - this will save the values to temp files
            for (FileItem item : upload.parseRequest(request)) {
                if (!item.isFormField()) {
                    result = Files.createTempFile("upload", ".file");
                    item.write(result.toFile());
                }
            }
        } catch (Exception e) {
            // item.write throws a general Exception, so specialise it by wrapping with IOException
            throw new IOException("Error processing uploaded file", e);
        }

        return result;
    }