Skip to content

Commit dd9c94a

Browse files
committed
White space cleanup in src/vm/jvm/runtime/org/perl6/nqp/io/SyncHandle.java.
1 parent eafa953 commit dd9c94a

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/vm/jvm/runtime/org/perl6/nqp/io/SyncHandle.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,29 @@
1414
import org.perl6.nqp.runtime.ExceptionHandling;
1515
import org.perl6.nqp.runtime.ThreadContext;
1616

17-
public abstract class SyncHandle implements IIOClosable, IIOEncodable,
17+
public abstract class SyncHandle implements IIOClosable, IIOEncodable,
1818
IIOSyncReadable, IIOSyncWritable, IIOLineSeparable {
19-
19+
2020
protected ByteChannel chan;
2121
protected CharsetEncoder enc;
2222
protected CharsetDecoder dec;
2323
protected boolean eof = false;
2424
protected ByteBuffer readBuffer;
2525
protected byte[] linesep = null;
26-
26+
2727
public void close(ThreadContext tc) {
2828
try {
2929
chan.close();
3030
} catch (IOException e) {
3131
throw ExceptionHandling.dieInternal(tc, e);
3232
}
3333
}
34-
34+
3535
public void setEncoding(ThreadContext tc, Charset cs) {
3636
enc = cs.newEncoder();
3737
dec = cs.newDecoder();
3838
}
39-
39+
4040
public synchronized String slurp(ThreadContext tc) {
4141
try {
4242
// Read in file.
@@ -56,19 +56,19 @@ public synchronized String slurp(ThreadContext tc) {
5656
total += read;
5757
}
5858
eof = true;
59-
59+
6060
return decodeBuffers(buffers, total);
6161
} catch (IOException e) {
6262
throw ExceptionHandling.dieInternal(tc, e);
6363
}
6464
}
65-
65+
6666
public synchronized String readline(ThreadContext tc) {
6767
try {
6868
boolean foundLine = false;
6969
ArrayList<ByteBuffer> lineChunks = new ArrayList<ByteBuffer>();
7070
int total = 0;
71-
71+
7272
while (!foundLine) {
7373
/* Ensure we have a buffer available. */
7474
if (readBuffer == null) {
@@ -82,7 +82,7 @@ public synchronized String readline(ThreadContext tc) {
8282
}
8383
readBuffer.flip();
8484
}
85-
85+
8686
/* Look for a line end. */
8787
int start = readBuffer.position();
8888
int end = start;
@@ -120,18 +120,18 @@ else if (cur == '\r') {
120120
end++;
121121
}
122122
}
123-
123+
124124
/* Copy what we found into the results. */
125125
byte[] lineBytes = new byte[end - start];
126126
readBuffer.get(lineBytes);
127127
lineChunks.add(ByteBuffer.wrap(lineBytes));
128128
total += lineBytes.length;
129-
129+
130130
/* If we didn't find a line, will cross chunk boundary. */
131131
if (!foundLine)
132132
readBuffer = null;
133133
}
134-
134+
135135
if (lineChunks.size() == 1)
136136
return dec.decode(lineChunks.get(0)).toString();
137137
else
@@ -140,7 +140,7 @@ else if (cur == '\r') {
140140
throw ExceptionHandling.dieInternal(tc, e);
141141
}
142142
}
143-
143+
144144
private String decodeBuffers(ArrayList<ByteBuffer> buffers, int total) throws IOException {
145145
// Copy to a single buffer and decode (could be smarter, but need
146146
// to be wary as UTF-8 chars may span a buffer boundary).
@@ -153,7 +153,7 @@ private String decodeBuffers(ArrayList<ByteBuffer> buffers, int total) throws IO
153153
allBytes.rewind();
154154
return dec.decode(allBytes).toString();
155155
}
156-
156+
157157
public synchronized String getc(ThreadContext tc) {
158158
try {
159159
int maxBytes = (int)enc.maxBytesPerChar();
@@ -175,11 +175,11 @@ public synchronized String getc(ThreadContext tc) {
175175
toDecode.position(0);
176176
dec.decode(toDecode, decoded, true).throwException();
177177
return decoded.toString();
178-
}
178+
}
179179
}
180180
readBuffer.flip();
181181
}
182-
182+
183183
/* Get a character from the read buffer. */
184184
toDecode.position(i);
185185
toDecode.put(readBuffer.get());
@@ -200,11 +200,11 @@ public synchronized String getc(ThreadContext tc) {
200200
throw ExceptionHandling.dieInternal(tc, e);
201201
}
202202
}
203-
203+
204204
public boolean eof(ThreadContext tc) {
205205
return eof;
206206
}
207-
207+
208208
public byte[] read(ThreadContext tc, int bytes) {
209209
try {
210210
ByteBuffer buffer = ByteBuffer.allocate(bytes);
@@ -217,12 +217,12 @@ public byte[] read(ThreadContext tc, int bytes) {
217217
throw ExceptionHandling.dieInternal(tc, e);
218218
}
219219
}
220-
220+
221221
public long write(ThreadContext tc, byte[] array) {
222222
ByteBuffer buffer = ByteBuffer.wrap(array);
223223
return write(tc, buffer);
224224
}
225-
225+
226226
protected long write(ThreadContext tc, ByteBuffer buffer) {
227227
try {
228228
int toWrite = buffer.limit();
@@ -233,9 +233,9 @@ protected long write(ThreadContext tc, ByteBuffer buffer) {
233233
return written;
234234
} catch (IOException e) {
235235
throw ExceptionHandling.dieInternal(tc, e);
236-
}
236+
}
237237
}
238-
238+
239239
public long print(ThreadContext tc, String s) {
240240
try {
241241
ByteBuffer buffer = enc.encode(CharBuffer.wrap(s));
@@ -244,7 +244,7 @@ public long print(ThreadContext tc, String s) {
244244
throw ExceptionHandling.dieInternal(tc, e);
245245
}
246246
}
247-
247+
248248
public long say(ThreadContext tc, String s) {
249249
long bytes = print(tc, s);
250250
bytes += print(tc, System.lineSeparator());

0 commit comments

Comments
 (0)