congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
IO
Code IndexAdd Tabnine to your IDE (free)

How to use
IO
in
org.eclipse.jetty.util

Best Java code snippets using org.eclipse.jetty.util.IO (Showing top 20 results out of 342)

Refine searchRefine arrow

  • Logger
  • Resource
origin: org.eclipse.jetty/jetty-util

/** 
 * @param out the output stream to write to 
 * @param start First byte to write
 * @param count Bytes to write or -1 for all of them.
 * @throws IOException if unable to copy the Resource to the output
 */
public void writeTo(OutputStream out,long start,long count)
  throws IOException
{
  try (InputStream in = getInputStream())
  {
    in.skip(start);
    if (count<0)
      IO.copy(in,out);
    else
      IO.copy(in,out,count);
  }
}    

origin: org.eclipse.jetty/jetty-util

/**
 * closes a reader, and logs exceptions
 *
 * @param reader the reader to close
 */
public static void close(Reader reader)
{
  close((Closeable)reader);
}
origin: org.eclipse.jetty/jetty-util

/** Read input stream to string.
 * @param in the stream to read from (until EOF)
 * @return the String parsed from stream (default Charset)
 * @throws IOException if unable to read the stream (or handle the charset)
 */
public static String toString(InputStream in)
  throws IOException
{
  return toString(in,(Charset)null);
}
origin: org.eclipse.jetty/jetty-util

/** Copy files or directories
 * @param from the file to copy
 * @param to the destination to copy to
 * @throws IOException if unable to copy
 */
public static void copy(File from,File to) throws IOException
{
  if (from.isDirectory())
    copyDir(from,to);
  else
    copyFile(from,to);
}
origin: org.eclipse.jetty/jetty-util

@Override
public void copyTo(File destination)
    throws IOException
{
  if (isDirectory())
  {
    IO.copyDir(getFile(),destination);
  }
  else
  {
    if (destination.exists())
      throw new IllegalArgumentException(destination+" exists");
    IO.copy(getFile(),destination);
  }
}
origin: org.eclipse.jetty/jetty-webapp

if (web_app.isAlias())
  LOG.debug(web_app + " anti-aliased to " + web_app.getAlias());
  web_app = context.newResource(web_app.getAlias());
if (LOG.isDebugEnabled())
  LOG.debug("Try webapp=" + web_app + ", exists=" + web_app.exists() + ", directory=" + web_app.isDirectory()+" file="+(web_app.getFile()));
        IO.delete(extractedWebAppDir);
        extractedWebAppDir.mkdir();
        LOG.debug("Extract " + web_app + " to " + extractedWebAppDir);
  IO.delete(extractedWebInfDir);
extractedWebInfDir.mkdir();
Resource web_inf_lib = web_inf.addPath("lib/");
    IO.delete(webInfLibDir);
  webInfLibDir.mkdir();
    IO.delete(webInfClassesDir);
  webInfClassesDir.mkdir();
  LOG.debug("Copying WEB-INF/classes from "+web_inf_classes+" to "+webInfClassesDir.getAbsolutePath());
origin: org.eclipse.jetty.aggregate/jetty-all-server

public DefaultHandler()
{
  try
  {
    URL fav = this.getClass().getClassLoader().getResource("org/eclipse/jetty/favicon.ico");
    if (fav!=null)
    {
      Resource r = Resource.newResource(fav);
      _favicon=IO.readBytes(r.getInputStream());
    }
  }
  catch(Exception e)
  {
    LOG.warn(e);
  }
}

origin: org.eclipse.jetty.aggregate/jetty-all-server

public void destroy()
{
  for (File file : _files)
  {
    if (file.exists())
    {
      LOG.debug("Destroy {}",file);
      IO.delete(file);
    }
  }
}
origin: org.eclipse.jetty/jetty-util

@Override
public void destroy()
{
  for (File file : _files)
  {
    if (file.exists())
    {
      if (LOG.isDebugEnabled())
        LOG.debug("Destroy {}",file);
      IO.delete(file);
    }
  }
}
origin: org.eclipse.jetty/jetty-webapp

byte[] bytes = IO.readBytes(content);
if (LOG.isDebugEnabled())
  LOG.debug("foundClass({}) url={} cl={}",name,url,this);
origin: org.eclipse.jetty/jetty-util

  return;
if(LOG.isDebugEnabled())
  LOG.debug("Extract "+this+" to "+directory);
boolean subEntryIsDir = (subEntryName != null && subEntryName.endsWith("/")?true:false);
if (LOG.isDebugEnabled()) 
  LOG.debug("Extracting entry = "+subEntryName+" from jar "+jarFileURL);
URLConnection c = jarFileURL.openConnection();
        IO.copy(jin,fout);
origin: org.eclipse.jetty/jetty-security

