@Signature public static Memory get(Environment env, String input, @Nullable String charset, String mode) throws Throwable { Stream stream = Stream.create(env, input, mode); try { Memory memory = env.invokeMethod(stream, "readFully"); if (charset == null || charset.trim().isEmpty()) { return memory; } else { return StrUtils.decode(env, memory, StringMemory.valueOf(charset)); } } finally { env.invokeMethod(stream, "close"); } }
@Signature public void addFile(Environment env, File file, @Nullable @Optional("null") Memory localName, @Optional("null") Invoker progressHandler, @Optional("8192") int bufferSize ) throws Throwable { PArchiveEntry entry = fetchOutput(env).createEntry(env, file, localName.isNull() ? file.getName() : localName.toString()); env.invokeMethod(output, "putEntry", ObjectMemory.valueOf(entry)); try (InputStream inputStream = new FileInputStream(file)) { FsUtils.copy(inputStream, outputStream, progressHandler, bufferSize); env.invokeMethod(output, "closeEntry"); } }
@Signature public static long copy(InputStream input, OutputStream output, @Nullable Invoker callback) throws IOException { return copy(input, output, callback, BUFFER_SIZE); }
@Signature public void addDirectory(Environment env, File path, int compressLevel, @Nullable Invoker invoker) { ZipUtil.pack(path, zipFile, invokerToNameMapper(invoker), compressLevel); }
@Signature public static Memory scan(Environment env, String path, @Nullable final Memory progress) { return scan(env, path, progress, 0); }
@Signature public PSqlStatement query(Environment env, String sql, @Nullable ArrayMemory args) throws Throwable { PreparedStatement statement = connection.prepareStatement(sql, Statement.NO_GENERATED_KEYS); PSqlStatement sqlStatement = new PSqlStatement(env, statement); if (args != null) { int index = 0; for (ReferenceMemory arg : args) { env.invokeMethod(sqlStatement, "bind", LongMemory.valueOf(index), arg.getValue()); index += 1; } } return sqlStatement; }
@Signature public void setErrorStream(Environment env, @Nullable Stream stream) { setErrorStream(env, stream, false); }
@Signature public Memory status(@Nullable Set<String> paths) throws GitAPIException { return status(paths, null); }
@Signature public void setOutputStream(Environment env, @Nullable Stream stream) { setOutputStream(env, stream, false); }
@Signature public void onError(@Nullable Invoker invoker) { onError = invoker; }
@Signature public void onWarning(@Nullable Invoker invoker) { onWarning = invoker; }
@Setter public void setName(@Nullable String name) { this.name = name; }
@Signature public void __construct(@Nullable InputStream in) throws IOException { __construct(in, "UTF-8"); }
@Signature public void addEntry(Environment env, PArchiveEntry entry, @Nullable InputStream source, @Optional("null") Invoker progressHandler, @Optional("8192") int bufferSize ) throws Throwable { fetchOutput(env); env.invokeMethod(output, "putEntry", ObjectMemory.valueOf(entry)); if (source != null) { FsUtils.copy(source, outputStream, progressHandler, bufferSize); } env.invokeMethod(output, "closeEntry"); }
@Setter protected void setFont(@Nullable Font font) { gc.setFont(font); }
@Signature public void setInputStream(Environment env, @Nullable Stream stream) { setInputStream(env, stream, false); }
@Signature public static Memory scan(Environment env, String path, @Nullable final Memory progress, int maxDepth) { return scan(env, path, progress, maxDepth, false); }
@Signature public static Memory get(Environment env, String input, @Nullable String charset) throws Throwable { return get(env, input, charset, "r"); }
@Signature public OutputStream put(String src, Mode mode, @Nullable Invoker progressMonitor) throws SftpException { return put(src, mode, progressMonitor, 0); }
@Setter public void setFill(@Nullable Color color) { gc.setPaint(color); }