Examples of FileSystem


Examples of org.h2.store.fs.FileSystem

        conn.close();
    }

    private void testRead() throws Exception {
        String fileName = getBaseDir() + "/test.csv";
        FileSystem fs = FileSystem.getInstance(fileName);
        fs.delete(fileName);
        FileObject file = fs.openFileObject(fileName, "rw");
        byte[] b = "a,b,c,d\n201,-2,0,18\n, \"abc\"\"\" ,,\"\"\n 1 ,2 , 3, 4 \n5, 6, 7, 8".getBytes();
        file.write(b, 0, b.length);
        file.close();
        ResultSet rs = Csv.getInstance().read(fileName, null, "UTF8");
        ResultSetMetaData meta = rs.getMetaData();
        assertEquals(4, meta.getColumnCount());
        assertEquals("A", meta.getColumnLabel(1));
        assertEquals("B", meta.getColumnLabel(2));
        assertEquals("C", meta.getColumnLabel(3));
        assertEquals("D", meta.getColumnLabel(4));
        assertTrue(rs.next());
        assertEquals("201", rs.getString(1));
        assertEquals("-2", rs.getString(2));
        assertEquals("0", rs.getString(3));
        assertEquals("18", rs.getString(4));
        assertTrue(rs.next());
        assertEquals(null, rs.getString(1));
        assertEquals("abc\"", rs.getString(2));
        assertEquals(null, rs.getString(3));
        assertEquals("", rs.getString(4));
        assertTrue(rs.next());
        assertEquals("1", rs.getString(1));
        assertEquals("2", rs.getString(2));
        assertEquals("3", rs.getString(3));
        assertEquals("4", rs.getString(4));
        assertTrue(rs.next());
        assertEquals("5", rs.getString(1));
        assertEquals("6", rs.getString(2));
        assertEquals("7", rs.getString(3));
        assertEquals("8", rs.getString(4));
        assertFalse(rs.next());

        // a,b,c,d
        // 201,-2,0,18
        // 201,2,0,18
        // 201,2,0,18
        // 201,2,0,18
        // 201,2,0,18
        // 201,2,0,18
        fs.delete(fileName);
    }
View Full Code Here

