Search in sources :

Example 16 with Object

use of java.lang.Object in project clojure by clojure.

the class LispReader method readDelimitedList.

public static List readDelimitedList(char delim, PushbackReader r, boolean isRecursive, Object opts, Object pendingForms) {
    final int firstline = (r instanceof LineNumberingPushbackReader) ? ((LineNumberingPushbackReader) r).getLineNumber() : -1;
    ArrayList a = new ArrayList();
    for (; ; ) {
        Object form = read(r, false, READ_EOF, delim, READ_FINISHED, isRecursive, opts, pendingForms);
        if (form == READ_EOF) {
            if (firstline < 0)
                throw Util.runtimeException("EOF while reading");
            else
                throw Util.runtimeException("EOF while reading, starting at line " + firstline);
        } else if (form == READ_FINISHED) {
            return a;
        }
        a.add(form);
    }
}
Also used : ArrayList(java.util.ArrayList) Object(java.lang.Object)

Example 17 with Object

use of java.lang.Object in project clojure by clojure.

the class LispReader method read.

public static Object read(PushbackReader r, Object opts) {
    boolean eofIsError = true;
    Object eofValue = null;
    if (opts != null && opts instanceof IPersistentMap) {
        Object eof = ((IPersistentMap) opts).valAt(OPT_EOF, EOFTHROW);
        if (!EOFTHROW.equals(eof)) {
            eofIsError = false;
            eofValue = eof;
        }
    }
    return read(r, eofIsError, eofValue, false, opts);
}
Also used : Object(java.lang.Object)

Example 18 with Object

use of java.lang.Object in project clochure by videlalvaro.

the class LispReader method readNumber.

private static Object readNumber(PushbackReader r, char initch) {
    StringBuilder sb = new StringBuilder();
    sb.append(initch);
    for (; ; ) {
        int ch = read1(r);
        if (ch == -1 || isWhitespace(ch) || isMacro(ch)) {
            unread(r, ch);
            break;
        }
        sb.append((char) ch);
    }
    String s = sb.toString();
    Object n = matchNumber(s);
    if (n == null)
        throw new NumberFormatException("Invalid number: " + s);
    return n;
}
Also used : StringBuilder(java.lang.StringBuilder) NumberFormatException(java.lang.NumberFormatException) Object(java.lang.Object) String(java.lang.String)

Example 19 with Object

use of java.lang.Object in project intellij-community by JetBrains.

the class FooBar method method.

int method(Object foo) {
    FooBar foobar = (FooBar) foo;
    Object o = ((FooBar<caret>) foo).baz;
    foobar = null;
}
Also used : Object(java.lang.Object)

Example 20 with Object

use of java.lang.Object in project jdk8u_jdk by JetBrains.

the class StreamZipEntriesTest method testStreamJar.

@Test
public void testStreamJar() throws IOException {
    try (JarFile jf = new JarFile(new File(System.getProperty("test.src", "."), "input.jar"))) {
        jf.stream().forEach(e -> assertTrue(e instanceof JarEntry));
        Object[] elements = jf.stream().toArray();
        assertEquals(3, elements.length);
        assertEquals(elements[0].toString(), "META-INF/");
        assertEquals(elements[1].toString(), "META-INF/MANIFEST.MF");
        assertEquals(elements[2].toString(), "ReleaseInflater.java");
    }
}
Also used : Object(java.lang.Object) JarFile(java.util.jar.JarFile) JarEntry(java.util.jar.JarEntry) JarFile(java.util.jar.JarFile) File(java.io.File) ZipFile(java.util.zip.ZipFile) Test(org.testng.annotations.Test)

Aggregations

Object (java.lang.Object)26 String (java.lang.String)7 IOException (java.io.IOException)4 NumberFormatException (java.lang.NumberFormatException)4 Override (java.lang.Override)4 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)3 List (java.util.List)3 File (java.io.File)2 InputStream (java.io.InputStream)2 OutputStream (java.io.OutputStream)2 Exception (java.lang.Exception)2 IllegalArgumentException (java.lang.IllegalArgumentException)2 IllegalStateException (java.lang.IllegalStateException)2 RuntimeException (java.lang.RuntimeException)2 StringBuilder (java.lang.StringBuilder)2 UnsupportedOperationException (java.lang.UnsupportedOperationException)2 SeekableByteChannel (java.nio.channels.SeekableByteChannel)2 FileSystem (java.nio.file.FileSystem)2 Path (java.nio.file.Path)2