blob: c89ab188755500d65709f8a14e75380bc82d3038 [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (21) on Thu Oct 05 19:54:57 CEST 2023 -->
<title>StorageConnector (Apache SIS 1.4 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2023-10-05">
<meta name="description" content="declaration: module: org.apache.sis.storage, package: org.apache.sis.storage, class: StorageConnector">
<meta name="generator" content="javadoc/ClassWriterImpl">
<meta name="keywords" content="org.apache.sis.storage.StorageConnector class">
<meta name="keywords" content="DEFAULT_BUFFER_SIZE">
<meta name="keywords" content="getOption()">
<meta name="keywords" content="setOption()">
<meta name="keywords" content="getStorage()">
<meta name="keywords" content="getStorageName()">
<meta name="keywords" content="getFileExtension()">
<meta name="keywords" content="getStorageAs()">
<meta name="keywords" content="wasProbingAbsentFile()">
<meta name="keywords" content="commit()">
<meta name="keywords" content="closeAllExcept()">
<meta name="keywords" content="toString()">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../sis.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../script-dir/jquery-ui.min.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-3.6.1.min.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">var pathtoroot = "../../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Toggle navigation links"><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span></button>
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="../../../../module-summary.html">Module</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html#class">Help</a></li>
</ul>
<ul class="sub-nav-list-small">
<li>
<p>Summary:</p>
<ul>
<li>Nested</li>
<li><a href="#field-summary">Field</a></li>
<li><a href="#constructor-summary">Constr</a></li>
<li><a href="#method-summary">Method</a></li>
</ul>
</li>
<li>
<p>Detail:</p>
<ul>
<li><a href="#field-detail">Field</a></li>
<li><a href="#constructor-detail">Constr</a></li>
<li><a href="#method-detail">Method</a></li>
</ul>
</li>
</ul>
</div>
<div class="sub-nav">
<div id="navbar-sub-list">
<ul class="sub-nav-list">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field-summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor-summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method-summary">Method</a></li>
</ul>
<ul class="sub-nav-list">
<li>Detail:&nbsp;</li>
<li><a href="#field-detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor-detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method-detail">Method</a></li>
</ul>
</div>
<div class="nav-list-search"><a href="../../../../../search.html">SEARCH</a>
<input type="text" id="search-input" disabled placeholder="Search">
<input type="reset" id="reset-button" disabled value="reset">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="sub-title"><span class="module-label-in-type">Module</span>&nbsp;<a href="../../../../module-summary.html">org.apache.sis.storage</a></div>
<div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">org.apache.sis.storage</a></div>
<h1 title="Class StorageConnector" class="title">Class StorageConnector</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>
<div class="inheritance">StorageConnector</div>
</div>
<section class="class-description" id="class-description">
<dl class="notes">
<dt>All Implemented Interfaces:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Serializable.html" title="class or interface in java.io" class="external-link">Serializable</a></code></dd>
</dl>
<hr>
<div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">StorageConnector</span>
<span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>
implements <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Serializable.html" title="class or interface in java.io" class="external-link">Serializable</a></span></div>
<div class="block">Information for creating a connection to a <a href="DataStore.html" title="class in org.apache.sis.storage"><code>Data­Store</code></a> in read and/or write mode.
<code>Storage­Connector</code> wraps an input <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link"><code>Object</code></a>, which can be any of the following types:
<ul>
<li>A <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html" title="class or interface in java.nio.file" class="external-link"><code>Path</code></a> or a <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/File.html" title="class or interface in java.io" class="external-link"><code>File</code></a> for a file or a directory.</li>
<li>A <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URI.html" title="class or interface in java.net" class="external-link"><code>URI</code></a> or a <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URL.html" title="class or interface in java.net" class="external-link"><code>URL</code></a> to a distant resource.</li>
<li>A <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link"><code>Char­Sequence</code></a> interpreted as a filename or a URL.</li>
<li>A <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/channels/Channel.html" title="class or interface in java.nio.channels" class="external-link"><code>Channel</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/DataInput.html" title="class or interface in java.io" class="external-link"><code>Data­Input</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/InputStream.html" title="class or interface in java.io" class="external-link"><code>Input­Stream</code></a> or <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Reader.html" title="class or interface in java.io" class="external-link"><code>Reader</code></a>.</li>
<li>A <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.sql/javax/sql/DataSource.html" title="class or interface in javax.sql" class="external-link"><code>Data­Source</code></a> or a <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.sql/java/sql/Connection.html" title="class or interface in java.sql" class="external-link"><code>Connection</code></a> to a JDBC database.</li>
<li>Any other <code>Data­Store</code>-specific object, for example <code>Netcdf­File</code>.</li>
</ul>
The <a href="#getStorageAs(java.lang.Class)"><code>get­Storage­As(Class)</code></a> method provides the storage as an object of the given type, opening
the input stream if necessary. This class tries to open the stream only once - subsequent invocation
of <code>get­Storage­As(…)</code> may return the same input stream.
<p>This class is used only for discovery of a <code>Data­Store</code> implementation capable to handle the input.
Once a suitable <code>Data­Store</code> has been found, the <code>Storage­Connector</code> instance is typically
discarded since each data store implementation will use their own input/output objects.</p>
<h2 id="limitations-heading">Limitations</h2>
This class is not thread-safe.
Not only <code>Storage­Connector</code> should be used by a single thread,
but the objects returned by <a href="#getStorageAs(java.lang.Class)"><code>get­Storage­As(Class)</code></a> should also be used by the same thread.
<p>Instances of this class are serializable if the <code>storage</code> object given at construction time
is serializable.</p></div>
<dl class="notes">
<dt>Since:</dt>
<dd>0.3</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="../../../../../serialized-form.html#org.apache.sis.storage.StorageConnector">Serialized Form</a></li>
</ul>
</dd>
</dl>
</section>
<section class="summary">
<ul class="summary-list">
<!-- =========== FIELD SUMMARY =========== -->
<li>
<section class="field-summary" id="field-summary">
<h2>Field Summary</h2>
<div class="caption"><span>Fields</span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Field</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>static final int</code></div>
<div class="col-second even-row-color"><code><a href="#DEFAULT_BUFFER_SIZE" class="member-name-link">DEFAULT_BUFFER_SIZE</a></code></div>
<div class="col-last even-row-color">
<div class="block">The default size (in bytes) of <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/ByteBuffer.html" title="class or interface in java.nio" class="external-link"><code>Byte­Buffer</code></a>s created by storage connectors.</div>
</div>
</div>
</section>
</li>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<li>
<section class="constructor-summary" id="constructor-summary">
<h2>Constructor Summary</h2>
<div class="caption"><span>Constructors</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Constructor</div>
<div class="table-header col-last">Description</div>
<div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E(java.lang.Object)" class="member-name-link">Storage­Connector</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>&nbsp;storage)</code></div>
<div class="col-last even-row-color">
<div class="block">Creates a new data store connection wrapping the given input/output object.</div>
</div>
</div>
</section>
</li>
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel">
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#closeAllExcept(java.lang.Object)" class="member-name-link">close­All­Except</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>&nbsp;view)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Closes all streams and connections created by this <code>Storage­Connector</code> except the given view.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>&lt;S&gt;&nbsp;S</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#commit(java.lang.Class,java.lang.String)" class="member-name-link">commit</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a>&lt;S&gt;&nbsp;type,
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;format)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the storage as a view of the given type and closes all other views.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getFileExtension()" class="member-name-link">get­File­Extension</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the filename extension of the input/output object.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>&lt;T&gt;&nbsp;T</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getOption(org.apache.sis.setup.OptionKey)" class="member-name-link">get­Option</a><wbr>(<a href="../../../../../org.apache.sis.util/org/apache/sis/setup/OptionKey.html" title="class in org.apache.sis.setup">Option­Key</a>&lt;T&gt;&nbsp;key)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the option value for the given key, or <code>null</code> if none.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getStorage()" class="member-name-link">get­Storage</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the input/output object given at construction time.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>&lt;S&gt;&nbsp;S</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getStorageAs(java.lang.Class)" class="member-name-link">get­Storage­As</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a>&lt;S&gt;&nbsp;type)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the storage as a view of the given type if possible, or <code>null</code> otherwise.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getStorageName()" class="member-name-link">get­Storage­Name</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns a short name of the input/output object.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>&lt;T&gt;&nbsp;void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setOption(org.apache.sis.setup.OptionKey,T)" class="member-name-link">set­Option</a><wbr>(<a href="../../../../../org.apache.sis.util/org/apache/sis/setup/OptionKey.html" title="class in org.apache.sis.setup">Option­Key</a>&lt;T&gt;&nbsp;key,
T&nbsp;value)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Sets the option value for the given key.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#toString()" class="member-name-link">to­String</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns a string representation of this <code>Storage­Connector</code> for debugging purpose.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#wasProbingAbsentFile()" class="member-name-link">was­Probing­Absent­File</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns whether returning the storage would have required the creation of a new file.</div>
</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-Object">Methods inherited from class&nbsp;<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">get­Class</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hash­Code</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notify­All</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ============ FIELD DETAIL =========== -->
<li>
<section class="field-details" id="field-detail">
<h2>Field Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="DEFAULT_BUFFER_SIZE">
<h3>DEFAULT_BUFFER_SIZE</h3>
<div class="member-signature"><span class="modifiers">public static final</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">DEFAULT_BUFFER_SIZE</span></div>
<div class="block">The default size (in bytes) of <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/ByteBuffer.html" title="class or interface in java.nio" class="external-link"><code>Byte­Buffer</code></a>s created by storage connectors.
Those buffers are typically created when the specified storage object is a
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/File.html" title="class or interface in java.io" class="external-link"><code>File</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html" title="class or interface in java.nio.file" class="external-link"><code>Path</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URL.html" title="class or interface in java.net" class="external-link"><code>URL</code></a> or <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URI.html" title="class or interface in java.net" class="external-link"><code>URI</code></a>.
The default buffer size is arbitrary and may change in any future Apache SIS version.
<p>Users can override this value by providing a value for <a href="../../../../../org.apache.sis.util/org/apache/sis/setup/OptionKey.html#BYTE_BUFFER"><code>Option­Key​.BYTE_BUFFER</code></a>.</p></div>
<dl class="notes">
<dt>Since:</dt>
<dd>1.4</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="../../../../../org.apache.sis.util/org/apache/sis/setup/OptionKey.html#BYTE_BUFFER"><code>Option­Key​.BYTE_BUFFER</code></a></li>
<li><a href="../../../../../constant-values.html#org.apache.sis.storage.StorageConnector.DEFAULT_BUFFER_SIZE">Constant Field Values</a></li>
</ul>
</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<li>
<section class="constructor-details" id="constructor-detail">
<h2>Constructor Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="&lt;init&gt;(java.lang.Object)">
<h3>StorageConnector</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">StorageConnector</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>&nbsp;storage)</span></div>
<div class="block">Creates a new data store connection wrapping the given input/output object.
The object can be of any type, but the class javadoc lists the most typical ones.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>storage</code> - the input/output object as a URL, file, image input stream, <i>etc.</i>.</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="getOption(org.apache.sis.setup.OptionKey)">
<h3>getOption</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="type-parameters">&lt;T&gt;</span>&nbsp;<span class="return-type">T</span>&nbsp;<span class="element-name">getOption</span><wbr><span class="parameters">(<a href="../../../../../org.apache.sis.util/org/apache/sis/setup/OptionKey.html" title="class in org.apache.sis.setup">OptionKey</a>&lt;T&gt;&nbsp;key)</span></div>
<div class="block">Returns the option value for the given key, or <code>null</code> if none.</div>
<dl class="notes">
<dt>Type Parameters:</dt>
<dd><code>T</code> - the type of option value.</dd>
<dt>Parameters:</dt>
<dd><code>key</code> - the option for which to get the value.</dd>
<dt>Returns:</dt>
<dd>the current value for the given option, or <code>null</code> if none.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="setOption(org.apache.sis.setup.OptionKey,T)">
<h3 id="setOption(org.apache.sis.setup.OptionKey,java.lang.Object)">setOption</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="type-parameters">&lt;T&gt;</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">setOption</span><wbr><span class="parameters">(<a href="../../../../../org.apache.sis.util/org/apache/sis/setup/OptionKey.html" title="class in org.apache.sis.setup">OptionKey</a>&lt;T&gt;&nbsp;key,
T&nbsp;value)</span></div>
<div class="block">Sets the option value for the given key. The default implementation recognizes the following options:
<ul>
<li><a href="../../../../../org.apache.sis.util/org/apache/sis/setup/OptionKey.html#ENCODING"><code>Option­Key​.ENCODING</code></a> for decoding characters in an input stream, if needed.</li>
<li><a href="../../../../../org.apache.sis.util/org/apache/sis/setup/OptionKey.html#URL_ENCODING"><code>Option­Key​.URL_ENCODING</code></a> for converting URL to URI or filename, if needed.</li>
<li><a href="../../../../../org.apache.sis.util/org/apache/sis/setup/OptionKey.html#OPEN_OPTIONS"><code>Option­Key​.OPEN_OPTIONS</code></a> for specifying whether the data store shall be read only or read/write.</li>
<li><a href="../../../../../org.apache.sis.util/org/apache/sis/setup/OptionKey.html#BYTE_BUFFER"><code>Option­Key​.BYTE_BUFFER</code></a> for allowing users to control the byte buffer to be created.</li>
</ul></div>
<dl class="notes">
<dt>Type Parameters:</dt>
<dd><code>T</code> - the type of option value.</dd>
<dt>Parameters:</dt>
<dd><code>key</code> - the option for which to set the value.</dd>
<dd><code>value</code> - the new value for the given option, or <code>null</code> for removing the value.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getStorage()">
<h3>getStorage</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span>&nbsp;<span class="element-name">getStorage</span>()
throws <span class="exceptions"><a href="DataStoreException.html" title="class in org.apache.sis.storage">DataStoreException</a></span></div>
<div class="block">Returns the input/output object given at construction time.
The object can be of any type, but the class javadoc lists the most typical ones.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the input/output object as a URL, file, image input stream, <i>etc.</i>.</dd>
<dt>Throws:</dt>
<dd><code><a href="DataStoreException.html" title="class in org.apache.sis.storage">Data­Store­Exception</a></code> - if the storage object has already been used and cannot be reused.</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="#getStorageAs(java.lang.Class)"><code>get­Storage­As(Class)</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getStorageName()">
<h3>getStorageName</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">getStorageName</span>()</div>
<div class="block">Returns a short name of the input/output object. For example if the storage is a file,
this method returns the filename without the path (but including the file extension).
The default implementation performs the following choices based on the type of the
<a href="#getStorage()">storage</a> object:
<ul>
<li>For <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html" title="class or interface in java.nio.file" class="external-link"><code>Path</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/File.html" title="class or interface in java.io" class="external-link"><code>File</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URI.html" title="class or interface in java.net" class="external-link"><code>URI</code></a> or <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URL.html" title="class or interface in java.net" class="external-link"><code>URL</code></a>
instances, this method uses dedicated API like <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html#getFileName()" title="class or interface in java.nio.file" class="external-link"><code>Path​.get­File­Name()</code></a>.</li>
<li>For <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link"><code>Char­Sequence</code></a> instances, this method gets a string representation of the storage object
and returns the part after the last <code>'/'</code> character or platform-dependent name separator.</li>
<li>For instances of unknown type, this method builds a string representation using the class name.
Note that the string representation of unknown types may change in any future SIS version.</li>
</ul></div>
<dl class="notes">
<dt>Returns:</dt>
<dd>a short name of the storage object.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getFileExtension()">
<h3>getFileExtension</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">getFileExtension</span>()</div>
<div class="block">Returns the filename extension of the input/output object. The default implementation performs
the following choices based on the type of the <a href="#getStorage()">storage</a> object:
<ul>
<li>For <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html" title="class or interface in java.nio.file" class="external-link"><code>Path</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/File.html" title="class or interface in java.io" class="external-link"><code>File</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URI.html" title="class or interface in java.net" class="external-link"><code>URI</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URL.html" title="class or interface in java.net" class="external-link"><code>URL</code></a> or
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link"><code>Char­Sequence</code></a> instances, this method returns the string after the last <code>'.'</code> character
in the filename, provided that the <code>'.'</code> is not the first filename character. This may be an
empty string if the filename has no extension, but never <code>null</code>.</li>
<li>For instances of unknown type, this method returns <code>null</code>.</li>
</ul></div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the filename extension, or an empty string if none,
or <code>null</code> if the storage is an object of unknown type.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getStorageAs(java.lang.Class)">
<h3>getStorageAs</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="type-parameters">&lt;S&gt;</span>&nbsp;<span class="return-type">S</span>&nbsp;<span class="element-name">getStorageAs</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a>&lt;S&gt;&nbsp;type)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a>,
<a href="DataStoreException.html" title="class in org.apache.sis.storage">DataStoreException</a></span></div>
<div class="block">Returns the storage as a view of the given type if possible, or <code>null</code> otherwise.
The default implementation accepts the following types:
<ul>
<li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link"><code>String</code></a>:
<ul>
<li>If the <a href="#getStorage()">storage</a> object is an instance of the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html" title="class or interface in java.nio.file" class="external-link"><code>Path</code></a>,
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/File.html" title="class or interface in java.io" class="external-link"><code>File</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URL.html" title="class or interface in java.net" class="external-link"><code>URL</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URI.html" title="class or interface in java.net" class="external-link"><code>URI</code></a> or <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link"><code>Char­Sequence</code></a> types,
returns the string representation of their path.</li>
<li>Otherwise this method returns <code>null</code>.</li>
</ul>
</li>
<li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html" title="class or interface in java.nio.file" class="external-link"><code>Path</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URI.html" title="class or interface in java.net" class="external-link"><code>URI</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URL.html" title="class or interface in java.net" class="external-link"><code>URL</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/File.html" title="class or interface in java.io" class="external-link"><code>File</code></a>:
<ul>
<li>If the <a href="#getStorage()">storage</a> object is an instance of the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html" title="class or interface in java.nio.file" class="external-link"><code>Path</code></a>,
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/File.html" title="class or interface in java.io" class="external-link"><code>File</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URL.html" title="class or interface in java.net" class="external-link"><code>URL</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URI.html" title="class or interface in java.net" class="external-link"><code>URI</code></a> or <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link"><code>Char­Sequence</code></a> types and
that type can be converted to the requested type, returned the conversion result.</li>
<li>Otherwise this method returns <code>null</code>.</li>
</ul>
</li>
<li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/ByteBuffer.html" title="class or interface in java.nio" class="external-link"><code>Byte­Buffer</code></a>:
<ul>
<li>If the <a href="#getStorage()">storage</a> object can be obtained as described in bullet 2 of the
<code>Data­Input</code> section below, then this method returns the associated byte buffer.</li>
<li>Otherwise this method returns <code>null</code>.</li>
</ul>
</li>
<li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/DataInput.html" title="class or interface in java.io" class="external-link"><code>Data­Input</code></a>:
<ul>
<li>If the <a href="#getStorage()">storage</a> object is already an instance of <code>Data­Input</code>
(including the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/javax/imageio/stream/ImageInputStream.html" title="class or interface in javax.imageio.stream" class="external-link"><code>Image­Input­Stream</code></a> and <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/javax/imageio/stream/ImageOutputStream.html" title="class or interface in javax.imageio.stream" class="external-link"><code>Image­Output­Stream</code></a> types),
then it is returned unchanged.</li>
<li>Otherwise if the input is an instance of <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/ByteBuffer.html" title="class or interface in java.nio" class="external-link"><code>Byte­Buffer</code></a>, then an <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/javax/imageio/stream/ImageInputStream.html" title="class or interface in javax.imageio.stream" class="external-link"><code>Image­Input­Stream</code></a>
backed by a read-only view of that buffer is created when first needed and returned.
The properties (position, mark, limit) of the original buffer are unmodified.</li>
<li>Otherwise if the input is an instance of <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html" title="class or interface in java.nio.file" class="external-link"><code>Path</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/File.html" title="class or interface in java.io" class="external-link"><code>File</code></a>,
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URI.html" title="class or interface in java.net" class="external-link"><code>URI</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URL.html" title="class or interface in java.net" class="external-link"><code>URL</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link"><code>Char­Sequence</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/InputStream.html" title="class or interface in java.io" class="external-link"><code>Input­Stream</code></a> or
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/channels/ReadableByteChannel.html" title="class or interface in java.nio.channels" class="external-link"><code>Readable­Byte­Channel</code></a>, then an <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/javax/imageio/stream/ImageInputStream.html" title="class or interface in javax.imageio.stream" class="external-link"><code>Image­Input­Stream</code></a> backed by a
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/ByteBuffer.html" title="class or interface in java.nio" class="external-link"><code>Byte­Buffer</code></a> is created when first needed and returned.</li>
<li>Otherwise if <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/javax/imageio/ImageIO.html#createImageInputStream(java.lang.Object)" title="class or interface in javax.imageio" class="external-link"><code>Image­IO​.create­Image­Input­Stream(Object)</code></a> returns a non-null value,
then this value is cached and returned.</li>
<li>Otherwise this method returns <code>null</code>.</li>
</ul>
</li>
<li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/javax/imageio/stream/ImageInputStream.html" title="class or interface in javax.imageio.stream" class="external-link"><code>Image­Input­Stream</code></a>:
<ul>
<li>If the above <code>Data­Input</code> can be created and casted to <code>Image­Input­Stream</code>, returns it.</li>
<li>Otherwise this method returns <code>null</code>.</li>
</ul>
</li>
<li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/InputStream.html" title="class or interface in java.io" class="external-link"><code>Input­Stream</code></a>:
<ul>
<li>If the <a href="#getStorage()">storage</a> object is already an instance of <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/InputStream.html" title="class or interface in java.io" class="external-link"><code>Input­Stream</code></a>,
then it is returned unchanged.</li>
<li>Otherwise if the above <code>Image­Input­Stream</code> can be created,
returns a wrapper around that stream.</li>
<li>Otherwise this method returns <code>null</code>.</li>
</ul>
</li>
<li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Reader.html" title="class or interface in java.io" class="external-link"><code>Reader</code></a>:
<ul>
<li>If the <a href="#getStorage()">storage</a> object is already an instance of <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Reader.html" title="class or interface in java.io" class="external-link"><code>Reader</code></a>,
then it is returned unchanged.</li>
<li>Otherwise if the above <code>Input­Stream</code> can be created, returns an <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/InputStreamReader.html" title="class or interface in java.io" class="external-link"><code>Input­Stream­Reader</code></a>
using the encoding specified by <a href="../../../../../org.apache.sis.util/org/apache/sis/setup/OptionKey.html#ENCODING"><code>Option­Key​.ENCODING</code></a> if any, or using the system default
encoding otherwise.</li>
<li>Otherwise this method returns <code>null</code>.</li>
</ul>
</li>
<li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.sql/java/sql/Connection.html" title="class or interface in java.sql" class="external-link"><code>Connection</code></a>:
<ul>
<li>If the <a href="#getStorage()">storage</a> object is already an instance of <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.sql/java/sql/Connection.html" title="class or interface in java.sql" class="external-link"><code>Connection</code></a>,
then it is returned unchanged.</li>
<li>Otherwise if the storage is an instance of <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.sql/javax/sql/DataSource.html" title="class or interface in javax.sql" class="external-link"><code>Data­Source</code></a>, then a connection is obtained
when first needed and returned.</li>
<li>Otherwise this method returns <code>null</code>.</li>
</ul>
</li>
<li>Any other types:
<ul>
<li>If the storage given at construction time is already an instance of the requested type,
returns it <i>as-is</i>.</li>
<li>Otherwise this method throws <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link"><code>Illegal­Argument­Exception</code></a>.</li>
</ul>
</li>
</ul>
<h4 id="usage-for-probing-operations-heading">Usage for probing operations</h4>
Multiple invocations of this method on the same <code>Storage­Connector</code> instance will try
to return the same instance on a <cite>best effort</cite> basis. Consequently, implementations of
<a href="DataStoreProvider.html#probeContent(org.apache.sis.storage.StorageConnector)"><code>Data­Store­Provider​.probe­Content(Storage­Connector)</code></a> methods shall not close the stream or
database connection returned by this method. In addition, those <code>probe­Content(Storage­Connector)</code>
methods are responsible for restoring the stream or byte buffer to its original position on return.
For an easier and safer way to ensure that the storage position is not modified,
see <a href="DataStoreProvider.html#probeContent(org.apache.sis.storage.StorageConnector,java.lang.Class,org.apache.sis.storage.DataStoreProvider.Prober)"><code>Data­Store­Provider​.probe­Content(Storage­Connector, Class, Prober)</code></a>.</div>
<dl class="notes">
<dt>Type Parameters:</dt>
<dd><code>S</code> - the compile-time type of the <code>type</code> argument (the source or storage type).</dd>
<dt>Parameters:</dt>
<dd><code>type</code> - the desired type as one of <code>Byte­Buffer</code>, <code>Data­Input</code>, <code>Connection</code>
class or other types supported by <code>Storage­Connector</code> subclasses.</dd>
<dt>Returns:</dt>
<dd>the storage as a view of the given type, or <code>null</code> if the given type is one of the supported
types listed in javadoc but no view can be created for the source given at construction time.
In the latter case, <a href="#wasProbingAbsentFile()"><code>was­Probing­Absent­File()</code></a> can be invoked for determining whether the
reason is that the file does not exist but could be created.</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">Illegal­Argument­Exception</a></code> - if the given <code>type</code> argument is not one of the supported types
listed in this javadoc or in subclass javadoc.</dd>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalStateException.html" title="class or interface in java.lang" class="external-link">Illegal­State­Exception</a></code> - if this <code>Storage­Connector</code> has been <a href="#closeAllExcept(java.lang.Object)">closed</a>.</dd>
<dd><code><a href="DataStoreException.html" title="class in org.apache.sis.storage">Data­Store­Exception</a></code> - if an error occurred while opening a stream or database connection.</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list-long">
<li><a href="#getStorage()"><code>get­Storage()</code></a></li>
<li><a href="#closeAllExcept(java.lang.Object)"><code>close­All­Except(Object)</code></a></li>
<li><a href="DataStoreProvider.html#probeContent(org.apache.sis.storage.StorageConnector,java.lang.Class,org.apache.sis.storage.DataStoreProvider.Prober)"><code>Data­Store­Provider​.probe­Content(Storage­Connector, Class, Prober)</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="wasProbingAbsentFile()">
<h3>wasProbingAbsentFile</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">wasProbingAbsentFile</span>()</div>
<div class="block">Returns whether returning the storage would have required the creation of a new file.
This method may return <code>true</code> if all the following conditions are true:
<ul>
<li>A previous <a href="#getStorageAs(java.lang.Class)"><code>get­Storage­As(Class)</code></a> call requested some kind of input stream
(e.g. <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/InputStream.html" title="class or interface in java.io" class="external-link"><code>Input­Stream</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/javax/imageio/stream/ImageInputStream.html" title="class or interface in javax.imageio.stream" class="external-link"><code>Image­Input­Stream</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/DataInput.html" title="class or interface in java.io" class="external-link"><code>Data­Input</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Reader.html" title="class or interface in java.io" class="external-link"><code>Reader</code></a>).</li>
<li>The <a href="#getStorage()">storage</a> is an object convertible to a <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html" title="class or interface in java.nio.file" class="external-link"><code>Path</code></a> and the
file identified by that path <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#notExists(java.nio.file.Path,java.nio.file.LinkOption...)" title="class or interface in java.nio.file" class="external-link">does not exist</a>.</li>
<li>The <a href="#getOption(org.apache.sis.setup.OptionKey)">optons</a> given to this <code>Storage­Connector</code> include
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/StandardOpenOption.html#CREATE" title="class or interface in java.nio.file" class="external-link"><code>Standard­Open­Option​.CREATE</code></a> or <code>CREATE_NEW</code>.</li>
<li>The <code>get­Storage­As(…)</code> and <code>was­Probing­Absent­File()</code> calls happened in the context of
<a href="DataStores.html" title="class in org.apache.sis.storage"><code>Data­Stores</code></a> probing the storage content in order to choose a <a href="DataStoreProvider.html" title="class in org.apache.sis.storage"><code>Data­Store­Provider</code></a>.</li>
</ul>
If all above conditions are true, then <a href="#getStorageAs(java.lang.Class)"><code>get­Storage­As(Class)</code></a> returns <code>null</code> instead of creating
a new empty file. In such case, <a href="DataStoreProvider.html" title="class in org.apache.sis.storage"><code>Data­Store­Provider</code></a> may use this <code>was­Probing­Absent­File()</code> method
for deciding whether to report <a href="ProbeResult.html#SUPPORTED"><code>Probe­Result​.SUPPORTED</code></a> or <a href="ProbeResult.html#UNSUPPORTED_STORAGE"><code>Probe­Result​.UNSUPPORTED_STORAGE</code></a>.
<h4 id="rational-heading">Rational</h4>
When the file does not exist and the <code>CREATE</code> or <code>CREATE_NEW</code> option is provided,
<code>get­Storage­As(…)</code> would normally create a new empty file. However this behavior is modified during probing
(the first condition in above list) because newly created files are empty and probing empty files may result in
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/EOFException.html" title="class or interface in java.io" class="external-link"><code>EOFException</code></a> to be thrown or in providers declaring that they do not support the storage.
<p>IF the <code>CREATE</code> or <code>CREATE_NEW</code> options were not provided, then probing the storage content of an
absent file will rather throw <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/NoSuchFileException.html" title="class or interface in java.nio.file" class="external-link"><code>No­Such­File­Exception</code></a> or <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/FileNotFoundException.html" title="class or interface in java.io" class="external-link"><code>File­Not­Found­Exception</code></a>.
So this method is useful only for <a href="DataStore.html" title="class in org.apache.sis.storage"><code>Data­Store</code></a> having write capabilities.</p></div>
<dl class="notes">
<dt>Returns:</dt>
<dd>whether returning the storage would have required the creation of a new file.</dd>
<dt>Since:</dt>
<dd>1.4</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="commit(java.lang.Class,java.lang.String)">
<h3>commit</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="type-parameters">&lt;S&gt;</span>&nbsp;<span class="return-type">S</span>&nbsp;<span class="element-name">commit</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a>&lt;S&gt;&nbsp;type,
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;format)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a>,
<a href="DataStoreException.html" title="class in org.apache.sis.storage">DataStoreException</a></span></div>
<div class="block">Returns the storage as a view of the given type and closes all other views.
Invoking this method is equivalent to invoking <a href="#getStorageAs(java.lang.Class)"><code>get­Storage­As(Class)</code></a>
followed by <a href="#closeAllExcept(java.lang.Object)"><code>close­All­Except(Object)</code></a> except that the latter method is
always invoked (in a way similar to "try with resource") and that this method
never returns <code>null</code>.</div>
<dl class="notes">
<dt>Type Parameters:</dt>
<dd><code>S</code> - the compile-time type of the <code>type</code> argument (the source or storage type).</dd>
<dt>Parameters:</dt>
<dd><code>type</code> - the desired type as one of the types documented in <a href="#getStorageAs(java.lang.Class)"><code>get­Storage­As(Class)</code></a>
(example: <code>Byte­Buffer</code>, <code>Data­Input</code>, <code>Connection</code>).</dd>
<dd><code>format</code> - short name or abbreviation of the data format (e.g. "CSV", "GML", "WKT", <i>etc</i>).
Used for information purpose in error messages if needed.</dd>
<dt>Returns:</dt>
<dd>the storage as a view of the given type. Never <code>null</code>.</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">Illegal­Argument­Exception</a></code> - if the given <code>type</code> argument is not one of the supported types.</dd>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalStateException.html" title="class or interface in java.lang" class="external-link">Illegal­State­Exception</a></code> - if this <code>Storage­Connector</code> has been <a href="#closeAllExcept(java.lang.Object)">closed</a>.</dd>
<dd><code><a href="DataStoreException.html" title="class in org.apache.sis.storage">Data­Store­Exception</a></code> - if an error occurred while opening a stream or database connection.</dd>
<dt>Since:</dt>
<dd>1.2</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="#getStorageAs(java.lang.Class)"><code>get­Storage­As(Class)</code></a></li>
<li><a href="#closeAllExcept(java.lang.Object)"><code>close­All­Except(Object)</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="closeAllExcept(java.lang.Object)">
<h3>closeAllExcept</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">closeAllExcept</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>&nbsp;view)</span>
throws <span class="exceptions"><a href="DataStoreException.html" title="class in org.apache.sis.storage">DataStoreException</a></span></div>
<div class="block">Closes all streams and connections created by this <code>Storage­Connector</code> except the given view.
This method closes all objects created by the <a href="#getStorageAs(java.lang.Class)"><code>get­Storage­As(Class)</code></a> method except the given <code>view</code>.
If <code>view</code> is <code>null</code>, then this method closes everything including the <a href="#getStorage()">storage</a> if it is closeable.
<p>This method is invoked when a suitable <a href="DataStore.html" title="class in org.apache.sis.storage"><code>Data­Store</code></a> has been found - in which case the view used
by the data store is given in argument to this method - or when no suitable <code>Data­Store</code> has been
found - in which case the <code>view</code> argument is null.</p>
<p>This <code>Storage­Connector</code> instance shall not be used anymore after invocation of this method.</p></div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>view</code> - the view to leave open, or <code>null</code> if none.</dd>
<dt>Throws:</dt>
<dd><code><a href="DataStoreException.html" title="class in org.apache.sis.storage">Data­Store­Exception</a></code> - if an error occurred while closing the stream or database connection.</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list-long">
<li><a href="#getStorageAs(java.lang.Class)"><code>get­Storage­As(Class)</code></a></li>
<li><a href="DataStoreProvider.html#open(org.apache.sis.storage.StorageConnector)"><code>Data­Store­Provider​.open(Storage­Connector)</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="toString()">
<h3>toString</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">toString</span>()</div>
<div class="block">Returns a string representation of this <code>Storage­Connector</code> for debugging purpose.
This string representation is for diagnostic and may change in any future version.</div>
<dl class="notes">
<dt>Overrides:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">to­String</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></dd>
<dt>Returns:</dt>
<dd>a string representation of this <code>Storage­Connector</code> for debugging purpose.</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
</div>
</div>
</body>
</html>