APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.nio.fs

pack-priv Class UnixDirectoryStream

extends Object
implements DirectoryStream<Path>
Class Inheritance
All Implemented Interfaces
java.nio.file.DirectoryStream, java.lang.Iterable, java.io.Closeable, java.lang.AutoCloseable
Imports
java.nio.file.*, java.util.Iterator, .NoSuchElementException, java.util.concurrent.locks.*, java.io.IOException

Unix implementation of java.nio.file.DirectoryStream

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final UnixPath
private final long
private final DirectoryStream.Filter<? super Path>
private volatile boolean
private Iterator<Path>
private final ReentrantReadWriteLock

Constructor Summary

AccessConstructor and Description
pack-priv
UnixDirectoryStream(UnixPath dir, long dp, DirectoryStream.Filter<? super Path> filter)

Initializes a new instance

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

protected final boolean
pack-priv final UnixPath
protected final boolean
protected final Iterator<Path>
public Iterator<Path>
iterator()

Implements java.nio.file.DirectoryStream.iterator.

Returns the iterator associated with this DirectoryStream.

protected final Lock
protected final Lock
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dirback to summary
private final UnixPath dir
dpback to summary
private final long dp
filterback to summary
private final DirectoryStream.Filter<? super Path> filter
isClosedback to summary
private volatile boolean isClosed
iteratorback to summary
private Iterator<Path> iterator
streamLockback to summary
private final ReentrantReadWriteLock streamLock

Constructor Detail

UnixDirectoryStreamback to summary
pack-priv UnixDirectoryStream(UnixPath dir, long dp, DirectoryStream.Filter<? super Path> filter)

Initializes a new instance

Method Detail

closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
closeImplback to summary
protected final boolean closeImpl() throws IOException
directoryback to summary
pack-priv final UnixPath directory()
isOpenback to summary
protected final boolean isOpen()
iteratorback to summary
protected final Iterator<Path> iterator(DirectoryStream<Path> ds)
iteratorback to summary
public Iterator<Path> iterator()

Implements java.nio.file.DirectoryStream.iterator.

Doc from java.nio.file.DirectoryStream.iterator.

Returns the iterator associated with this DirectoryStream.

Annotations
@Override
readLockback to summary
protected final Lock readLock()
writeLockback to summary
protected final Lock writeLock()
sun.nio.fs back to summary

private Class UnixDirectoryStream.UnixDirectoryIterator

extends Object
implements Iterator<Path>
Class Inheritance
All Implemented Interfaces
java.util.Iterator

Iterator implementation

Field Summary

Modifier and TypeField and Description
private boolean
private Path

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public synchronized boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

private boolean
isSelfOrParent(byte[] nameAsBytes)

public synchronized Path
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

private Path
public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

atEofback to summary
private boolean atEof
nextEntryback to summary
private Path nextEntry

Constructor Detail

UnixDirectoryIteratorback to summary
pack-priv UnixDirectoryIterator()

Method Detail

hasNextback to summary
public synchronized boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Annotations
@Override
isSelfOrParentback to summary
private boolean isSelfOrParent(byte[] nameAsBytes)
nextback to summary
public synchronized Path next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Annotations
@Override
readNextEntryback to summary
private Path readNextEntry()
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override