private Path extractPackedFile(JarFileResource configResource) throws IOException
{
  String uri = configResource.getURI().toASCIIString();
  int colon = uri.lastIndexOf(":");
  int bang_slash = uri.indexOf("!/");
  if (colon < 0 || bang_slash < 0 || colon > bang_slash)
    throw new IllegalArgumentException("Not resolved JarFile resource: " + uri);
  String entry_path = uri.substring(colon + 2).replace("!/", "__").replace('/', '_').replace('.', '_');
  Path tmpDirectory = Files.createTempDirectory("users_store");
  tmpDirectory.toFile().deleteOnExit();
  Path extractedPath = Paths.get(tmpDirectory.toString(), entry_path);
  Files.deleteIfExists(extractedPath);
  extractedPath.toFile().deleteOnExit();
  IO.copy(configResource.getInputStream(), new FileOutputStream(extractedPath.toFile()));
  if (isHotReload())
  {
    LOG.warn("Cannot hot reload from packed configuration: {}", configResource);
    setHotReload(false);
  }
  return extractedPath;
}
origin: org.eclipse.jetty/jetty-util

  @Override
  public void run()
  {
    try {
      if (in!=null)
        copy(in,out,-1);
      else
        copy(read,write,-1);
    }
    catch(IOException e)
    {
      LOG.ignore(e);
      try{
        if (out!=null)
          out.close();
        if (write!=null)
          write.close();
      }
      catch(IOException e2)
      {
        LOG.ignore(e2);
      }
    }
  }
}
origin: org.eclipse.jetty/jetty-util

/** Copy Reader to Writer out until EOF or exception.
 * @param in the read to read from (until EOF)
 * @param out the writer to write to
 * @throws IOException if unable to copy the streams
 */
public static void copy(Reader in, Writer out)
   throws IOException
{
  copy(in,out,-1);
}
origin: org.eclipse.jetty/jetty-util

  @Override
  public void close() throws IOException {this.in=IO.getClosedStream();}
};
origin: org.eclipse.jetty/jetty-security

@Override
public PrintWriter getWriter() throws IOException
{
  return IO.getNullPrintWriter();
}
origin: org.eclipse.jetty/jetty-webapp

@Override
public void deconfigure(WebAppContext context) throws Exception
{
  //if we're not persisting the temp dir contents delete it
  if (!context.isPersistTempDirectory())
  {
    IO.delete(context.getTempDirectory());
  }
  
  //if it wasn't explicitly configured by the user, then unset it
  Boolean tmpdirConfigured = (Boolean)context.getAttribute(TEMPDIR_CONFIGURED);
  if (tmpdirConfigured != null && !tmpdirConfigured) 
    context.setTempDirectory(null);
  //reset the base resource back to what it was before we did any unpacking of resources
  if (context.getBaseResource() != null)
    context.getBaseResource().close();
  context.setBaseResource(_preUnpackBaseResource);
}
origin: org.eclipse.jetty/jetty-webapp

public void configureTempDirectory (File dir, WebAppContext context)
{
  if (dir == null)
    throw new IllegalArgumentException("Null temp dir");
  //if dir exists and we don't want it persisted, delete it
  if (dir.exists() && !context.isPersistTempDirectory())
  {
    if (!IO.delete(dir))
      throw new IllegalStateException("Failed to delete temp dir "+dir);
  }
  //if it doesn't exist make it
  if (!dir.exists())
    dir.mkdirs();
  if (!context.isPersistTempDirectory())
    dir.deleteOnExit();
  //is it useable
  if (!dir.canWrite() || !dir.isDirectory())   
    throw new IllegalStateException("Temp dir "+dir+" not useable: writeable="+dir.canWrite()+", dir="+dir.isDirectory());
}
origin: cd.connect.common/connect-runnable-war

public InMemoryResource(InMemoryResource parent, InputStream stream, String fileName) {
  this.parent = parent;
  try {
    self = new ByteArray();
    if (stream != null) {
      self.bytes = IO.readBytes(stream);
    }
  } catch (IOException e) {
    throw new RuntimeException(String.format("Unable to read input stream for %s", fileName) );
  }
  this.fileName = fileName;
}
origin: org.eclipse.jetty/jetty-util

@Override
public void copyTo(File destination) throws IOException
{
  if (isDirectory())
  {
    IO.copyDir(this.path.toFile(),destination);
  }
  else
  {
    Files.copy(this.path,destination.toPath());
  }
}
org.eclipse.jetty.utilIO

Javadoc

IO Utilities. Provides stream handling utilities in singleton Threadpool implementation accessed by static members.

Most used methods

  • copy
    Copy Reader to Writer for byteCount bytes or until EOF or exception.
  • close
    closes a writer, and logs exceptions
  • toString
    Read input stream to string.
  • delete
    Delete File. This delete will recursively delete directories - BE CAREFULL
  • readBytes
  • getClosedStream
  • getNullPrintWriter
  • copyDir
  • copyFile
  • copyThread
    Copy Stream in to Stream out until EOF or exception in own thread
  • write
    A gathering write utility wrapper. This method wraps a gather write with a loop that handles the lim
  • write

Popular in Java

  • Reactive rest calls using spring rest template
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setContentView (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • CodeWhisperer alternatives
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