Tabnine Logo
IO.copy
Code IndexAdd Tabnine to your IDE (free)

How to use
copy
method
in
aQute.lib.io.IO

Best Java code snippets using aQute.lib.io.IO.copy (Showing top 20 results out of 315)

origin: biz.aQute.bnd/biz.aQute.bndlib

public static String collect(Reader r) throws IOException {
  StringWriter w = new StringWriter();
  copy(r, w);
  return w.toString();
}
origin: biz.aQute.bnd/biz.aQute.bndlib

@Override
public void write(OutputStream out) throws Exception {
  if (buffer != null) {
    IO.copy(buffer(), out);
  } else {
    IO.copy(file, out);
  }
}
origin: biz.aQute/bndlib

public static void copy(Reader r, OutputStream o, String charset) throws IOException {
  try {
    OutputStreamWriter osw = new OutputStreamWriter(o, charset);
    copy(r, osw);
  }
  finally {
    r.close();
  }
}
origin: biz.aQute.bnd/biz.aQute.bndlib

@Override
public void write(OutputStream out) throws Exception {
  if (buffer != null) {
    IO.copy(buffer(), out);
  } else {
    IO.copy(zip.getInputStream(entry), out);
  }
}
origin: biz.aQute/bndlib

public static String collect(InputStream a, String encoding) throws IOException {
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  copy(a, out);
  return new String(out.toByteArray(), encoding);
}
origin: biz.aQute/bndlib

public static void copy(InputStream in, URL out, String method) throws IOException {
  URLConnection c = out.openConnection();
  if (c instanceof HttpURLConnection && method != null) {
    HttpURLConnection http = (HttpURLConnection) c;
    http.setRequestMethod(method);
  }
  c.setDoOutput(true);
  copy(in, c.getOutputStream());
}
origin: biz.aQute/bndlib

public static String collect(URL a, String encoding) throws IOException {
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  copy(a.openStream(), out);
  return new String(out.toByteArray(), encoding);
}
origin: biz.aQute.bnd/biz.aQute.bndlib

public static OutputStream copy(Reader r, OutputStream out, Charset charset) throws IOException {
  Writer w = writer(out, charset);
  try {
    copy(r, w);
    return out;
  } finally {
    w.flush();
  }
}
origin: biz.aQute.bnd/biz.aQute.bndlib

public static byte[] read(URL url) throws IOException {
  URLConnection conn = url.openConnection();
  conn.connect();
  int length = conn.getContentLength();
  if (length == -1) {
    return read(conn.getInputStream());
  }
  return copy(conn.getInputStream(), new byte[length]);
}
origin: biz.aQute.bnd/biz.aQute.bndlib

  public T from(byte[] f) throws Exception {
    IO.copy(f, this);
    return digest();
  }
}
origin: biz.aQute/bndlib

public T from(File f) throws Exception {
  IO.copy(f, this);
  return digest();
}
public T from(byte[] f) throws Exception {
origin: biz.aQute/bndlib

  public T from(byte[] f) throws Exception {
    IO.copy(f, this);
    return digest();
  }
}
origin: biz.aQute.bnd/biz.aQute.bndlib

public static Path copy(InputStream in, Path path) throws IOException {
  try (FileChannel out = writeChannel(path)) {
    copy(in, out);
  }
  return path;
}
origin: biz.aQute.bnd/biz.aQute.bndlib

private ByteBuffer getBuffer() throws Exception {
  if (buffer != null) {
    return buffer;
  }
  if (size == -1) {
    return buffer = ByteBuffer.wrap(IO.read(zip.getInputStream(entry)));
  }
  ByteBuffer bb = IO.copy(zip.getInputStream(entry), ByteBuffer.allocate((int) size));
  bb.flip();
  return buffer = bb;
}
origin: biz.aQute.bnd/biz.aQute.bndlib

@Override
public void write(OutputStream out) throws Exception {
  if (buffer != null) {
    IO.copy(buffer(), out);
  } else {
    IO.copy(open(), out);
  }
}
origin: biz.aQute.bnd/biz.aQute.bndlib

private ByteBuffer getBuffer() throws Exception {
  if (buffer != null) {
    return buffer;
  }
  InputStream in = open();
  if (size == -1) {
    return buffer = ByteBuffer.wrap(IO.read(in));
  }
  ByteBuffer bb = IO.copy(in, ByteBuffer.allocate(size));
  bb.flip();
  return buffer = bb;
}
origin: biz.aQute.bnd/biz.aQute.bndlib

public void update(InputStream inputStream, String etag, long modified) throws Exception {
  IO.mkdirs(this.file.getParentFile());
  IO.copy(inputStream, this.file);
  if (modified > 0) {
    this.file.setLastModified(modified);
  }
  update(etag);
}
origin: biz.aQute.bnd/biz.aQute.bndlib

private void copyResource(File dir, String path, Resource resource) throws Exception {
  File to = IO.getBasedFile(dir, path);
  IO.mkdirs(to.getParentFile());
  IO.copy(resource.openInputStream(), to);
}
origin: biz.aQute.bnd/biz.aQute.bndlib

@Override
public void created(Project p) throws IOException {
  Workspace workspace = p.getWorkspace();
  File source = workspace.getFile("ant/project.xml");
  File dest = p.getFile("build.xml");
  if (source.isFile())
    IO.copy(source, dest);
  else
    IO.store(DEFAULT, dest);
}
origin: biz.aQute/bndlib

public String _sha1(String args[]) throws Exception {
  Macro.verifyCommand(args, _sha1Help, new Pattern[] {
      null, null, Pattern.compile("base64|hex")
  }, 2, 3);
  Digester<SHA1> digester = SHA1.getDigester();
  Resource r = dot.getResource(args[1]);
  if (r == null)
    throw new FileNotFoundException("From sha1, not found " + args[1]);
  IO.copy(r.openInputStream(), digester);
  return Base64.encodeBase64(digester.digest().digest());
}
aQute.lib.ioIOcopy

Popular methods of IO

  • collect
  • getFile
  • deleteWithException
    Deletes the specified path. Folders are recursively deleted. Throws exception if any of the files co
  • reader
  • store
  • writer
  • delete
    Deletes the specified path. Folders are recursively deleted. If file(s) cannot be deleted, no feedba
  • read
  • rename
    Renames from to to replacing the target file if necessary.
  • isSymbolicLink
  • stream
  • traverse
  • stream,
  • traverse,
  • close,
  • createSymbolicLink,
  • createSymbolicLinkOrCopy,
  • createTempFile,
  • decode,
  • mkdirs,
  • normalizePath

Popular in Java

  • Making http post requests using okhttp
  • addToBackStack (FragmentTransaction)
  • onCreateOptionsMenu (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now