当前位置: 首页>>代码示例>>Java>>正文


Java S.afterLast方法代码示例

本文整理汇总了Java中org.osgl.util.S.afterLast方法的典型用法代码示例。如果您正苦于以下问题:Java S.afterLast方法的具体用法?Java S.afterLast怎么用?Java S.afterLast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.osgl.util.S的用法示例。


在下文中一共展示了S.afterLast方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AppDescriptor

import org.osgl.util.S; //导入方法依赖的package包/类
/**
 * Construct an `AppVersion` with name and version
 *
 * @param appName
 *      the app name
 * @param version
 *      the app version
 */
private AppDescriptor(String appName, String packageName, Version version) {
    if (appName.startsWith("${")) {
        LOGGER.warn("app name is substitute variable - fallback to default app name");
        appName = S.afterLast(packageName, ".");
    }
    this.appName = appName;
    this.packageName = packageName;
    this.version = version;
}
 
开发者ID:actframework,项目名称:actframework,代码行数:18,代码来源:AppDescriptor.java

示例2: loadClass

import org.osgl.util.S; //导入方法依赖的package包/类
@Override
protected synchronized Class<?> loadClass(final String name,
                                          final boolean resolve) throws ClassNotFoundException {
    if (!name.startsWith("testapp.")) {
        return super.loadClass(name, resolve);
    }

    // gets an input stream to read the bytecode of the class
    String cn = name.replace('.', '/');
    String resource = cn + ".class";
    InputStream is = getResourceAsStream(resource);
    byte[] b;

    // adapts the class on the fly
    try {
        ClassReader cr = new ClassReader(is);
        ClassWriter cw = new ClassWriter(0);
        MailerEnhancer enhancer = new MailerEnhancer(cw, MailerEnhancerTest.this);
        cr.accept(enhancer, 0);
        b = cw.toByteArray();
        OutputStream os1 = new FileOutputStream("/tmp/" + S.afterLast(cn, "/") + ".class");
        IO.write(b, os1);
        cr = new ClassReader(b);
        cw = new ClassWriter(0);
        OutputStream os2 = new FileOutputStream("/tmp/" + S.afterLast(cn, "/") + ".java");
        ClassVisitor tv = new TraceClassVisitor(cw, new PrintWriter(os2));
        cr.accept(tv, 0);
    } catch (Exception e) {
        throw new ClassNotFoundException(name, e);
    }

    // returns the adapted class
    return defineClass(name, b, 0, b.length);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:35,代码来源:MailerEnhancerTest.java

示例3: loadClass

import org.osgl.util.S; //导入方法依赖的package包/类
@Override
protected synchronized Class<?> loadClass(final String name,
                                          final boolean resolve) throws ClassNotFoundException {
    if (!name.startsWith("testapp.")) {
        return super.loadClass(name, resolve);
    }

    // gets an input stream to read the bytecode of the class
    String cn = name.replace('.', '/');
    String resource = cn + ".class";
    InputStream is = getResourceAsStream(resource);
    byte[] b;

    // adapts the class on the fly
    try {
        ClassReader cr = new ClassReader(is);
        ClassWriter cw = new ClassWriter(0);
        ControllerEnhancer enhancer = new ControllerEnhancer(cw, ControllerEnhancerTest.this);
        cr.accept(enhancer, 0);
        b = cw.toByteArray();
        OutputStream os1 = new FileOutputStream("/tmp/" + S.afterLast(cn, "/") + ".class");
        IO.write(b, os1);
        cr = new ClassReader(b);
        cw = new ClassWriter(0);
        OutputStream os2 = new FileOutputStream("/tmp/" + S.afterLast(cn, "/") + ".java");
        ClassVisitor tv = new TraceClassVisitor(cw, new PrintWriter(os2));
        cr.accept(tv, 0);
    } catch (Exception e) {
        throw new ClassNotFoundException(name, e);
    }

    // returns the adapted class
    return defineClass(name, b, 0, b.length);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:35,代码来源:ControllerEnhancerTest.java

示例4: loadClass

import org.osgl.util.S; //导入方法依赖的package包/类
@Override
protected synchronized Class<?> loadClass(final String name,
                                          final boolean resolve) throws ClassNotFoundException {
    if (!name.startsWith("testapp.")) {
        return super.loadClass(name, resolve);
    }

    // gets an input stream to read the bytecode of the class
    String cn = name.replace('.', '/');
    String resource = cn + ".class";
    InputStream is = getResourceAsStream(resource);
    byte[] b;

    // adapts the class on the fly
    try {
        ClassReader cr = new ClassReader(is);
        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
        DataObjectEnhancer enhancer = new DataObjectEnhancer(cw);
        cr.accept(enhancer, 0);
        b = cw.toByteArray();
        //CheckClassAdapter.verify(new ClassReader(cw.toByteArray()), true, new PrintWriter(System.out));
        OutputStream os1 = new FileOutputStream("/tmp/" + S.afterLast(cn, "/") + ".class");
        IO.write(b, os1);
        cr = new ClassReader(b);
        cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
        OutputStream os2 = new FileOutputStream("/tmp/" + S.afterLast(cn, "/") + ".java");
        ClassVisitor tv = new TraceClassVisitor(cw, new PrintWriter(os2));
        cr.accept(tv, 0);
    } catch (Exception e) {
        throw new ClassNotFoundException(name, e);
    }

    // returns the adapted class
    return defineClass(name, b, 0, b.length);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:36,代码来源:DataObjectEnhancerTest.java

示例5: suffixOf

import org.osgl.util.S; //导入方法依赖的package包/类
private String suffixOf(String key) {
    return S.afterLast(key, ".");
}
 
开发者ID:actframework,项目名称:actframework,代码行数:4,代码来源:ConfigKeyHelper.java

示例6: apply

import org.osgl.util.S; //导入方法依赖的package包/类
@Override
public void apply(H.Request req, H.Response resp) {
    boolean hasName = S.notBlank(name);
    try {
        applyCookies(resp);
        applyHeaders(resp);
        if (null != contentType) {
            resp.contentType(contentType);
        } else if (hasName) {
            String ext = S.afterLast(name, ".");
            if (S.notBlank(ext)) {
                H.Format format = H.Format.of(ext);
                if (null != format) {
                    resp.initContentType(format.contentType());
                }
            }
            resp.initContentType("application/octet-stream");
        }
        if (!resp.containsHeader(CONTENT_DISPOSITION)) {
            resp.contentDisposition(name, disposition.isInline());
        }
        if (!resp.containsHeader(CONTENT_LENGTH)) {
            if (0 < length) {
                resp.header(CONTENT_LENGTH, S.string(length));
            }
        }
        applyStatus(resp);
        applyBeforeCommitHandler(req, resp);
        if (null != binary) {
            resp.writeBinary(binary);
        } else {
            outputStreamVisitor.apply(resp.outputStream());
        }
    } catch (Exception e) {
        throw E.unexpected(e);
    } finally {
        try {
            resp.commit();
            applyAfterCommitHandler(req, resp);
        } finally {
            clearThreadLocals();
        }
    }
}
 
开发者ID:osglworks,项目名称:java-mvc,代码行数:45,代码来源:RenderBinary.java


注:本文中的org.osgl.util.S.afterLast方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。