Changeset 4124


Ignore:
Timestamp:
09/29/03 14:23:52 (19 years ago)
Author:
piso
Message:

checkBinaryInputStream(), checkBinaryOutputStream()

File:
1 edited

Legend:

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

    r4116 r4124  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Lisp.java,v 1.156 2003-09-28 20:13:26 piso Exp $
     5 * $Id: Lisp.java,v 1.157 2003-09-29 14:23:52 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    790790                return (CharacterOutputStream) out;
    791791        }
    792         throw new ConditionThrowable(new TypeError(obj, "output stream"));
     792        throw new ConditionThrowable(new TypeError(obj, "character output stream"));
     793    }
     794
     795    public static final BinaryInputStream checkBinaryInputStream(LispObject obj)
     796        throws ConditionThrowable
     797    {
     798        if (obj == null)
     799            throw new NullPointerException();
     800        if (obj instanceof BinaryInputStream)
     801            return (BinaryInputStream) obj;
     802        if (obj instanceof TwoWayStream) {
     803            LispInputStream in = ((TwoWayStream)obj).getInputStream();
     804            if (in instanceof BinaryInputStream)
     805                return (BinaryInputStream) in;
     806        }
     807        throw new ConditionThrowable(new TypeError(obj, "binary input stream"));
     808    }
     809
     810    public static final BinaryOutputStream checkBinaryOutputStream(LispObject obj)
     811        throws ConditionThrowable
     812    {
     813        if (obj == null)
     814            throw new NullPointerException();
     815        if (obj instanceof BinaryOutputStream)
     816            return (BinaryOutputStream) obj;
     817        if (obj instanceof TwoWayStream) {
     818            LispOutputStream out = ((TwoWayStream)obj).getOutputStream();
     819            if (out instanceof BinaryOutputStream)
     820                return (BinaryOutputStream) out;
     821        }
     822        throw new ConditionThrowable(new TypeError(obj, "binary output stream"));
    793823    }
    794824
Note: See TracChangeset for help on using the changeset viewer.