<commit_before>/*
 * Copyright (c) 2014 DataTorrent, Inc. ALL Rights Reserved.
 *
 * 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 com.datatorrent.lib.io.fs;

import java.io.IOException;

import javax.validation.constraints.Min;

import com.datatorrent.common.util.Slice;

/**
 * An {@link AbstractBlockReader} which emits fixed-size byte-arrays wrapped in {@link Slice}.<br/>
 * This reader doesn't read beyond the block boundary therefore the last byte-array could be smaller.<br/>
 */
public class FixedBytesBlockReader extends AbstractBlockReader<Slice>
{
  @Min(1)
  private int length;

  private final transient Entity entity;

  public FixedBytesBlockReader()
  {
    super();
    length = 100;
    entity = new Entity();
  }

  @Override
  protected Entity readEntity(FileSplitter.BlockMetadata blockMetadata, long blockOffset) throws IOException
  {<commit_msg>changed access specifier of entity to protected so that it can be accessed by subclasses<commit_after>/*
 * Copyright (c) 2014 DataTorrent, Inc. ALL Rights Reserved.
 *
 * 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 com.datatorrent.lib.io.fs;

import java.io.IOException;

import javax.validation.constraints.Min;

import com.datatorrent.common.util.Slice;

/**
 * An {@link AbstractBlockReader} which emits fixed-size byte-arrays wrapped in {@link Slice}.<br/>
 * This reader doesn't read beyond the block boundary therefore the last byte-array could be smaller.<br/>
 */
public class FixedBytesBlockReader extends AbstractBlockReader<Slice>
{
  @Min(1)
  private int length;

  protected final transient Entity entity;

  public FixedBytesBlockReader()
  {
    super();
    length = 100;
    entity = new Entity();
  }

  @Override
  protected Entity readEntity(FileSplitter.BlockMetadata blockMetadata, long blockOffset) throws IOException
  {
{'fraction_non_alphanumeric': 0.08277797264117853, 'fraction_numerical': 0.008418098912662224, 'mean_word_length': 4.138738738738739, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3111784', 'n_tokens_mistral': 773, 'n_tokens_neox': 740, 'n_words': 318}