@@ -46,11 +46,11 @@ private[spark] class ChainedBuffer(chunkSize: Int) {
46
46
throw new IndexOutOfBoundsException (
47
47
s " Read of $len bytes at position $pos would go past size ${_size} of buffer " )
48
48
}
49
- var chunkIndex = (pos >> chunkSizeLog2).toInt
50
- var posInChunk = (pos - (chunkIndex << chunkSizeLog2)).toInt
51
- var written = 0
49
+ var chunkIndex : Int = (pos >> chunkSizeLog2).toInt
50
+ var posInChunk : Int = (pos - (chunkIndex << chunkSizeLog2)).toInt
51
+ var written : Int = 0
52
52
while (written < len) {
53
- val toRead = math.min(len - written, chunkSize - posInChunk)
53
+ val toRead : Int = math.min(len - written, chunkSize - posInChunk)
54
54
os.write(chunks(chunkIndex), posInChunk, toRead)
55
55
written += toRead
56
56
chunkIndex += 1
@@ -71,11 +71,11 @@ private[spark] class ChainedBuffer(chunkSize: Int) {
71
71
throw new IndexOutOfBoundsException (
72
72
s " Read of $len bytes at position $pos would go past size of buffer " )
73
73
}
74
- var chunkIndex = (pos >> chunkSizeLog2).toInt
75
- var posInChunk = (pos - (chunkIndex << chunkSizeLog2)).toInt
76
- var written = 0
74
+ var chunkIndex : Int = (pos >> chunkSizeLog2).toInt
75
+ var posInChunk : Int = (pos - (chunkIndex << chunkSizeLog2)).toInt
76
+ var written : Int = 0
77
77
while (written < len) {
78
- val toRead = math.min(len - written, chunkSize - posInChunk)
78
+ val toRead : Int = math.min(len - written, chunkSize - posInChunk)
79
79
System .arraycopy(chunks(chunkIndex), posInChunk, bytes, offs + written, toRead)
80
80
written += toRead
81
81
chunkIndex += 1
@@ -97,7 +97,7 @@ private[spark] class ChainedBuffer(chunkSize: Int) {
97
97
s " Write at position $pos starts after end of buffer ${_size}" )
98
98
}
99
99
// Grow if needed
100
- val endChunkIndex = (pos + len - 1 ) >> chunkSizeLog2
100
+ val endChunkIndex : Int = (( pos + len - 1 ) >> chunkSizeLog2).toInt
101
101
while (endChunkIndex >= chunks.length) {
102
102
chunks += new Array [Byte ](chunkSize)
103
103
}
@@ -106,7 +106,7 @@ private[spark] class ChainedBuffer(chunkSize: Int) {
106
106
var posInChunk = (pos - (chunkIndex << chunkSizeLog2)).toInt
107
107
var written = 0
108
108
while (written < len) {
109
- val toWrite = math.min(len - written, chunkSize - posInChunk)
109
+ val toWrite : Int = math.min(len - written, chunkSize - posInChunk)
110
110
System .arraycopy(bytes, offs + written, chunks(chunkIndex), posInChunk, toWrite)
111
111
written += toWrite
112
112
chunkIndex += 1
@@ -131,7 +131,7 @@ private[spark] class ChainedBuffer(chunkSize: Int) {
131
131
* Output stream that writes to a ChainedBuffer.
132
132
*/
133
133
private [spark] class ChainedBufferOutputStream (chainedBuffer : ChainedBuffer ) extends OutputStream {
134
- private var pos = 0
134
+ private var pos : Long = 0
135
135
136
136
override def write (b : Int ): Unit = {
137
137
throw new UnsupportedOperationException ()
0 commit comments