Examples of org.h2.store.fs.FileSystem

     * @param handler the callback object
     * @param name the file name
     * @param mode the access mode ("r", "rw", "rws", "rwd")
     */
    protected FileStore(DataHandler handler, String name, String mode) {
        FileSystem fs = FileSystem.getInstance(name);
        this.handler = handler;
        this.name = name;
        this.mode = mode;
        if (handler != null) {
            tempFileDeleter = handler.getTempFileDeleter();
        }
        try {
            boolean exists = fs.exists(name);
            if (exists && !fs.canWrite(name)) {
                mode = "r";
                this.mode = mode;
            } else {
                fs.createDirs(name);
            }
            file = fs.openFileObject(name, mode);
            if (mode.length() > 2) {
                synchronousMode = true;
            }
            if (exists) {
                fileLength = file.length();
View Full Code Here

Examples of org.hyperic.sigar.FileSystem

    }
  }

  public static void getServerDiskInfo(Sigar sigar, ServerStatus status) {
    try {
      FileSystem fslist[] = sigar.getFileSystemList();
      FileSystemUsage usage = null;
      for (int i = 0; i < fslist.length; i++) {
        FileSystem fs = fslist[i];
        switch (fs.getType()) {
        case 0: // TYPE_UNKNOWN :未知
        case 1: // TYPE_NONE
        case 3:// TYPE_NETWORK :网络
        case 4:// TYPE_RAM_DISK :闪存
        case 5:// TYPE_CDROM :光驱
        case 6:// TYPE_SWAP :页面交换
          break;
        case 2: // TYPE_LOCAL_DISK : 本地硬盘
          DiskInfoVo disk = new DiskInfoVo();
          disk.setDevName(fs.getDevName());
          disk.setDirName(fs.getDirName());
          usage = sigar.getFileSystemUsage(fs.getDirName());
          disk.setTotalSize(usage.getTotal() / (1024 * 1024));
          // disk.setFreeSize(usage.getFree()/(1024*1024));
          disk.setAvailSize(usage.getAvail() / (1024 * 1024));
          disk.setUsedSize(usage.getUsed() / (1024 * 1024));
          disk.setUsePercent(usage.getUsePercent() * 100D + "%");
          disk.setTypeName(fs.getTypeName());
          disk.setSysTypeName(fs.getSysTypeName());

          String val = diskWritesAndReadsOnInit.get(fs.getDevName());
          if (val != null) {
            long timePeriod = (System.currentTimeMillis() - initTime) / 1000;
            long origRead = Long.parseLong(val.split("\\|")[0]);
            long origWrite = Long.parseLong(val.split("\\|")[1]);
            disk.setDiskReadRate((usage.getDiskReadBytes() - origRead) / timePeriod);
View Full Code Here

Examples of org.jcoredb.fs.impl.FileSystem

 
  @Test
  public void dropTest() throws Exception
  {
    //Create a File System
    IFileSystem fs = new FileSystem(Constants.ROOT_PATH);
    fs.create(0);
    fs.create(Integer.MAX_VALUE);
    fs.close();
   
    //Open the File System
    fs = new FileSystem(Constants.ROOT_PATH);
    fs.open();
    fs.drop(Integer.MAX_VALUE);
   
    assertTrue(new File(Constants.ROOT_PATH + org.jcoredb.system.Constants.PATH_SEP + 0).exists());
    assertFalse(new File(Constants.ROOT_PATH + org.jcoredb.system.Constants.PATH_SEP + Integer.MAX_VALUE).exists());
  }
View Full Code Here

Examples of org.kie.commons.java.nio.file.FileSystem

        org.kie.commons.java.nio.file.Path repositoryRootPath = null;

        final Iterator<FileSystem> fsIterator = ioSystemService.getFileSystems().iterator();
       
        if ( fsIterator.hasNext() ) {
            final FileSystem fileSystem = fsIterator.next();
            System.out.println("-----FileSystem id--- :" + ((org.kie.commons.java.nio.base.FileSystemId) fileSystem).id());
           
            if (repositoryName.equalsIgnoreCase(((org.kie.commons.java.nio.base.FileSystemId) fileSystem).id())) {
                 final Iterator<org.kie.commons.java.nio.file.Path> rootIterator = fileSystem.getRootDirectories().iterator();
                 if (rootIterator.hasNext()) {
                     repositoryRootPath = rootIterator.next();
                     System.out.println("-----rootPath--- :" + repositoryRootPath);

                     org.kie.commons.java.nio.file.DirectoryStream<org.kie.commons.java.nio.file.Path> paths = ioSystemService
View Full Code Here

Examples of org.mockftpserver.fake.filesystem.FileSystem

    void startServer() {
        fakeFtpServer = new FakeFtpServer();
        fakeFtpServer.setServerControlPort(9879);
        fakeFtpServer.addUserAccount(new UserAccount("admin", "123456", "/"));

        FileSystem fileSystem = new UnixFakeFileSystem();
        fileSystem.add(new DirectoryEntry("/data/prancingdonkey/catalog"));
        fakeFtpServer.setFileSystem(fileSystem);
        fakeFtpServer.start();

        DataSource dataSource =  muleContext.getRegistry().lookupObject("dataSource");
        template = new JdbcTemplate(dataSource);
View Full Code Here

Examples of org.nxplanner.file.FileSystem

                Integer projectId = (Integer)noteToProjectMap.get(new Integer(note.getId()));
                if (projectId == null) {
                    projectId = new Integer(0);
                }
                int filesize = rs.getInt("file_size");
                final FileSystem fileSystem = new FileSystemImpl();
                Directory directory = fileSystem.getDirectory("/attachments/project/"+projectId);
                File file = fileSystem.createFile(directory, rs.getString("filename"), rs.getString("content_type"),
                        filesize, rs.getBlob("file").getBinaryStream());
                note.setFile(file);
            }
            session.flush();
            session.connection().commit();
View Full Code Here

Examples of org.openide.filesystems.FileSystem

                "Language not defined for this Parcel Folder");
            TopManager.getDefault().notify(d);
            return;
        }

        FileSystem fs = Repository.getDefault().getDefaultFileSystem();
        DataObject result = null;
        try {
            DataObject dObj = DataObject.find(fs.findResource(sourceFile));
            result = dObj.createFromTemplate(parent);
        }
        catch (IOException ioe) {
            ErrorManager.getDefault().notify(ioe);
        }
View Full Code Here

Examples of org.sleuthkit.datamodel.FileSystem

            final org.sleuthkit.datamodel.File f = (org.sleuthkit.datamodel.File) file;

            // Get the type of the file system, if any, that owns the file.
            TskData.TSK_FS_TYPE_ENUM fsType = TskData.TSK_FS_TYPE_ENUM.TSK_FS_TYPE_UNSUPP;
            try {
                FileSystem fs = f.getFileSystem();
                if (fs != null) {
                    fsType = fs.getFsType();
                }
            } catch (TskCoreException ex) {
                logger.log(Level.SEVERE, "Error querying file system for " + f, ex); //NON-NLS
            }
View Full Code Here

Examples of org.sonar.api.batch.fs.FileSystem

  private void processLine(File coverPerTest, int lineNumber, SensorContext context, String line, InputFile file) {
    try {
      Iterator<String> split = Splitter.on(":").split(line).iterator();
      String otherFileRelativePath = split.next();
      FileSystem fs = context.fileSystem();
      InputFile otherFile = fs.inputFile(fs.predicates().hasRelativePath(otherFileRelativePath));
      if (otherFile == null) {
        throw new IllegalStateException("Unable to find file " + otherFileRelativePath);
      }
      int weight = Integer.parseInt(split.next());
      context.newDependency()
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.