Skip to content

Commit bd836cf

Browse files
committed
Remove whitespace
1 parent 61079e1 commit bd836cf

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

src/main/java/org/apache/commons/imaging/bytesource/InputStreamByteSource.java

-21
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,16 @@ public int read() throws IOException {
6868
block = getFirstBlock();
6969
readFirst = true;
7070
}
71-
7271
if (block != null && blockIndex >= block.bytes.length) {
7372
block = block.getNext();
7473
blockIndex = 0;
7574
}
76-
7775
if (null == block) {
7876
return -1;
7977
}
80-
8178
if (blockIndex >= block.bytes.length) {
8279
return -1;
8380
}
84-
8581
return 0xff & block.bytes[blockIndex++];
8682
}
8783

@@ -95,30 +91,24 @@ public int read(final byte[] array, final int off, final int len) throws IOExcep
9591
if (len == 0) {
9692
return 0;
9793
}
98-
9994
// optimized block read
100-
10195
if (null == block) {
10296
if (readFirst) {
10397
return -1;
10498
}
10599
block = getFirstBlock();
106100
readFirst = true;
107101
}
108-
109102
if (block != null && blockIndex >= block.bytes.length) {
110103
block = block.getNext();
111104
blockIndex = 0;
112105
}
113-
114106
if (null == block) {
115107
return -1;
116108
}
117-
118109
if (blockIndex >= block.bytes.length) {
119110
return -1;
120111
}
121-
122112
final int readSize = Math.min(len, block.bytes.length - blockIndex);
123113
System.arraycopy(block.bytes, blockIndex, array, off, readSize);
124114
blockIndex += readSize;
@@ -127,13 +117,10 @@ public int read(final byte[] array, final int off, final int len) throws IOExcep
127117

128118
@Override
129119
public long skip(final long n) throws IOException {
130-
131120
long remaining = n;
132-
133121
if (n <= 0) {
134122
return 0;
135123
}
136-
137124
while (remaining > 0) {
138125
// read the first block
139126
if (null == block) {
@@ -143,27 +130,21 @@ public long skip(final long n) throws IOException {
143130
block = getFirstBlock();
144131
readFirst = true;
145132
}
146-
147133
// get next block
148134
if (block != null && blockIndex >= block.bytes.length) {
149135
block = block.getNext();
150136
blockIndex = 0;
151137
}
152-
153138
if (null == block) {
154139
break;
155140
}
156-
157141
if (blockIndex >= block.bytes.length) {
158142
break;
159143
}
160-
161144
final int readSize = Math.min((int) Math.min(BLOCK_SIZE, remaining), block.bytes.length - blockIndex);
162-
163145
blockIndex += readSize;
164146
remaining -= readSize;
165147
}
166-
167148
return n - remaining;
168149
}
169150

@@ -188,10 +169,8 @@ public byte[] getByteArray(final long position, final int length) throws IOExcep
188169
throw new ImagingException(
189170
"Could not read block (block start: " + position + ", block length: " + length + ", data length: " + streamLength + ").");
190171
}
191-
192172
final InputStream cis = getInputStream();
193173
BinaryFunctions.skipBytes(cis, position);
194-
195174
final byte[] bytes = Allocator.byteArray(length);
196175
int total = 0;
197176
while (true) {

0 commit comments

Comments
 (0)