本文整理汇总了Java中com.sun.squawk.io.connections.ClasspathConnection.getBytes方法的典型用法代码示例。如果您正苦于以下问题:Java ClasspathConnection.getBytes方法的具体用法?Java ClasspathConnection.getBytes怎么用?Java ClasspathConnection.getBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.squawk.io.connections.ClasspathConnection
的用法示例。
在下文中一共展示了ClasspathConnection.getBytes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addFileToJar
import com.sun.squawk.io.connections.ClasspathConnection; //导入方法依赖的package包/类
/**
* Adds a given file to a given jar file stream.
*
* @param zos the jar stream
* @param classPath where to find the file
* @param filePath the path to the file
* @throws IOException if there is an IO error
*/
private void addFileToJar(ZipOutputStream zos, ClasspathConnection classPath, String filePath) throws IOException {
byte[] data = classPath.getBytes(filePath);
ZipEntry e = new ZipEntry(filePath);
e.setTime(System.currentTimeMillis());
zos.putNextEntry(e);
zos.write(data);
zos.closeEntry();
}
示例2: processClasspathConnection
import com.sun.squawk.io.connections.ClasspathConnection; //导入方法依赖的package包/类
/**
* Processes a single command line argument that specifies a jar or zip
* file of class files.
*
* @param cp the command line argument to process
* @param classes the list of class names to augment
* @param resources the list of resource to augment
*/
public static void processClasspathConnection(ClasspathConnection cp, Vector classes, Vector resources) throws HostedPragma {
try {
DataInputStream dis = new DataInputStream(cp.openInputStream("//"));
try {
for (;;) {
String name = dis.readUTF();
if (name.endsWith(".class")) {
name = name.substring(0, name.length() - ".class".length());
name = name.replace('/', '.');
classes.addElement(name);
} else if (nameInSkipList(name)) {
System.out.println("Skipping resource file: " + name);
continue;
} else {
try {
byte[] bytes = cp.getBytes(name);
ResourceFile resource = new ResourceFile(name, bytes);
resources.addElement(resource);
} catch (IOException e) {
}
}
}
} catch (EOFException ex) {
}
dis.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}