Class IoModule


  • public class IoModule
    extends java.lang.Object
    A simple io module for aviator
    • Constructor Summary

      Constructors 
      Constructor Description
      IoModule()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void close​(java.io.Closeable closeable)  
      static boolean delete​(java.io.File file)  
      static boolean exists​(java.io.File file)  
      static java.io.File file​(java.lang.String path)
      A function to return java.io.File instance by path.
      static java.io.File[] files​(java.io.File file)  
      static java.io.InputStream inputStream​(java.io.File file)  
      static java.io.InputStream inputStream​(java.net.URL url)  
      static java.io.FileOutputStream outputStream​(java.io.File file)  
      int read​(java.io.InputStream in)  
      static java.io.BufferedReader reader​(java.io.File file)  
      static java.io.BufferedReader reader​(java.io.File file, java.lang.String charsetName)  
      static java.io.BufferedReader reader​(java.io.InputStream in)  
      static java.io.BufferedReader reader​(java.io.InputStream in, java.lang.String charsetName)  
      private static byte[] resizeBuffer​(byte[] buffer, int newSize, int len)  
      static java.net.URL resource​(java.lang.String name)  
      static LineSequence seq​(java.io.BufferedReader reader)  
      static LineSequence seq​(java.io.File file)
      cast a file into a sequence of text lines in file.
      static java.lang.String slurp​(java.io.File file)  
      static java.lang.String slurp​(java.io.File file, java.lang.String charset)  
      static java.lang.String slurp​(java.lang.String path)
      slurp function to read file fully as a string.
      static java.lang.String slurp​(java.lang.String path, java.lang.String charset)  
      static java.lang.String slurp​(java.net.URL file)  
      static java.lang.String slurp​(java.net.URL file, java.lang.String charset)  
      static void spit​(java.io.File file, java.lang.String content)  
      static void spit​(java.io.File file, java.lang.String content, java.lang.String charset)  
      static void spit​(java.lang.String path, java.lang.String content)
      spit function to write a string fully to file.
      static void spit​(java.lang.String path, java.lang.String content, java.lang.String charset)  
      void write​(java.io.OutputStream out, int b)  
      static java.io.BufferedWriter writer​(java.io.File file)  
      static java.io.BufferedWriter writer​(java.io.File file, java.lang.String charsetName)  
      static java.io.BufferedWriter writer​(java.io.OutputStream out)  
      static java.io.BufferedWriter writer​(java.io.OutputStream out, java.lang.String charsetName)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IoModule

        public IoModule()
    • Method Detail

      • file

        public static final java.io.File file​(java.lang.String path)
        A function to return java.io.File instance by path.
        Parameters:
        path -
        Returns:
      • exists

        public static boolean exists​(java.io.File file)
      • files

        public static java.io.File[] files​(java.io.File file)
      • resource

        public static final java.net.URL resource​(java.lang.String name)
      • inputStream

        public static java.io.InputStream inputStream​(java.io.File file)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • inputStream

        public static java.io.InputStream inputStream​(java.net.URL url)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • outputStream

        public static java.io.FileOutputStream outputStream​(java.io.File file)
                                                     throws java.io.FileNotFoundException
        Throws:
        java.io.FileNotFoundException
      • read

        public int read​(java.io.InputStream in)
                 throws java.io.IOException
        Throws:
        java.io.IOException
      • write

        public void write​(java.io.OutputStream out,
                          int b)
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • reader

        public static java.io.BufferedReader reader​(java.io.File file)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • reader

        public static java.io.BufferedReader reader​(java.io.File file,
                                                    java.lang.String charsetName)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • reader

        public static java.io.BufferedReader reader​(java.io.InputStream in)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • reader

        public static java.io.BufferedReader reader​(java.io.InputStream in,
                                                    java.lang.String charsetName)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • writer

        public static java.io.BufferedWriter writer​(java.io.File file)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • writer

        public static java.io.BufferedWriter writer​(java.io.File file,
                                                    java.lang.String charsetName)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • writer

        public static java.io.BufferedWriter writer​(java.io.OutputStream out)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • writer

        public static java.io.BufferedWriter writer​(java.io.OutputStream out,
                                                    java.lang.String charsetName)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • slurp

        public static java.lang.String slurp​(java.lang.String path)
                                      throws java.io.IOException
        slurp function to read file fully as a string.
        Parameters:
        path -
        Returns:
        Throws:
        java.io.IOException
      • slurp

        public static java.lang.String slurp​(java.lang.String path,
                                             java.lang.String charset)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • slurp

        public static java.lang.String slurp​(java.io.File file)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • delete

        public static boolean delete​(java.io.File file)
      • slurp

        public static java.lang.String slurp​(java.io.File file,
                                             java.lang.String charset)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • slurp

        public static java.lang.String slurp​(java.net.URL file)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • resizeBuffer

        private static byte[] resizeBuffer​(byte[] buffer,
                                           int newSize,
                                           int len)
      • slurp

        public static java.lang.String slurp​(java.net.URL file,
                                             java.lang.String charset)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • spit

        public static void spit​(java.lang.String path,
                                java.lang.String content)
                         throws java.io.IOException
        spit function to write a string fully to file.
        Parameters:
        path -
        Throws:
        java.io.IOException
      • spit

        public static void spit​(java.lang.String path,
                                java.lang.String content,
                                java.lang.String charset)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • spit

        public static void spit​(java.io.File file,
                                java.lang.String content)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • spit

        public static void spit​(java.io.File file,
                                java.lang.String content,
                                java.lang.String charset)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • seq

        public static LineSequence seq​(java.io.File file)
                                throws java.io.IOException
        cast a file into a sequence of text lines in file.
        Parameters:
        file -
        Returns:
        Throws:
        java.io.IOException
      • seq

        public static LineSequence seq​(java.io.BufferedReader reader)
      • close

        public static void close​(java.io.Closeable closeable)