Permalink
Browse files

Initial Commit

  • Loading branch information...
dakrone committed Sep 13, 2011
0 parents commit 998cc8adabea9f46212f70e9db34ec02a871c80b
Showing with 52 additions and 0 deletions.
  1. +13 −0 README
  2. +4 −0 project.clj
  3. +29 −0 src/chunktest/core.clj
  4. +6 −0 test/chunktest/test/core.clj
13 README
@@ -0,0 +1,13 @@
+# chunktest
+
+FIXME: write description
+
+## Usage
+
+FIXME: write
+
+## License
+
+Copyright (C) 2011 FIXME
+
+Distributed under the Eclipse Public License, the same as Clojure.
@@ -0,0 +1,4 @@
+(defproject chunktest "1.0.0-SNAPSHOT"
+ :description "FIXME: write description"
+ :dependencies [[org.clojure/clojure "1.2.1"]
+ [aleph "0.2.0-beta1"]])
@@ -0,0 +1,29 @@
+(ns chunktest.core
+ (:use [aleph.http :only [start-http-server wrap-ring-handler]]
+ [lamina.core :only [channel close enqueue]]
+ [clojure.java.io :only [file]])
+ (:import (java.io BufferedReader FileInputStream)))
+
+(defn stream-stuff [ch]
+ (future
+ (with-open [stream (FileInputStream. (file "/Users/hinmanm/test.txt"))]
+ (loop []
+ (let [c (.read stream)]
+ (println :c c)
+ (if (pos? c)
+ (do
+ (enqueue ch (str (char c)))
+ (recur))
+ (println :bailing)))))
+ (println :closing)
+ (close ch)
+ (println :closed)))
+
+(defn handler [request]
+ (let [stream (channel)]
+ (stream-stuff stream)
+ {:status 200
+ :headers {"content-type" "text/plain"}
+ :body stream}))
+
+(defn start [] (start-http-server (wrap-ring-handler handler) {:port 8080}))
@@ -0,0 +1,6 @@
+(ns chunktest.test.core
+ (:use [chunktest.core])
+ (:use [clojure.test]))
+
+(deftest replace-me ;; FIXME: write
+ (is false "No tests have been written."))

0 comments on commit 998cc8a

Please sign in to comment.