Creates a VCF index file.
@param indexPath The index created.
@return
@throws IOException
497569
public Path createIndex(Path indexPath) throws IOException {
        VCFFileReader reader = new VCFFileReader(input.toFile(), false);

        // compress vcf if necessary, .gz
        if (!dataPath.getFileName().endsWith(".gz")) {
            dataPath = Paths.get(input + ".gz");
            System.out.println("Creating compressed file: " + dataPath);
            VariantContextWriter writer = new VariantContextWriterBuilder()
                    .setOutputFile(dataPath.toFile())
                    .setOutputFileType(BLOCK_COMPRESSED_VCF)
                    .build();

            writer.writeHeader(reader.getFileHeader());
            for (VariantContext vc: reader) {
                if (vc != null) {
                    writer.add(vc);
                }
            }
            writer.close();
        }


        // and then create the tabix index, .tbi
        if (indexPath == null) {
            this.indexPath = Paths.get(dataPath + ".tbi");
        } else {
            this.indexPath = indexPath;
        }


        System.out.println("Creating index file: " + this.indexPath);
        IndexFactory.createTabixIndex(dataPath.toFile(), new VCFCodec(), TabixFormat.VCF, reader.getFileHeader().getSequenceDictionary())
                .write(this.indexPath.toFile());
        reader.close();
        return this.indexPath;
    }
317088
private TxnRecord getTxnRecord(Path indexFilePath) throws IOException {
        Path tmpPath = tmpFilePath(indexFilePath.toString());
        if (this.options.fs.exists(indexFilePath)) {
            return readTxnRecord(indexFilePath);
        } else if (this.options.fs.exists(tmpPath)) {
            return readTxnRecord(tmpPath);
        }
        return new TxnRecord(0, options.currentFile.toString(), 0);
    }
1262361
public void loadFile(Resource res, String resourcePath) throws IOException {
	res.createFile(true);
	InputStream is = InfoImpl.class.getResourceAsStream(resourcePath);
	IOUtil.copy(is, res, true);
    }
216655
private static void createBlockFile(String blockPath) throws IOException {
    FileUtils.createBlockPath(blockPath,
        ServerConfiguration.get(PropertyKey.WORKER_DATA_FOLDER_PERMISSIONS));
    FileUtils.createFile(blockPath);
    FileUtils.changeLocalFileToFullPermission(blockPath);
    LOG.debug("Created new file block, block path: {}", blockPath);
  }
302648
public SequenceFile.Writer createSequenceFile(String newPath) throws IOException {
        if (codec != null) {
            return SequenceFile.createWriter(
                    fs, conf, new Path(newPath),
                    Text.class, MessageWritable.class,
                    SequenceFile.CompressionType.BLOCK, codec);
        } else {
            return SequenceFile.createWriter(
                    fs, conf, new Path(newPath),
                    Text.class, MessageWritable.class,
                    SequenceFile.CompressionType.NONE, codec);
        }
    }
131129
private FileReader createFileReader(LogFilePath logFilePath) throws Exception {
        CompressionCodec codec = null;
        if (mConfig.getCompressionCodec() != null && !mConfig.getCompressionCodec().isEmpty()) {
            codec = CompressionUtil.createCompressionCodec(mConfig.getCompressionCodec());
        }
        FileReader fileReader = ReflectionUtil.createFileReader(
                mConfig.getFileReaderWriterFactory(),
                logFilePath,
                codec,
                mConfig
        );
        return fileReader;
    }
828888
private void createLibFolder() throws IOException {
        if(!Files.exists(libLocation.toPath()))
            Files.createDirectories(libLocation.toPath());
    }
672821
private static void indexFile(IndexWriter writer, File f)
        throws IOException {

    if (f.isHidden() || !f.exists() || !f.canRead()) {
        System.err.println("Could not write "+f.getName());
        return;
    }

    System.err.println("Indexing " + f.getCanonicalPath());

    Document doc = new Document();

    doc.add(new Field("path", f.getCanonicalPath(), Field.Store.YES, Field.Index.NOT_ANALYZED));
    doc.add(new Field("modified",DateTools.timeToString(f.lastModified(), DateTools.Resolution.MINUTE),Field.Store.YES, Field.Index.NOT_ANALYZED));
    doc.add(new Field("contents", new FileReader(f)));
                
    writer.addDocument(doc);
   }
446245
private File resolveIndexDirectoryPath() throws IOException {
        if (StringUtils.isEmpty(indexDirectoryPath)) {
            indexDirectoryPath = System.getProperty("java.io.tmpdir") + appContext.getApplicationName();
        }
        
        File dir = new File(indexDirectoryPath, getClass().getPackage().getName());
        
        if (!dir.exists() && !dir.mkdirs()) {
            throw new IOException("Failed to create help search index directory.");
        }
        
        log.info("Help search index located at " + dir);
        return dir;
    }
211046
public static boolean createFolder(String folderPath) {
        if (!StringUtils.isEmpty(folderPath)) {
            File folder = new File(folderPath);
            return createFolder(folder);
        }
        return false;
    }
91381
public static IDLProxyObject createSingle(InputStream is, boolean debug, File path) throws IOException {
        return createSingle(is, debug, path, true);
    }
82011
public void addClassPath(String classpath)
  {
    char sep = CauchoUtil.getPathSeparatorChar();
    int head = 0;
    int tail = 0;
    while (head < classpath.length()) {
      tail = classpath.indexOf(sep, head);

      String segment = null;
      if (tail < 0) {
        segment = classpath.substring(head);
        head = classpath.length();
      }
      else {
        segment = classpath.substring(head, tail);
        head = tail + 1;
      }

      if (segment.equals(""))
        continue;
      else if (segment.endsWith(".jar") || segment.endsWith(".zip"))
        addMergePath(JarPath.create(VfsOld.lookup(segment)));
      else
        addMergePath(VfsOld.lookup(segment));
    }
  }
1047978
int createPathUserIndex() {
		if (m_pathindices == null)
			m_pathindices = new ArrayList<AttributeStreamOfInt32>(0);
		// Try getting existing index. Use linear search. We do not expect many
		// indices to be created.
		for (int i = 0; i < m_pathindices.size(); i++) {
			if (m_pathindices.get(i) == null) {
				m_pathindices.set(i,
						(AttributeStreamOfInt32) (AttributeStreamBase
								.createIndexStream(0)));
				return i;
			}
		}

		m_pathindices.add((AttributeStreamOfInt32) (AttributeStreamBase
				.createIndexStream(0)));
		return (int) (m_pathindices.size() - 1);
	}
479712
public static boolean createFile(String filePath) {
        if (!StringUtils.isEmpty(filePath)) {
            File file = new File(filePath);
            return createFile(file);
        }
        return false;
    }
1260300
public static void makesureDirExists(Path dirPath) throws IOException {
		Validate.notNull(dirPath);
		Files.createDirectories(dirPath);
	}
1052042
void createDirectory(Path path) throws IOException {
		if (Files.exists(path) && Files.isDirectory(path)) {
			return;
		}

		if (this.readOnly) {
			throw new FileNotFoundException(
					"The requested directory \""
							+ path.toString()
							+ "\" does not exist and we are in read-only mode, so it cannot be created.");
		}

		Files.createDirectory(path);
	}
425959
public static void splitFile(String filePath, long[] splitPoints, String storageFolder) throws IOException {
        splitFile(new File(filePath), splitPoints, storageFolder);
    }