Code example for FileLock

Methods: channelisSharedisValidpositionsize

0
     */ 
    public void test_lockJJZ_Shared() throws Exception {
        final long POSITION = 100;
        final long SIZE = 200;
        fileLock = readOnlyFileChannel.lock(POSITION, SIZE, true);
        assertTrue(fileLock.isValid());
        // fileLock.isShared depends on whether the underlying platform support 
        // shared lock, but it works on Windows & Linux. 
        assertTrue(fileLock.isShared());
        assertSame(readOnlyFileChannel, fileLock.channel());
        assertEquals(POSITION, fileLock.position());
        assertEquals(SIZE, fileLock.size());
    } 
 
    /** 
     * @tests java.nio.channels.FileChannel#lock(long, long, boolean) 
     */ 
    public void test_lockJJZ_NotShared() throws Exception {
        final long POSITION = 100;
        final long SIZE = 200;
Connect your IDE to all the code out there  Get Codota for Java