keith-turner commented on a change in pull request #5: [WIP] DO NOT MERGE - Initial implementation URL: https://github.com/apache/fluo-bytes/pull/5#discussion_r145736738
########## File path: src/main/java/org/apache/bytes/ByteSequence.java ########## @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.bytes; + +import java.util.stream.IntStream; + +/** + * Interface representing a sequence of bytes. + * + * @since 1.0.0 + */ +public interface ByteSequence extends Iterable<Byte> { + + /** + * The length of the sequence this object represents. It does not necessarily reflect the size of + * any internal data structures, such as an internal byte array. + * + * @return the length of the sequence + */ + int length(); + + /** + * Retrieve a byte at the specified index. Valid indices are between <code>0</code> (for the first + * byte) and <code>length() - 1</code> for the last byte. + * + * @param index the position within the sequence to retrieve + * @return the byte at the specified index + */ + byte byteAt(int index); Review comment: Not sure if this is a good thing to do, but its something I thought of. Could make index of type long. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
