Examples of NakedByteArrayOutputStream


Examples of org.openquark.util.NakedByteArrayOutputStream

     * @param inTypeExpr
     * @return TypeExpr
     * @throws IOException
     */
    private TypeExpr serializeDeserialize(TypeExpr inTypeExpr) throws IOException {
        NakedByteArrayOutputStream bos = new NakedByteArrayOutputStream(128);
        RecordOutputStream ros = new RecordOutputStream(bos);
        inTypeExpr.write(ros);
        ros.close();
       
        ByteArrayInputStream bis = new ByteArrayInputStream(bos.getByteArray());
        RecordInputStream ris = new RecordInputStream(bis);

        CompilerMessageLogger msgLogger = new MessageLogger();
       
        TypeExpr outTypeExpr = TypeExpr.load(ris, getTestModuleTypeInfo(), msgLogger);
View Full Code Here

Examples of org.openquark.util.NakedByteArrayOutputStream

        // Get the info file within that folder.
        ProgramResourceLocator.File compileModuleInfoFileLocator = moduleFolder.extendFile(module.getName() + "." + Module.COMPILED_MODULE_SUFFIX);

        // Put the module info into a byte array.
        NakedByteArrayOutputStream bos = new NakedByteArrayOutputStream(8192);
        RecordOutputStream ros = new RecordOutputStream(bos);

        Exception exception = null;
        try {
            module.write(ros);
        } catch (IOException saveException) {
            exception = saveException;
        } finally {
            try {
                ros.close();
            } catch (IOException ioe) {
                exception = ioe;
            }
        }

        if (exception != null) {
            logger.logMessage(new CompilerMessage(new MessageKind.Warning.DebugMessage("Failed saving compiled module info for " + module.getName()), exception));
        }

        // Create an input stream on the byte array, and use this to set the file contents.
        InputStream is = new ByteArrayInputStream(bos.getByteArray(), 0, bos.getCount());
        try {
            resourceRepository.setContents(compileModuleInfoFileLocator, is);
        } catch (IOException e) {
            logger.logMessage(new CompilerMessage(new MessageKind.Warning.DebugMessage("Failed saving compiled module info for " + module.getName()), e));
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.