Class IOUtils

java.lang.Object
org.apache.dubbo.common.utils.IOUtils

public class IOUtils extends Object
Miscellaneous io utility methods. Mainly for internal use within the framework.
Since:
2.0.7
  • Field Details

  • Method Details

    • write

      public static long write(InputStream is, OutputStream os) throws IOException
      write.
      Parameters:
      is - InputStream instance.
      os - OutputStream instance.
      Returns:
      count.
      Throws:
      IOException - If an I/O error occurs
    • write

      public static long write(InputStream is, OutputStream os, int bufferSize) throws IOException
      write.
      Parameters:
      is - InputStream instance.
      os - OutputStream instance.
      bufferSize - buffer size.
      Returns:
      count.
      Throws:
      IOException - If an I/O error occurs
    • write

      public static long write(InputStream input, OutputStream output, byte[] buffer) throws IOException
      write.
      Parameters:
      input - InputStream instance.
      output - OutputStream instance.
      buffer - buffer byte array
      Returns:
      count.
      Throws:
      IOException - If an I/O error occurs
    • read

      public static String read(Reader reader) throws IOException
      read string.
      Parameters:
      reader - Reader instance.
      Returns:
      String.
      Throws:
      IOException - If an I/O error occurs
    • write

      public static long write(Writer writer, String string) throws IOException
      write string.
      Parameters:
      writer - Writer instance.
      string - String.
      Throws:
      IOException - If an I/O error occurs
    • write

      public static long write(Reader reader, Writer writer) throws IOException
      write.
      Parameters:
      reader - Reader.
      writer - Writer.
      Returns:
      count.
      Throws:
      IOException - If an I/O error occurs
    • write

      public static long write(Reader reader, Writer writer, int bufferSize) throws IOException
      write.
      Parameters:
      reader - Reader.
      writer - Writer.
      bufferSize - buffer size.
      Returns:
      count.
      Throws:
      IOException - If an I/O error occurs
    • readLines

      public static String[] readLines(File file) throws IOException
      read lines.
      Parameters:
      file - file.
      Returns:
      lines.
      Throws:
      IOException - If an I/O error occurs
    • readLines

      public static String[] readLines(InputStream is) throws IOException
      read lines.
      Parameters:
      is - input stream.
      Returns:
      lines.
      Throws:
      IOException - If an I/O error occurs
    • read

      public static String read(InputStream is, String encoding) throws IOException
      Throws:
      IOException
    • writeLines

      public static void writeLines(OutputStream os, String[] lines) throws IOException
      write lines.
      Parameters:
      os - output stream.
      lines - lines.
      Throws:
      IOException - If an I/O error occurs
    • writeLines

      public static void writeLines(File file, String[] lines) throws IOException
      write lines.
      Parameters:
      file - file.
      lines - lines.
      Throws:
      IOException - If an I/O error occurs
    • appendLines

      public static void appendLines(File file, String[] lines) throws IOException
      append lines.
      Parameters:
      file - file.
      lines - lines.
      Throws:
      IOException - If an I/O error occurs
    • getURL

      public static URL getURL(String resourceLocation) throws FileNotFoundException
      use like spring code
      Parameters:
      resourceLocation -
      Returns:
      Throws:
      FileNotFoundException
    • toByteArray

      public static byte[] toByteArray(InputStream inputStream) throws IOException
      Throws:
      IOException