CrossClj

1.10.0-alpha4 docs

SourceDocs



RECENT
    VARS
    append?
    as-relative-path
    buffer-size
    byte-array-type
    char-array-type
    Coercions
    copy
    default-streams-impl
    delete-file
    do-copy
    encoding
    escaped-utf8-urlstring->str
    file
    input-stream
    inputstream->reader
    IOFactory
    make-parents
    output-stream
    outputstream->writer
    reader
    resource
    writer

    « Index of all namespaces of this project

    This file defines polymorphic I/O utility functions for Clojure.
    

    — Stuart Sierra, Chas Emerick, Stuart Halloway

    Private
    (append? opts)
    (as-relative-path x)
    Take an as-file-able thing and return a string if it is
    a relative path, else IllegalArgumentException.
    Private
    (buffer-size opts)
    Private
    Type object for a Java primitive byte array.
    
    Private
    Type object for a Java primitive char array.
    
    protocol
    Coerce between various 'resource-namish' things.
    
    (as-file x)
    Coerce argument to a file.
    
    (as-url x)
    Coerce argument to a URL.
    
    (copy input output & opts)
    Copies input to output.  Returns nil or throws IOException.
    Input may be an InputStream, Reader, File, byte[], char[], or String.
    Output may be an OutputStream, Writer, or File.
    
    Options are key/value pairs and may be one of
    
      :buffer-size  buffer size to use, default is 1024.
      :encoding     encoding to use if converting between
                    byte and char streams.   
    
    Does not close any streams except those it opens itself 
    (on a File).
    (delete-file f & [silently])
    Delete file f. If silently is nil or false, raise an exception on failure, else return the value of silently.
    
    multimethodPrivate
    (do-copy input output opts)
    Internal helper for copy
    
    Private
    (encoding opts)
    Private
    (escaped-utf8-urlstring->str s)
    (file arg)(file parent child)(file parent child & more)
    Returns a java.io.File, passing each arg to as-file.  Multiple-arg
    versions treat the first argument as parent and subsequent args as
    children relative to the parent.
    (input-stream x & opts)
    Attempts to coerce its argument into an open java.io.InputStream.
    Default implementations always return a java.io.BufferedInputStream.
    
    Default implementations are defined for InputStream, File, URI, URL,
    Socket, byte array, and String arguments.
    
    If the argument is a String, it tries to resolve it first as a URI, then
    as a local file name.  URIs with a 'file' protocol are converted to
    local file names.
    
    Should be used inside with-open to ensure the InputStream is properly
    closed.
    Private
    (inputstream->reader is opts)
    protocol
    Factory functions that create ready-to-use, buffered versions of
    the various Java I/O stream types, on top of anything that can
    be unequivocally converted to the requested kind of stream.
    
    Common options include
    
      :append    true to open stream in append mode
      :encoding  string name of encoding to use, e.g. "UTF-8".
    
    Callers should generally prefer the higher level API provided by
    reader, writer, input-stream, and output-stream.
    (make-input-stream x opts)
    Creates a BufferedInputStream. See also IOFactory docs.
    
    (make-output-stream x opts)
    Creates a BufferedOutputStream. See also IOFactory docs.
    
    (make-reader x opts)
    Creates a BufferedReader. See also IOFactory docs.
    
    (make-writer x opts)
    Creates a BufferedWriter. See also IOFactory docs.
    
    (make-parents f & more)
    Given the same arg(s) as for file, creates all parent directories of
    the file they represent.
    (output-stream x & opts)
    Attempts to coerce its argument into an open java.io.OutputStream.
    Default implementations always return a java.io.BufferedOutputStream.
    
    Default implementations are defined for OutputStream, File, URI, URL,
    Socket, and String arguments.
    
    If the argument is a String, it tries to resolve it first as a URI, then
    as a local file name.  URIs with a 'file' protocol are converted to
    local file names.
    
    Should be used inside with-open to ensure the OutputStream is
    properly closed.
    Private
    (outputstream->writer os opts)
    (reader x & opts)
    Attempts to coerce its argument into an open java.io.Reader.
    Default implementations always return a java.io.BufferedReader.
    
    Default implementations are provided for Reader, BufferedReader,
    InputStream, File, URI, URL, Socket, byte arrays, character arrays,
    and String.
    
    If argument is a String, it tries to resolve it first as a URI, then
    as a local file name.  URIs with a 'file' protocol are converted to
    local file names.
    
    Should be used inside with-open to ensure the Reader is properly
    closed.
    (resource n)(resource n loader)
    Returns the URL for a named resource. Use the context class loader
    if no loader is specified.
    (writer x & opts)
    Attempts to coerce its argument into an open java.io.Writer.
    Default implementations always return a java.io.BufferedWriter.
    
    Default implementations are provided for Writer, BufferedWriter,
    OutputStream, File, URI, URL, Socket, and String.
    
    If the argument is a String, it tries to resolve it first as a URI, then
    as a local file name.  URIs with a 'file' protocol are converted to
    local file names.
    
    Should be used inside with-open to ensure the Writer is properly
    closed.