diff options
author | Karen Feng <karenfeng.us@gmail.com> | 2013-07-10 13:15:42 -0700 |
---|---|---|
committer | Karen Feng <karenfeng.us@gmail.com> | 2013-07-10 13:15:42 -0700 |
commit | 04263e4d4609355d8e0779dea472fbb1aff5ef4f (patch) | |
tree | 578390fb103fcc7ec4349315263caec2d17c0409 /core/src/main | |
parent | cfb6447ac4903a870dd268836dc0d8952491d591 (diff) | |
download | spark-04263e4d4609355d8e0779dea472fbb1aff5ef4f.tar.gz spark-04263e4d4609355d8e0779dea472fbb1aff5ef4f.tar.bz2 spark-04263e4d4609355d8e0779dea472fbb1aff5ef4f.zip |
Made some minor style changes
Diffstat (limited to 'core/src/main')
-rw-r--r-- | core/src/main/scala/spark/Utils.scala | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/core/src/main/scala/spark/Utils.scala b/core/src/main/scala/spark/Utils.scala index 512ac92d89..c5627c8419 100644 --- a/core/src/main/scala/spark/Utils.scala +++ b/core/src/main/scala/spark/Utils.scala @@ -622,16 +622,15 @@ private object Utils extends Logging { } /** Return a string containing part of a file from byte 'a' to 'b'. */ - def offsetBytes(path: String, a: Long, b: Long): String = { + def offsetBytes(path: String, start: Long, end: Long): String = { val file = new File(path) val length = file.length() - val B = math.min(length, b) - val A = math.max(0, a) - val buff = new Array[Byte]((B-A).toInt) - val skip = A + val effectiveStart = math.min(length, start) + val effectiveEnd = math.max(0, end) + val buff = new Array[Byte]((effectiveEnd-effectiveStart).toInt) val stream = new FileInputStream(file) - stream.skip(skip) + stream.skip(effectiveStart) stream.read(buff) stream.close() Source.fromBytes(buff).mkString |