Skip to content

Commit e3eade7

Browse files
author
Gary Gregory
committed
Checkstyle left curly.
1 parent 04c45a7 commit e3eade7

5 files changed

Lines changed: 148 additions & 257 deletions

File tree

checkstyle.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ limitations under the License.
3838
<module name="RedundantImport"/>
3939
<module name="UnusedImports"/>
4040
<module name="NeedBraces"/>
41+
<module name="LeftCurly"/>
4142
<module name="JavadocMethod">
4243
</module>
4344
</module>

src/main/java/org/apache/commons/io/EndianUtils.java

Lines changed: 55 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,9 @@ public static double readSwappedDouble(final byte[] data, final int offset) {
272272
* @param value value to write
273273
* @throws IOException in case of an I/O problem
274274
*/
275-
public static void writeSwappedShort(final OutputStream output, final short value)
276-
throws IOException
277-
{
278-
output.write( (byte)( ( value >> 0 ) & 0xff ) );
279-
output.write( (byte)( ( value >> 8 ) & 0xff ) );
275+
public static void writeSwappedShort(final OutputStream output, final short value) throws IOException {
276+
output.write((byte) ((value >> 0) & 0xff));
277+
output.write((byte) ((value >> 8) & 0xff));
280278
}
281279

282280
/**
@@ -286,11 +284,8 @@ public static void writeSwappedShort(final OutputStream output, final short valu
286284
* @return the value just read
287285
* @throws IOException in case of an I/O problem
288286
*/
289-
public static short readSwappedShort(final InputStream input)
290-
throws IOException
291-
{
292-
return (short)( ( ( read( input ) & 0xff ) << 0 ) +
293-
( ( read( input ) & 0xff ) << 8 ) );
287+
public static short readSwappedShort(final InputStream input) throws IOException {
288+
return (short) (((read(input) & 0xff) << 0) + ((read(input) & 0xff) << 8));
294289
}
295290

296291
/**
@@ -300,30 +295,25 @@ public static short readSwappedShort(final InputStream input)
300295
* @return the value just read
301296
* @throws IOException in case of an I/O problem
302297
*/
303-
public static int readSwappedUnsignedShort(final InputStream input)
304-
throws IOException
305-
{
306-
final int value1 = read( input );
307-
final int value2 = read( input );
308-
309-
return ( ( ( value1 & 0xff ) << 0 ) +
310-
( ( value2 & 0xff ) << 8 ) );
298+
public static int readSwappedUnsignedShort(final InputStream input) throws IOException {
299+
final int value1 = read(input);
300+
final int value2 = read(input);
301+
302+
return (((value1 & 0xff) << 0) + ((value2 & 0xff) << 8));
311303
}
312304

313305
/**
314-
* Writes a "int" value to an OutputStream. The value is
315-
* converted to the opposed endian system while writing.
306+
* Writes a "int" value to an OutputStream. The value is converted to the opposed endian system while writing.
307+
*
316308
* @param output target OutputStream
317309
* @param value value to write
318310
* @throws IOException in case of an I/O problem
319311
*/
320-
public static void writeSwappedInteger(final OutputStream output, final int value)
321-
throws IOException
322-
{
323-
output.write( (byte)( ( value >> 0 ) & 0xff ) );
324-
output.write( (byte)( ( value >> 8 ) & 0xff ) );
325-
output.write( (byte)( ( value >> 16 ) & 0xff ) );
326-
output.write( (byte)( ( value >> 24 ) & 0xff ) );
312+
public static void writeSwappedInteger(final OutputStream output, final int value) throws IOException {
313+
output.write((byte) ((value >> 0) & 0xff));
314+
output.write((byte) ((value >> 8) & 0xff));
315+
output.write((byte) ((value >> 16) & 0xff));
316+
output.write((byte) ((value >> 24) & 0xff));
327317
}
328318

329319
/**
@@ -333,18 +323,13 @@ public static void writeSwappedInteger(final OutputStream output, final int valu
333323
* @return the value just read
334324
* @throws IOException in case of an I/O problem
335325
*/
336-
public static int readSwappedInteger(final InputStream input)
337-
throws IOException
338-
{
339-
final int value1 = read( input );
340-
final int value2 = read( input );
341-
final int value3 = read( input );
342-
final int value4 = read( input );
343-
344-
return ( ( value1 & 0xff ) << 0 ) +
345-
( ( value2 & 0xff ) << 8 ) +
346-
( ( value3 & 0xff ) << 16 ) +
347-
( ( value4 & 0xff ) << 24 );
326+
public static int readSwappedInteger(final InputStream input) throws IOException {
327+
final int value1 = read(input);
328+
final int value2 = read(input);
329+
final int value3 = read(input);
330+
final int value4 = read(input);
331+
332+
return ((value1 & 0xff) << 0) + ((value2 & 0xff) << 8) + ((value3 & 0xff) << 16) + ((value4 & 0xff) << 24);
348333
}
349334

350335
/**
@@ -354,17 +339,13 @@ public static int readSwappedInteger(final InputStream input)
354339
* @return the value just read
355340
* @throws IOException in case of an I/O problem
356341
*/
357-
public static long readSwappedUnsignedInteger(final InputStream input)
358-
throws IOException
359-
{
360-
final int value1 = read( input );
361-
final int value2 = read( input );
362-
final int value3 = read( input );
363-
final int value4 = read( input );
364-
365-
final long low = ( ( ( value1 & 0xff ) << 0 ) +
366-
( ( value2 & 0xff ) << 8 ) +
367-
( ( value3 & 0xff ) << 16 ) );
342+
public static long readSwappedUnsignedInteger(final InputStream input) throws IOException {
343+
final int value1 = read(input);
344+
final int value2 = read(input);
345+
final int value3 = read(input);
346+
final int value4 = read(input);
347+
348+
final long low = (((value1 & 0xff) << 0) + ((value2 & 0xff) << 8) + ((value3 & 0xff) << 16));
368349

369350
final long high = value4 & 0xff;
370351

@@ -378,17 +359,15 @@ public static long readSwappedUnsignedInteger(final InputStream input)
378359
* @param value value to write
379360
* @throws IOException in case of an I/O problem
380361
*/
381-
public static void writeSwappedLong(final OutputStream output, final long value)
382-
throws IOException
383-
{
384-
output.write( (byte)( ( value >> 0 ) & 0xff ) );
385-
output.write( (byte)( ( value >> 8 ) & 0xff ) );
386-
output.write( (byte)( ( value >> 16 ) & 0xff ) );
387-
output.write( (byte)( ( value >> 24 ) & 0xff ) );
388-
output.write( (byte)( ( value >> 32 ) & 0xff ) );
389-
output.write( (byte)( ( value >> 40 ) & 0xff ) );
390-
output.write( (byte)( ( value >> 48 ) & 0xff ) );
391-
output.write( (byte)( ( value >> 56 ) & 0xff ) );
362+
public static void writeSwappedLong(final OutputStream output, final long value) throws IOException {
363+
output.write((byte) ((value >> 0) & 0xff));
364+
output.write((byte) ((value >> 8) & 0xff));
365+
output.write((byte) ((value >> 16) & 0xff));
366+
output.write((byte) ((value >> 24) & 0xff));
367+
output.write((byte) ((value >> 32) & 0xff));
368+
output.write((byte) ((value >> 40) & 0xff));
369+
output.write((byte) ((value >> 48) & 0xff));
370+
output.write((byte) ((value >> 56) & 0xff));
392371
}
393372

394373
/**
@@ -398,14 +377,12 @@ public static void writeSwappedLong(final OutputStream output, final long value)
398377
* @return the value just read
399378
* @throws IOException in case of an I/O problem
400379
*/
401-
public static long readSwappedLong(final InputStream input)
402-
throws IOException
403-
{
380+
public static long readSwappedLong(final InputStream input) throws IOException {
404381
final byte[] bytes = new byte[8];
405-
for ( int i=0; i<8; i++ ) {
406-
bytes[i] = (byte) read( input );
382+
for (int i = 0; i < 8; i++) {
383+
bytes[i] = (byte) read(input);
407384
}
408-
return readSwappedLong( bytes, 0 );
385+
return readSwappedLong(bytes, 0);
409386
}
410387

411388
/**
@@ -415,10 +392,8 @@ public static long readSwappedLong(final InputStream input)
415392
* @param value value to write
416393
* @throws IOException in case of an I/O problem
417394
*/
418-
public static void writeSwappedFloat(final OutputStream output, final float value)
419-
throws IOException
420-
{
421-
writeSwappedInteger( output, Float.floatToIntBits( value ) );
395+
public static void writeSwappedFloat(final OutputStream output, final float value) throws IOException {
396+
writeSwappedInteger(output, Float.floatToIntBits(value));
422397
}
423398

424399
/**
@@ -428,10 +403,8 @@ public static void writeSwappedFloat(final OutputStream output, final float valu
428403
* @return the value just read
429404
* @throws IOException in case of an I/O problem
430405
*/
431-
public static float readSwappedFloat(final InputStream input)
432-
throws IOException
433-
{
434-
return Float.intBitsToFloat( readSwappedInteger( input ) );
406+
public static float readSwappedFloat(final InputStream input) throws IOException {
407+
return Float.intBitsToFloat(readSwappedInteger(input));
435408
}
436409

437410
/**
@@ -441,10 +414,8 @@ public static float readSwappedFloat(final InputStream input)
441414
* @param value value to write
442415
* @throws IOException in case of an I/O problem
443416
*/
444-
public static void writeSwappedDouble(final OutputStream output, final double value)
445-
throws IOException
446-
{
447-
writeSwappedLong( output, Double.doubleToLongBits( value ) );
417+
public static void writeSwappedDouble(final OutputStream output, final double value) throws IOException {
418+
writeSwappedLong(output, Double.doubleToLongBits(value));
448419
}
449420

450421
/**
@@ -454,10 +425,8 @@ public static void writeSwappedDouble(final OutputStream output, final double va
454425
* @return the value just read
455426
* @throws IOException in case of an I/O problem
456427
*/
457-
public static double readSwappedDouble(final InputStream input)
458-
throws IOException
459-
{
460-
return Double.longBitsToDouble( readSwappedLong( input ) );
428+
public static double readSwappedDouble(final InputStream input) throws IOException {
429+
return Double.longBitsToDouble(readSwappedLong(input));
461430
}
462431

463432
/**
@@ -466,13 +435,11 @@ public static double readSwappedDouble(final InputStream input)
466435
* @return the byte
467436
* @throws IOException if the end of file is reached
468437
*/
469-
private static int read(final InputStream input)
470-
throws IOException
471-
{
438+
private static int read(final InputStream input) throws IOException {
472439
final int value = input.read();
473440

474-
if( EOF == value ) {
475-
throw new EOFException( "Unexpected EOF reached" );
441+
if (EOF == value) {
442+
throw new EOFException("Unexpected EOF reached");
476443
}
477444

478445
return value;

src/main/java/org/apache/commons/io/input/ObservableInputStream.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ public void closed() throws IOException {
9292
* @param pException the exception to throw
9393
* @throws IOException if an i/o-error occurs
9494
*/
95-
public void error(final IOException pException) throws IOException { throw pException; }
95+
public void error(final IOException pException) throws IOException {
96+
throw pException;
97+
}
9698
}
9799

98100
private final List<Observer> observers = new ArrayList<>();

0 commit comments

Comments
 (0)