Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   //========================================================================
   //Copyright 2007-2011 David Yu dyuproject@gmail.com
   //------------------------------------------------------------------------
   //Licensed under the Apache License, Version 2.0 (the "License");
   //you may not use this file except in compliance with the License.
   //You may obtain a copy of the License at 
   //http://www.apache.org/licenses/LICENSE-2.0
   //Unless required by applicable law or agreed to in writing, software
   //distributed under the License is distributed on an "AS IS" BASIS,
  //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  //See the License for the specific language governing permissions and
  //limitations under the License.
  //========================================================================
  
  package io.protostuff.runtime;
  
  import static io.protostuff.runtime.RuntimeFieldFactory.ID_BIGDECIMAL;
  import static io.protostuff.runtime.RuntimeFieldFactory.ID_BIGINTEGER;
  import static io.protostuff.runtime.RuntimeFieldFactory.ID_BOOL;
  import static io.protostuff.runtime.RuntimeFieldFactory.ID_BYTE;
  import static io.protostuff.runtime.RuntimeFieldFactory.ID_BYTES;
  import static io.protostuff.runtime.RuntimeFieldFactory.ID_BYTE_ARRAY;
  import static io.protostuff.runtime.RuntimeFieldFactory.ID_CHAR;
  import static io.protostuff.runtime.RuntimeFieldFactory.ID_DATE;
  import static io.protostuff.runtime.RuntimeFieldFactory.ID_DELEGATE;
  import static io.protostuff.runtime.RuntimeFieldFactory.ID_DOUBLE;
  import static io.protostuff.runtime.RuntimeFieldFactory.ID_ENUM;
  import static io.protostuff.runtime.RuntimeFieldFactory.ID_FLOAT;
  import static io.protostuff.runtime.RuntimeFieldFactory.ID_INT32;
  import static io.protostuff.runtime.RuntimeFieldFactory.ID_INT64;
  import static io.protostuff.runtime.RuntimeFieldFactory.ID_OBJECT;
  import static io.protostuff.runtime.RuntimeFieldFactory.ID_POJO;
  import static io.protostuff.runtime.RuntimeFieldFactory.ID_SHORT;
  import static io.protostuff.runtime.RuntimeFieldFactory.ID_STRING;
  
  import java.util.Date;
  
  import io.protostuff.Tag;
Field factory via plain old reflection api.

