@@ -28,11 +28,7 @@ public ComponentEntry(IByteBuffer buffer)
2828 this . Length = buffer . ReadableBytes ;
2929 }
3030
31- public void FreeIfNecessary ( )
32- {
33- // Unwrap so that we can free slices, too.
34- this . Buffer . Release ( ) ; // We should not get a NPE here. If so, it must be a bug.
35- }
31+ public void FreeIfNecessary ( ) => this . Buffer . Release ( ) ;
3632 }
3733
3834 static readonly ArraySegment < byte > EmptyNioBuffer = Unpooled . Empty . GetIoBuffer ( ) ;
@@ -665,10 +661,7 @@ public int ToByteIndex(int cIndex)
665661 return this . components [ cIndex ] . Offset ;
666662 }
667663
668- public override byte GetByte ( int index )
669- {
670- return this . _GetByte ( index ) ;
671- }
664+ public override byte GetByte ( int index ) => this . _GetByte ( index ) ;
672665
673666 protected override byte _GetByte ( int index )
674667 {
@@ -805,10 +798,7 @@ public override IByteBuffer SetByte(int index, int value)
805798 return this ;
806799 }
807800
808- protected override void _SetByte ( int index , int value )
809- {
810- this . SetByte ( index , value ) ;
811- }
801+ protected override void _SetByte ( int index , int value ) => this . SetByte ( index , value ) ;
812802
813803 protected override void _SetShort ( int index , int value )
814804 {
@@ -1009,10 +999,7 @@ void CopyTo(int index, int length, int componentId, IByteBuffer dst)
1009999 /// @param offset the offset for which the {@link IByteBuffer} should be returned
10101000 /// @return the {@link IByteBuffer} on the specified index
10111001 /// </summary>
1012- public IByteBuffer ComponentAtOffset ( int offset )
1013- {
1014- return this . InternalComponentAtOffset ( offset ) . Duplicate ( ) ;
1015- }
1002+ public IByteBuffer ComponentAtOffset ( int offset ) => this . InternalComponentAtOffset ( offset ) . Duplicate ( ) ;
10161003
10171004 /// <summary>
10181005 /// Return the internal {@link IByteBuffer} on the specified index. Note that updating the indexes of the returned
@@ -1030,10 +1017,7 @@ public IByteBuffer InternalComponent(int cIndex)
10301017 /// buffer will lead to an undefined behavior of this buffer.
10311018 /// @param offset the offset for which the {@link IByteBuffer} should be returned
10321019 /// </summary>
1033- public IByteBuffer InternalComponentAtOffset ( int offset )
1034- {
1035- return this . FindComponent ( offset ) . Buffer ;
1036- }
1020+ public IByteBuffer InternalComponentAtOffset ( int offset ) => this . FindComponent ( offset ) . Buffer ;
10371021
10381022 ComponentEntry FindComponent ( int offset )
10391023 {
@@ -1218,10 +1202,7 @@ public override IByteBuffer DiscardReadBytes()
12181202 return this ;
12191203 }
12201204
1221- IByteBuffer AllocateBuffer ( int capacity )
1222- {
1223- return this . Allocator . Buffer ( capacity ) ;
1224- }
1205+ IByteBuffer AllocateBuffer ( int capacity ) => this . Allocator . Buffer ( capacity ) ;
12251206
12261207 public override string ToString ( )
12271208 {
@@ -1232,26 +1213,17 @@ public override string ToString()
12321213
12331214 public override IReferenceCounted Touch ( )
12341215 {
1235- if ( this . leak != null )
1236- {
1237- this . leak . Record ( ) ;
1238- }
1216+ this . leak ? . Record ( ) ;
12391217 return this ;
12401218 }
12411219
12421220 public override IReferenceCounted Touch ( object hint )
12431221 {
1244- if ( this . leak != null )
1245- {
1246- this . leak . Record ( hint ) ;
1247- }
1222+ this . leak ? . Record ( hint ) ;
12481223 return this ;
12491224 }
12501225
1251- public override IByteBuffer DiscardSomeReadBytes ( )
1252- {
1253- return this . DiscardReadComponents ( ) ;
1254- }
1226+ public override IByteBuffer DiscardSomeReadBytes ( ) => this . DiscardReadComponents ( ) ;
12551227
12561228 protected override void Deallocate ( )
12571229 {
@@ -1269,15 +1241,9 @@ protected override void Deallocate()
12691241 this . components [ i ] . FreeIfNecessary ( ) ;
12701242 }
12711243
1272- if ( this . leak != null )
1273- {
1274- this . leak . Close ( ) ;
1275- }
1244+ this . leak ? . Close ( ) ;
12761245 }
12771246
1278- public override IByteBuffer Unwrap ( )
1279- {
1280- return null ;
1281- }
1247+ public override IByteBuffer Unwrap ( ) => null ;
12821248 }
12831249}
0 commit comments