io address three primary concerns:
io address three primary concerns: * Smoothing necessary Java interop for IO operations, particularly between strings and streams/writers * Extending clojure.java.io to allow specifying an environment variable to use as the input source * (de)Serializing Clojure data structures
The data types allowed as input to io/input-stream
The data types allowed as input to io/input-stream
The set of types Clojure allows for opening files/streams
The set of types Clojure allows for opening files/streams
The name of a java system variable or O/S environment variable (in that order) that may override a ResourcePath.
The name of a java system variable or O/S environment variable (in that order) that may override a ResourcePath.
Clojure's file inputs plus extensions for reading from either Jar resources or Files.
Clojure's file inputs plus extensions for reading from either Jar resources or Files.
(input-stream file-input)
Inputs: [file-input :- ExtendedFileInputs] Returns: InputStream
Read and return a text file as an InputStream. Supported sources are the same as io/input-stream, with the following additions: ResourceOverrideMap and ResourceOverrideVector. See: (doc schema-name) for more information on these schema types.
Inputs: [file-input :- ExtendedFileInputs] Returns: InputStream Read and return a text file as an InputStream. Supported sources are the same as io/input-stream, with the following additions: ResourceOverrideMap and ResourceOverrideVector. See: (doc schema-name) for more information on these schema types.
(normalize-file-input file-input)
Inputs: [file-input :- ExtendedFileInputs] Returns: ClojureFileInputs
If the file-input is a string and can be converted to a resource URL, return that. If the file-input is a FileLocation, translate the :resource string to a URL and return that, otherwise return a File object wrapping the :file entry. Otherwise, return the original file-input.
Inputs: [file-input :- ExtendedFileInputs] Returns: ClojureFileInputs If the file-input is a string and can be converted to a resource URL, return that. If the file-input is a FileLocation, translate the :resource string to a URL and return that, otherwise return a File object wrapping the :file entry. Otherwise, return the original file-input.
(print-writer stream thing)
Print thing to writer
Print thing to writer
(println-writer stream thing)
Println thing to writer
Println thing to writer
(read-file file-input)
Inputs: [file-input :- ExtendedFileInputs] Returns: s/Str
Read and return a text file as a String. Supported sources are the same as io/input-stream, with the following additions: ResourceOverrideMap and ResourceOverrideVector. See: (doc schema-name) for more information on these types.
Inputs: [file-input :- ExtendedFileInputs] Returns: s/Str Read and return a text file as a String. Supported sources are the same as io/input-stream, with the following additions: ResourceOverrideMap and ResourceOverrideVector. See: (doc schema-name) for more information on these types.
(read-template file-location & ex-substitutions)
Inputs: [file-location :- ExtendedFileInputs & ex-substitutions] Returns: s/Str
Read a file from file-location, applying any variable substitutions specified in the file using the keyword/value pairs in substitutions.
Supported sources are the same as io/input-stream, with the following additions: ResourceOverrideMap and ResourceOverrideVector. See: (doc schema-name) and (explain schema-name) for more information on these types.
Inputs: [file-location :- ExtendedFileInputs & ex-substitutions] Returns: s/Str Read a file from file-location, applying any variable substitutions specified in the file using the keyword/value pairs in substitutions. Supported sources are the same as io/input-stream, with the following additions: ResourceOverrideMap and ResourceOverrideVector. See: (doc schema-name) and (explain schema-name) for more information on these types.
(resource-as-string & resource-spec)
Inputs: [& resource-spec :- [s/Str]] Returns: s/Str
1-arg variant: Reads the specified classpath resource and returns its contents as a string. 2-arg variant: ["ENVAR" "resource-file.txt"] - Allows resource-file to be overridden as-in read-file.
Inputs: [& resource-spec :- [s/Str]] Returns: s/Str 1-arg variant: Reads the specified classpath resource and returns its contents as a string. 2-arg variant: ["ENVAR" "resource-file.txt"] - Allows resource-file to be overridden as-in read-file.
Read the file specified by :file or the resource specified by :resource. If both entries are defined, the :file entry takes precedence over the :resource entry.
Read the file specified by :file or the resource specified by :resource. If both entries are defined, the :file entry takes precedence over the :resource entry.
Read the resource at ResourcePath unless a Java system variable or an O/S EnvironmentVariable is present with the specified name. In that case, use the value referenced by EnvironmentVariable as a file system path to the actual file.
Read the resource at ResourcePath unless a Java system variable or an O/S EnvironmentVariable is present with the specified name. In that case, use the value referenced by EnvironmentVariable as a file system path to the actual file.
A path to a JAR file resource on the classapth.
A path to a JAR file resource on the classapth.
(serialize filename data-structure)
Print a data structure to a file so that we may read it in later.
Print a data structure to a file so that we may read it in later.
(string-input-stream input)
Inputs: [input :- s/Str] Returns: InputStream
Return a java.io.InputStream containing the input string
Inputs: [input :- s/Str] Returns: InputStream Return a java.io.InputStream containing the input string
(string-output-writer)
Create a java.io.PrintWriter whose .toString contains the data printed to it.
Create a java.io.PrintWriter whose .toString contains the data printed to it.
(with-err-str & body)
Anything printed within body to err will be returned as a string.
Anything printed within body to *err* will be returned as a string.
(with-out-writer f & body)
Opens a writer on f, binds it to out, and evaluates body. Anything printed within body will be written to f.
Opens a writer on f, binds it to *out*, and evaluates body. Anything printed within body will be written to f.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close