Author(s):
David Yu
Created:
Jul 7, 2011
  
  public final class RuntimeReflectionFieldFactory
  {
  
      private RuntimeReflectionFieldFactory()
      {
      }
  
      public static final RuntimeFieldFactory<CharacterCHAR = new RuntimeFieldFactory<Character>(
              )
      {
          @Override
          public <T> Field<T> create(int numberString name,
                  final java.lang.reflect.Field fIdStrategy strategy)
          {
              final boolean primitive = f.getType().isPrimitive();
              return new Field<T>(.numbername,
                      f.getAnnotation(Tag.class))
              {
                  {
                      f.setAccessible(true);
                  }
  
                  public void mergeFrom(Input input, T message)
                          throws IOException
                  {
                      try
                      {
                          if (primitive)
                              f.setChar(message, (charinput.readUInt32());
                          else
                              f.set(message, Character.valueOf((charinput
                                      .readUInt32()));
                      }
                      catch (IllegalArgumentException | IllegalAccessException e)
                      {
                          throw new RuntimeException(e);
                      }
                  }
  
                  public void writeTo(Output output, T message)
                          throws IOException
                  {
                      try
                     {
                         if (primitive)
                             output.writeUInt32(f.getChar(message),
                                     false);
                         else
                         {
                             Character value = (Characterf.get(message);
                             if (value != null)
                                 output.writeUInt32(value.charValue(),
                                         false);
                         }
                     }
                     catch (IllegalArgumentException | IllegalAccessException e)
                     {
                         throw new RuntimeException(e);
                     }
                 }
 
                 public void transfer(Pipe pipeInput inputOutput output,
                         boolean repeatedthrows IOException
                 {
                     output.writeUInt32(input.readUInt32(), repeated);
                 }
             };
         }
 
         @Override
         public void transfer(Pipe pipeInput inputOutput outputint number,
                 boolean repeatedthrows IOException
         {
             output.writeUInt32(numberinput.readUInt32(), repeated);
         }
 
         @Override
         public Character readFrom(Input inputthrows IOException
         {
             return Character.valueOf((charinput.readUInt32());
         }
 
         @Override
         public void writeTo(Output outputint numberCharacter value,
                 boolean repeatedthrows IOException
         {
             output.writeUInt32(numbervalue.charValue(), repeated);
         }
 
         @Override
         public FieldType getFieldType()
         {
             return .;
         }
 
         @Override
         public Class<?> typeClass()
         {
             return Character.class;
         }
     };
 
     public static final RuntimeFieldFactory<ShortSHORT = new RuntimeFieldFactory<Short>(
             )
     {
         @Override
         public <T> Field<T> create(int numberString name,
                 final java.lang.reflect.Field fIdStrategy strategy)
         {
             final boolean primitive = f.getType().isPrimitive();
             return new Field<T>(.numbername,
                     f.getAnnotation(Tag.class))
             {
                 {
                     f.setAccessible(true);
                 }
 
                 @Override
                 public void mergeFrom(Input input, T message)
                         throws IOException
                 {
                     try
                     {
                         if (primitive)
                             f.setShort(message, (shortinput.readUInt32());
                         else
                             f.set(message,
                                     Short.valueOf((shortinput.readUInt32()));
                     }
                     catch (IllegalArgumentException | IllegalAccessException e)
                     {
                         throw new RuntimeException(e);
                     }
                 }
 
                 @Override
                 public void writeTo(Output output, T message)
                         throws IOException
                 {
                     try
                     {
                         if (primitive)
                             output.writeUInt32(f.getShort(message),
                                     false);
                         else
                         {
                             Short value = (Shortf.get(message);
                             if (value != null)
                                 output.writeUInt32(value.shortValue(),
                                         false);
                         }
                     }
                     catch (IllegalArgumentException | IllegalAccessException e)
                     {
                         throw new RuntimeException(e);
                     }
                 }
 
                 @Override
                 public void transfer(Pipe pipeInput inputOutput output,
                         boolean repeatedthrows IOException
                 {
                     output.writeUInt32(input.readUInt32(), repeated);
                 }
             };
         }
 
         @Override
         public void transfer(Pipe pipeInput inputOutput outputint number,
                 boolean repeatedthrows IOException
         {
             output.writeUInt32(numberinput.readUInt32(), repeated);
         }
 
         @Override
         public Short readFrom(Input inputthrows IOException
         {
             return Short.valueOf((shortinput.readUInt32());
         }
 
         @Override
         public void writeTo(Output outputint numberShort value,
                 boolean repeatedthrows IOException
         {
             output.writeUInt32(numbervalue.shortValue(), repeated);
         }
 
         @Override
         public FieldType getFieldType()
         {
             return .;
         }
 
         @Override
         public Class<?> typeClass()
         {
             return Short.class;
         }
     };
 
     public static final RuntimeFieldFactory<ByteBYTE = new RuntimeFieldFactory<Byte>(
             )
     {
         @Override
         public <T> Field<T> create(int numberString name,
                 final java.lang.reflect.Field fIdStrategy strategy)
         {
             final boolean primitive = f.getType().isPrimitive();
             return new Field<T>(.numbername,
                     f.getAnnotation(Tag.class))
             {
                 {
                     f.setAccessible(true);
                 }
 
                 public void mergeFrom(Input input, T message)
                         throws IOException
                 {
                     try
                     {
                         if (primitive)
                             f.setByte(message, (byteinput.readUInt32());
                         else
                             f.set(message,
                                     Byte.valueOf((byteinput.readUInt32()));
                     }
                     catch (IllegalArgumentException | IllegalAccessException e)
                     {
                         throw new RuntimeException(e);
                     }
                 }
 
                 public void writeTo(Output output, T message)
                         throws IOException
                 {
                     try
                     {
                         if (primitive)
                             output.writeUInt32(f.getByte(message),
                                     false);
                         else
                         {
                             Byte value = (Bytef.get(message);
                             if (value != null)
                                 output.writeUInt32(value.byteValue(),
                                         false);
                         }
                     }
                     catch (IllegalArgumentException | IllegalAccessException e)
                     {
                         throw new RuntimeException(e);
                     }
                 }
 
                 public void transfer(Pipe pipeInput inputOutput output,
                         boolean repeatedthrows IOException
                 {
                     output.writeUInt32(input.readUInt32(), repeated);
                 }
             };
         }
 
         @Override
         public void transfer(Pipe pipeInput inputOutput outputint number,
                 boolean repeatedthrows IOException
         {
             output.writeUInt32(numberinput.readUInt32(), repeated);
         }
 
         @Override
         public Byte readFrom(Input inputthrows IOException
         {
             return Byte.valueOf((byteinput.readUInt32());
         }
 
         @Override
         public void writeTo(Output outputint numberByte value,
                 boolean repeatedthrows IOException
         {
             output.writeUInt32(numbervalue.byteValue(), repeated);
         }
 
         @Override
         public FieldType getFieldType()
         {
             return .;
         }
 
         @Override
         public Class<?> typeClass()
         {
             return Byte.class;
         }
     };
 
     public static final RuntimeFieldFactory<IntegerINT32 = new RuntimeFieldFactory<Integer>(
             )
     {
         @Override
         public <T> Field<T> create(int numberjava.lang.String name,
                 final java.lang.reflect.Field fIdStrategy strategy)
         {
             final boolean primitive = f.getType().isPrimitive();
             return new Field<T>(.numbername,
                     f.getAnnotation(Tag.class))
             {
                 {
                     f.setAccessible(true);
                 }
 
                 public void mergeFrom(Input input, T message)
                         throws IOException
                 {
                     try
                     {
                         if (primitive)
                             f.setInt(messageinput.readInt32());
                         else
                             f.set(message, Integer.valueOf(input.readInt32()));
                     }
                     catch (IllegalArgumentException | IllegalAccessException e)
                     {
                         throw new RuntimeException(e);
                     }
                 }
 
                 public void writeTo(Output output, T message)
                         throws IOException
                 {
                     try
                     {
                         if (primitive)
                             output.writeInt32(f.getInt(message), false);
                         else
                         {
                             Integer value = (Integerf.get(message);
                             if (value != null)
                                 output.writeInt32(value.intValue(),
                                         false);
                         }
                     }
                     catch (IllegalArgumentException | IllegalAccessException e)
                     {
                         throw new RuntimeException(e);
                     }
                 }
 
                 public void transfer(Pipe pipeInput inputOutput output,
                         boolean repeatedthrows IOException
                 {
                     output.writeInt32(input.readInt32(), repeated);
                 }
             };
         }
 
         @Override
         public void transfer(Pipe pipeInput inputOutput outputint number,
                 boolean repeatedthrows IOException
         {
             output.writeInt32(numberinput.readInt32(), repeated);
         }
 
         @Override
         public Integer readFrom(Input inputthrows IOException
         {
             return Integer.valueOf(input.readInt32());
         }
 
         @Override
         public void writeTo(Output outputint numberInteger value,
                 boolean repeatedthrows IOException
         {
             output.writeInt32(numbervalue.intValue(), repeated);
         }
 
         @Override
         public FieldType getFieldType()
         {
             return .;
         }
 
         @Override
         public Class<?> typeClass()
         {
             return Integer.class;
         }
     };
 
     public static final RuntimeFieldFactory<LongINT64 = new RuntimeFieldFactory<Long>(
             )
     {
         @Override
         public <T> Field<T> create(int numberjava.lang.String name,
                 final java.lang.reflect.Field fIdStrategy strategy)
         {
             final boolean primitive = f.getType().isPrimitive();
             return new Field<T>(.numbername,
                     f.getAnnotation(Tag.class))
             {
                 {
                     f.setAccessible(true);
                 }
 
                 public void mergeFrom(Input input, T message)
                         throws IOException
                 {
                     try
                     {
                         if (primitive)
                             f.setLong(messageinput.readInt64());
                         else
                             f.set(message, Long.valueOf(input.readInt64()));
                     }
                     catch (IllegalArgumentException | IllegalAccessException e)
                     {
                         throw new RuntimeException(e);
                     }
                 }
 
                 public void writeTo(Output output, T message)
                         throws IOException
                 {
                     try
                     {
                         if (primitive)
                             output.writeInt64(f.getLong(message), false);
                         else
                         {
                             Long value = (Longf.get(message);
                             if (value != null)
                                 output.writeInt64(value.longValue(),
                                         false);
                         }
                     }
                     catch (IllegalArgumentException | IllegalAccessException e)
                     {
                         throw new RuntimeException(e);
                     }
                 }
 
                 public void transfer(Pipe pipeInput inputOutput output,
                         boolean repeatedthrows IOException
                 {
                     output.writeInt64(input.readInt64(), repeated);
                 }
             };
         }
 
         @Override
         public void transfer(Pipe pipeInput inputOutput outputint number,
                 boolean repeatedthrows IOException
         {
             output.writeInt64(numberinput.readInt64(), repeated);
         }
 
         @Override
         public Long readFrom(Input inputthrows IOException
         {
             return Long.valueOf(input.readInt64());
         }
 
         @Override
         public void writeTo(Output outputint numberLong value,
                 boolean repeatedthrows IOException
         {
             output.writeInt64(numbervalue.longValue(), repeated);
         }
 
         @Override
         public FieldType getFieldType()
         {
             return .;
         }
 
         @Override
         public Class<?> typeClass()
         {
             return Long.class;
         }
     };
 
     public static final RuntimeFieldFactory<FloatFLOAT = new RuntimeFieldFactory<Float>(
             )
     {
         @Override
         public <T> Field<T> create(int numberjava.lang.String name,
                 final java.lang.reflect.Field fIdStrategy strategy)
         {
             final boolean primitive = f.getType().isPrimitive();
             return new Field<T>(.numbername,
                     f.getAnnotation(Tag.class))
             {
                 {
                     f.setAccessible(true);
                 }
 
                 public void mergeFrom(Input input, T message)
                         throws IOException
                 {
                     try
                     {
                         if (primitive)
                             f.setFloat(messageinput.readFloat());
                         else
                             f.set(messagenew Float(input.readFloat()));
                     }
                     catch (IllegalArgumentException | IllegalAccessException e)
                     {
                         throw new RuntimeException(e);
                     }
                 }
 
                 public void writeTo(Output output, T message)
                         throws IOException
                 {
                     try
                     {
                         if (primitive)
                             output.writeFloat(f.getFloat(message),
                                     false);
                         else
                         {
                             Float value = (Floatf.get(message);
                             if (value != null)
                                 output.writeFloat(value.floatValue(),
                                         false);
                         }
                     }
                     catch (IllegalArgumentException | IllegalAccessException e)
                     {
                         throw new RuntimeException(e);
                     }
                 }
 
                 public void transfer(Pipe pipeInput inputOutput output,
                         boolean repeatedthrows IOException
                 {
                     output.writeFloat(input.readFloat(), repeated);
                 }
             };
         }
 
         @Override
         public void transfer(Pipe pipeInput inputOutput outputint number,
                 boolean repeatedthrows IOException
         {
             output.writeFloat(numberinput.readFloat(), repeated);
         }
 
         @Override
         public Float readFrom(Input inputthrows IOException
         {
             return new Float(input.readFloat());
         }
 
         @Override
         public void writeTo(Output outputint numberFloat value,
                 boolean repeatedthrows IOException
         {
             output.writeFloat(numbervalue.floatValue(), repeated);
         }
 
         @Override
         public FieldType getFieldType()
         {
             return .;
         }
 
         @Override
         public Class<?> typeClass()
         {
             return Float.class;
         }
     };
 
     public static final RuntimeFieldFactory<DoubleDOUBLE = new RuntimeFieldFactory<Double>(
             )
     {
         @Override
         public <T> Field<T> create(int numberjava.lang.String name,
                 final java.lang.reflect.Field fIdStrategy strategy)
         {
             final boolean primitive = f.getType().isPrimitive();
             return new Field<T>(.numbername,
                     f.getAnnotation(Tag.class))
             {
                 {
                     f.setAccessible(true);
                 }
 
                 public void mergeFrom(Input input, T message)
                         throws IOException
                 {
                     try
                     {
                         if (primitive)
                             f.setDouble(messageinput.readDouble());
                         else
                             f.set(messagenew Double(input.readDouble()));
                     }
                     catch (IllegalArgumentException | IllegalAccessException e)
                     {
                         throw new RuntimeException(e);
                     }
                 }
 
                 public void writeTo(Output output, T message)
                         throws IOException
                 {
                     try
                     {
                         if (primitive)
                             output.writeDouble(f.getDouble(message),
                                     false);
                         else
                         {
                             Double value = (Doublef.get(message);
                             if (value != null)
                                 output.writeDouble(value.doubleValue(),
                                         false);
                         }
                     }
                     catch (IllegalArgumentException | IllegalAccessException e)
                     {
                         throw new RuntimeException(e);
                     }
                 }
 
                 public void transfer(Pipe pipeInput inputOutput output,
                         boolean repeatedthrows IOException
                 {
                     output.writeDouble(input.readDouble(), repeated);
                 }
             };
         }
 
         @Override
         public void transfer(Pipe pipeInput inputOutput outputint number,
                 boolean repeatedthrows IOException
         {
             output.writeDouble(numberinput.readDouble(), repeated);
         }
 
         @Override
         public Double readFrom(Input inputthrows IOException
         {
             return new Double(input.readDouble());
         }
 
         @Override
         public void writeTo(Output outputint numberDouble value,
                 boolean repeatedthrows IOException
         {
             output.writeDouble(numbervalue.doubleValue(), repeated);
         }
 
         @Override
         public FieldType getFieldType()
         {
             return .;
         }
 
         @Override
         public Class<?> typeClass()
         {
             return Double.class;
         }
     };
 
     public static final RuntimeFieldFactory<BooleanBOOL = new RuntimeFieldFactory<Boolean>(
             )
     {
         @Override
         public <T> Field<T> create(int numberjava.lang.String name,
                 final java.lang.reflect.Field fIdStrategy strategy)
         {
             final boolean primitive = f.getType().isPrimitive();
             return new Field<T>(.numbername,
                     f.getAnnotation(Tag.class))
             {
                 {
                     f.setAccessible(true);
                 }
 
                 public void mergeFrom(Input input, T message)
                         throws IOException
                 {
                     try
                     {
                         if (primitive)
                             f.setBoolean(messageinput.readBool());
                         else
                             f.set(messageinput.readBool() ? .
                                     : .);
                     }
                     catch (IllegalArgumentException | IllegalAccessException e)
                     {
                         throw new RuntimeException(e);
                     }
                 }
 
                 public void writeTo(Output output, T message)
                         throws IOException
                 {
                     try
                     {
                         if (primitive)
                             output.writeBool(f.getBoolean(message),
                                     false);
                         else
                         {
                             Boolean value = (Booleanf.get(message);
                             if (value != null)
                                 output.writeBool(value.booleanValue(),
                                         false);
                         }
                     }
                     catch (IllegalArgumentException | IllegalAccessException e)
                     {
                         throw new RuntimeException(e);
                     }
                 }
 
                 public void transfer(Pipe pipeInput inputOutput output,
                         boolean repeatedthrows IOException
                 {
                     output.writeBool(input.readBool(), repeated);
                 }
             };
         }
 
         @Override
         public void transfer(Pipe pipeInput inputOutput outputint number,
                 boolean repeatedthrows IOException
         {
             output.writeBool(numberinput.readBool(), repeated);
         }
 
         @Override
         public Boolean readFrom(Input inputthrows IOException
         {
             return input.readBool() ? . : .;
         }
 
         @Override
         public void writeTo(Output outputint numberBoolean value,
                 boolean repeatedthrows IOException
         {
             output.writeBool(numbervalue.booleanValue(), repeated);
         }
 
         @Override
         public FieldType getFieldType()
         {
             return .;
         }
 
         @Override
         public Class<?> typeClass()
         {
             return Boolean.class;
         }
     };
 
     public static final RuntimeFieldFactory<StringSTRING = new RuntimeFieldFactory<String>(
             )
     {
         @Override
         public <T> Field<T> create(int numberjava.lang.String name,
                 final java.lang.reflect.Field fIdStrategy strategy)
         {
             return new Field<T>(.numbername,
                     f.getAnnotation(Tag.class))
             {
                 {
                     f.setAccessible(true);
                 }
 
                 public void mergeFrom(Input input, T message)
                         throws IOException
                 {
                     try
                     {
                         f.set(messageinput.readString());
                     }
                     catch (IllegalArgumentException | IllegalAccessException e)
                     {
                         throw new RuntimeException(e);
                     }
                 }
 
                 public void writeTo(Output output, T message)
                         throws IOException
                 {
                     try
                     {
                         String value = (Stringf.get(message);
                         if (value != null)
                             output.writeString(valuefalse);
                     }
                     catch (IllegalArgumentException | IllegalAccessException e)
                     {
                         throw new RuntimeException(e);
                     }
                 }
 
                 public void transfer(Pipe pipeInput inputOutput output,
                         boolean repeatedthrows IOException
                 {
                     input.transferByteRangeTo(outputtruerepeated);
                 }
             };
         }
 
         @Override
         public void transfer(Pipe pipeInput inputOutput outputint number,
                 boolean repeatedthrows IOException
         {
             input.transferByteRangeTo(outputtruenumberrepeated);
         }
 
         @Override
         public String readFrom(Input inputthrows IOException
         {
             return input.readString();
         }
 
         @Override
         public void writeTo(Output outputint numberString value,
                 boolean repeatedthrows IOException
         {
             output.writeString(numbervaluerepeated);
         }
 
         @Override
         public FieldType getFieldType()
         {
             return .;
         }
 
         @Override
         public Class<?> typeClass()
         {
             return String.class;
         }
     };
 
     public static final RuntimeFieldFactory<ByteStringBYTES = new RuntimeFieldFactory<ByteString>(
             )
     {
         @Override
         public <T> Field<T> create(int numberjava.lang.String name,
                 final java.lang.reflect.Field fIdStrategy strategy)
         {
             return new Field<T>(.numbername,
                     f.getAnnotation(Tag.class))
             {
                 {
                     f.setAccessible(true);
                 }
 
                 @Override
                 public void mergeFrom(Input input, T message)
                         throws IOException
                 {
                     try
                     {
                         f.set(messageinput.readBytes());
                     }
                     catch (IllegalArgumentException | IllegalAccessException e)
                     {
                         throw new RuntimeException(e);
                     }
                 }
 
                 @Override
                 public void writeTo(Output output, T message)
                         throws IOException
                 {
                     try
                     {
                         ByteString bs = (ByteStringf.get(message);
                         if (bs != null)
                             output.writeBytes(bsfalse);
                     }
                     catch (IllegalArgumentException | IllegalAccessException e)
                     {
                         throw new RuntimeException(e);
                     }
                 }
 
                 @Override
                 public void transfer(Pipe pipeInput inputOutput output,
                         boolean repeatedthrows IOException
                 {
                     input.transferByteRangeTo(outputfalserepeated);
                 }
             };
         }
 
         @Override
         public void transfer(Pipe pipeInput inputOutput outputint number,
                 boolean repeatedthrows IOException
         {
             input.transferByteRangeTo(outputfalsenumberrepeated);
         }
 
         @Override
         public ByteString readFrom(Input inputthrows IOException
         {
             return input.readBytes();
         }
 
         @Override
         public void writeTo(Output outputint numberByteString value,
                 boolean repeatedthrows IOException
         {
             output.writeBytes(numbervaluerepeated);
         }
 
         @Override
         public FieldType getFieldType()
         {
             return .;
         }
 
         @Override
         public Class<?> typeClass()
         {
             return ByteString.class;
         }
     };
 
     public static final RuntimeFieldFactory<byte[]> BYTE_ARRAY = new RuntimeFieldFactory<byte[]>(
             )
     {
         @Override
         public <T> Field<T> create(int numberjava.lang.String name,
                 final java.lang.reflect.Field fIdStrategy strategy)
         {
             return new Field<T>(.numbername,
                     f.getAnnotation(Tag.class))
             {
                {
                    f.setAccessible(true);
                }
                public void mergeFrom(Input input, T message)
                        throws IOException
                {
                    try
                    {
                        f.set(messageinput.readByteArray());
                    }
                    catch (IllegalArgumentException | IllegalAccessException e)
                    {
                        throw new RuntimeException(e);
                    }
                }
                public void writeTo(Output output, T message)
                        throws IOException
                {
                    try
                    {
                        byte[] array = (byte[]) f.get(message);
                        if (array != null)
                            output.writeByteArray(arrayfalse);
                    }
                    catch (IllegalArgumentException | IllegalAccessException e)
                    {
                        throw new RuntimeException(e);
                    }
                }
                public void transfer(Pipe pipeInput inputOutput output,
                        boolean repeatedthrows IOException
                {
                    input.transferByteRangeTo(outputfalserepeated);
                }
            };
        }
        @Override
        public void transfer(Pipe pipeInput inputOutput outputint number,
                boolean repeatedthrows IOException
        {
            input.transferByteRangeTo(outputfalsenumberrepeated);
        }
        @Override
        public byte[] readFrom(Input inputthrows IOException
        {
            return input.readByteArray();
        }