Search in sources :

Example 1 with ProfileParser

use of com.squareup.wire.java.internal.ProfileParser in project wire by square.

the class ProfileLoader method loadProfileFile.

/**
   * Parses the {@code .wire} file at {@code base/path} and returns it. Returns null if no such
   * file exists.
   */
private ProfileFileElement loadProfileFile(Path base, String path) throws IOException {
    Source source = source(base, path);
    if (source == null)
        return null;
    try {
        Location location = Location.get(base.toString(), path);
        String data = Okio.buffer(source).readUtf8();
        return new ProfileParser(location, data).read();
    } catch (IOException e) {
        throw new IOException("Failed to load " + source + " from " + base, e);
    } finally {
        source.close();
    }
}
Also used : ProfileParser(com.squareup.wire.java.internal.ProfileParser) IOException(java.io.IOException) Source(okio.Source) Location(com.squareup.wire.schema.Location)

Aggregations

ProfileParser (com.squareup.wire.java.internal.ProfileParser)1 Location (com.squareup.wire.schema.Location)1 IOException (java.io.IOException)1 Source (okio.Source)1