Changeset 13967


Ignore:
Timestamp:
06/15/12 20:41:56 (2 years ago)
Author:
mevenson
Message:

JAVA:JINPUT-STREAM returns the underlying java.io.InputStream? for any PATHNAME resolved by CL:TRUENAME.

SYS:ENSURE-INPUT-STREAM is the primitive wrapping the execution of Pathname.getInputStream().

My name is <evenson.not.org@…>, and I support this API.

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/Lisp.java

    r13885 r13967  
    10651065              type_error(obj, Symbol.SYMBOL);
    10661066  }
    1067 
     1067 
    10681068  public static final LispObject checkList(LispObject obj)
    10691069
  • trunk/abcl/src/org/armedbear/lisp/Pathname.java

    r13704 r13967  
    22832283    }
    22842284
     2285  public static final Primitive GET_INPUT_STREAM = new pf_get_input_stream();
     2286  @DocString(name="get-input-stream",
     2287             args="pathname",
     2288             doc="Returns a java.io.InputStream for resource denoted by PATHNAME.")
     2289  private static final class pf_get_input_stream extends Primitive {
     2290    pf_get_input_stream() {
     2291      super("ensure-input-stream", PACKAGE_SYS, true);
     2292    }
     2293    @Override
     2294    public LispObject execute(LispObject pathname) {
     2295      Pathname p = (Pathname) coerceToPathname(pathname);
     2296      return new JavaObject(p.getInputStream());
     2297    }
     2298  };
     2299
     2300
    22852301    public InputStream getInputStream() {
    22862302        InputStream result = null;
  • trunk/abcl/src/org/armedbear/lisp/Symbol.java

    r13947 r13967  
    30653065  public static final Symbol JCLASS_OF =
    30663066    PACKAGE_JAVA.addExternalSymbol("JCLASS-OF");
     3067  public static final Symbol JINPUT_STREAM =
     3068    PACKAGE_JAVA.addExternalSymbol("JINPUT-STREAM");
    30673069  public static final Symbol JMETHOD_RETURN_TYPE =
    30683070    PACKAGE_JAVA.addExternalSymbol("JMETHOD-RETURN-TYPE");
     
    30853087  public static final Symbol FLOAT_OVERFLOW_MODE =
    30863088    PACKAGE_SYS.addExternalSymbol("FLOAT-OVERFLOW-MODE");
     3089  public static final Symbol ENSURE_INPUT_STREAM =
     3090    PACKAGE_SYS.addExternalSymbol("ENSURE-INPUT-STREAM");
    30873091  public static final Symbol CLASS_BYTES =
    30883092    PACKAGE_SYS.addExternalSymbol("CLASS-BYTES");
  • trunk/abcl/src/org/armedbear/lisp/java.lisp

    r13923 r13967  
    514514  (error "make-instance not supported for ~S" class))
    515515
     516(defun jinput-stream (pathname)
     517  "Returns a java.io.InputStream for resource denoted by PATHNAME."
     518  (sys:ensure-input-stream pathname))
     519
    516520(provide "JAVA")
     521
Note: See TracChangeset for help on using the changeset viewer.