use of java.nio.file.OpenOption in project neo4j by neo4j.
the class PageCacheTest method mustThrowOnUnsupportedOpenOptions.
@Test(timeout = SEMI_LONG_TIMEOUT_MILLIS)
public void mustThrowOnUnsupportedOpenOptions() throws Exception {
configureStandardPageCache();
verifyMappingWithOpenOptionThrows(StandardOpenOption.CREATE_NEW);
verifyMappingWithOpenOptionThrows(StandardOpenOption.SYNC);
verifyMappingWithOpenOptionThrows(StandardOpenOption.DSYNC);
verifyMappingWithOpenOptionThrows(new OpenOption() {
@Override
public String toString() {
return "NonStandardOpenOption";
}
});
}
use of java.nio.file.OpenOption in project neo4j by neo4j.
the class MetaDataStoreTest method setUp.
@Before
public void setUp() {
fs = fsRule.get();
pageCache = pageCacheRule.getPageCache(fs);
fakePageCursorOverflow = false;
pageCacheWithFakeOverflow = new DelegatingPageCache(pageCache) {
@Override
public PagedFile map(File file, int pageSize, OpenOption... openOptions) throws IOException {
return new DelegatingPagedFile(super.map(file, pageSize, openOptions)) {
@Override
public PageCursor io(long pageId, int pf_flags) throws IOException {
return new DelegatingPageCursor(super.io(pageId, pf_flags)) {
@Override
public boolean checkAndClearBoundsFlag() {
return fakePageCursorOverflow | super.checkAndClearBoundsFlag();
}
};
}
};
}
};
}
use of java.nio.file.OpenOption in project google-cloud-java by GoogleCloudPlatform.
the class CloudStorageFileSystemProvider method newInputStream.
@Override
public InputStream newInputStream(Path path, OpenOption... options) throws IOException {
initStorage();
InputStream result = super.newInputStream(path, options);
CloudStoragePath cloudPath = CloudStorageUtil.checkPath(path);
int blockSize = cloudPath.getFileSystem().config().blockSize();
for (OpenOption option : options) {
if (option instanceof OptionBlockSize) {
blockSize = ((OptionBlockSize) option).size();
}
}
return new BufferedInputStream(result, blockSize);
}
Aggregations