@ Override public ProtoNetworkDescriptor writeProtoNetwork ( ProtoNetwork protoNetwork , String protoNetworkRootPath ) throws ProtoNetworkError { final String filename = PROTO_NETWORK_FILENAME ; final File file = new File ( asPath ( protoNetworkRootPath , filename ) ) ; ObjectOutputStream oos = null ; try { oos = new ObjectOutputStream ( new FileOutputStream ( file ) ) ; protoNetwork . writeExternal ( oos ) ; return new BinaryProtoNetworkDescriptor ( file ) ; } catch ( IOException e ) { final String name = file . getAbsolutePath ( ) ; final String msg = "Cannot create temporary binary file for proto-network" ; throw new ProtoNetworkError ( name , msg , e ) ; } finally { // clean up IO resources IOUtils . closeQuietly ( oos ) ; } }
Writes a binary - based proto network and produces a descriptor including the binary file .