Modifier and Type | Method and Description |
---|---|
static ApiStub<DirectIoApi> |
getStub()
Returns the API stub.
|
static <T> ModelInput<T> |
open(Class<? extends DataFormat<T>> formatClass,
String basePath,
String resourcePattern)
Returns data model objects from Direct I/O data sources.
|
public static <T> ModelInput<T> open(Class<? extends DataFormat<T>> formatClass, String basePath, String resourcePattern) throws IOException
Clients can obtain each data model object:
try (ModelInput<Hoge> input = DirectIo.open(...)) {
Hoge object = new Hoge();
while (input.readTo(object)) {
// process object
System.out.println(object);
}
}
, or can build a list of data model objects:
List<Hoge> list = new ArrayList<>();
try (ModelInput<Hoge> input = DirectIo.open(...)) {
while (true) {
// create a new object in each iteration
Hoge object = new Hoge();
if (!input.readTo(object)) {
break;
}
list.add(object);
}
}
T
- the data model object typeformatClass
- the Direct I/O data format classbasePath
- the base path (must not contain variables)resourcePattern
- the resource pattern (must not contain variables)IOException
- if failed to open data model objects on the data sourcepublic static ApiStub<DirectIoApi> getStub()
Copyright © 2011–2018 Asakusa Framework Team. All rights reserved.