Examples of truncate()


Examples of java.nio.channels.FileChannel.truncate()

            FileUtil.createNewFile(target);
        } else if (endpoint.getFileExist() == GenericFileExist.Override) {
            LOG.debug("Truncating existing file: {}", target);
            FileChannel out = new FileOutputStream(target).getChannel();
            try {
                out.truncate(0);
            } finally {
                IOHelper.close(out, target.getName(), LOG, endpoint.isForceWrites());
            }
        }
    }
View Full Code Here

Examples of java.sql.Blob.truncate()

        assertTrue(rs.next());
        Blob blob = rs.getBlob("DATA");

        assertEquals(100, blob.length());

        blob.truncate(50);
        assertEquals(50, blob.length());

        blob.truncate(150);
        assertEquals(150, blob.length());
View Full Code Here

Examples of java.sql.Clob.truncate()

        this.rs = utf8Conn.createStatement().executeQuery(
            "SELECT `text` FROM testBug11614 WHERE id=1");
        assertTrue(this.rs.next());

        Clob c = this.rs.getClob(1);
        c.truncate(0);
        int blockSize = 8192;
        int sizeToTest = blockSize + 100;

        StringBuffer blockBuf = new StringBuffer(sizeToTest);
View Full Code Here

Examples of javax.microedition.io.file.FileConnection.truncate()

            FileConnection file =
                    (FileConnection) Connector.open("file:///root1/char.bin");
            try {
                if (!file.exists()) {
                    file.create();
                    file.truncate(0);
                }
                DataOutputStream out = file.openDataOutputStream();

                try {
View Full Code Here

Examples of javax.sql.rowset.serial.SerialClob.truncate()

        }
    }

    public void testTruncate() throws Exception {
        SerialClob serialClob = new SerialClob("hello".toCharArray());
        serialClob.truncate(3);
        assertEquals(3, serialClob.length());
        String s = serialClob.getSubString(1, 3);
        assertEquals("hel", s);
        serialClob.truncate(0);
        assertEquals(0, serialClob.length());
View Full Code Here

Examples of net.sf.logsaw.index.IIndexService.truncate()

      IIndexService indexService = IndexPlugin.getDefault().getIndexService();
      loadLogFile("sample-1.log.xml");
      createLogResourceWithPK("UTF-8", Locale.getDefault(), getTimeZone());
      indexService.synchronize(getLogResource(), null);
      assertEquals(5, indexService.count(getLogResource()));
      indexService.truncate(getLogResource());
      assertEquals(0, indexService.count(getLogResource()));
    } catch (Exception e) {
      getLogger().error(e.getLocalizedMessage(), e);
      fail("Exception should not occur: " + e.getLocalizedMessage());
    }
View Full Code Here

Examples of org.apache.cassandra.thrift.Cassandra.Client.truncate()

      @PathVariable("columnFamilyName") String columnFamilyName,
      ModelMap model) throws Exception {
   
    Client client = clientProvider.getThriftClient();
    client.set_keyspace(keyspaceName);
    client.truncate(
        columnFamilyName
    );
    model.clear();
    return "redirect:/keyspace/" + keyspaceName + "/" + columnFamilyName + "/";
   
View Full Code Here

Examples of org.apache.james.mime4j.RootInputStream.truncate()

            new RootInputStream(new ByteArrayInputStream(s.getBytes()));
        assertEquals(s.charAt(0), (char) is.read());
        assertEquals(s.charAt(1), (char) is.read());
        assertEquals(s.charAt(2), (char) is.read());
        assertEquals(s.charAt(3), (char) is.read());
        is.truncate();
        assertEquals(-1, is.read());
        byte[] buf = new byte[100];
        assertEquals(-1, is.read(buf));
        assertEquals(-1, is.read(buf, 2, 5));
    }
View Full Code Here

Examples of org.apache.james.mime4j.io.RootInputStream.truncate()

            new RootInputStream(new ByteArrayInputStream(s.getBytes()));
        assertEquals(s.charAt(0), (char) is.read());
        assertEquals(s.charAt(1), (char) is.read());
        assertEquals(s.charAt(2), (char) is.read());
        assertEquals(s.charAt(3), (char) is.read());
        is.truncate();
        assertEquals(-1, is.read());
        byte[] buf = new byte[100];
        assertEquals(-1, is.read(buf));
        assertEquals(-1, is.read(buf, 2, 5));
    }
View Full Code Here

Examples of org.apache.sshd.common.file.SshFile.truncate()

                        }
                    }
                    String acc = ((pflags & (SSH_FXF_READ | SSH_FXF_WRITE)) != 0 ? "r" : "") +
                            ((pflags & SSH_FXF_WRITE) != 0 ? "w" : "");
                    if ((pflags & SSH_FXF_TRUNC) != 0) {
                        file.truncate();
                    }
                    if ((pflags & SSH_FXF_CREAT) != 0) {
                        file.setAttributes(attrs);
                    }
                    String handle = UUID.randomUUID().toString();
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.