Search in sources :

Example 1 with AbstractResource

use of org.apache.sis.internal.storage.AbstractResource in project sis by apache.

the class ChannelDecoderTest method createChannelDecoder.

/**
 * Creates a new {@link ChannelDecoder} instance for the specified dataset.
 * The {@code file} parameter can be one of the following values:
 *
 * <ul>
 *   <li>{@link TestData#NETCDF_2D_GEOGRAPHIC} — uses a geographic CRS for global data over the world.</li>
 *   <li>{@link TestData#NETCDF_4D_PROJECTED}  — uses a projected CRS with elevation and time.</li>
 * </ul>
 *
 * @param  file  the file as one of the above-cited constants.
 * @return the decoder for the specified dataset.
 * @throws IOException if an I/O error occurred while opening the file.
 * @throws DataStoreException if a logical error occurred.
 */
public static Decoder createChannelDecoder(final TestData file) throws IOException, DataStoreException {
    final InputStream in = file.open();
    final ChannelDataInput input = new ChannelDataInput(file.name(), Channels.newChannel(in), ByteBuffer.allocate(4096), false);
    return new ChannelDecoder(input, null, GeometryLibrary.JAVA2D, new AbstractResource(null));
}
Also used : InputStream(java.io.InputStream) AbstractResource(org.apache.sis.internal.storage.AbstractResource) ChannelDataInput(org.apache.sis.internal.storage.io.ChannelDataInput)

Aggregations

InputStream (java.io.InputStream)1 AbstractResource (org.apache.sis.internal.storage.AbstractResource)1 ChannelDataInput (org.apache.sis.internal.storage.io.ChannelDataInput)1