public byte[] read(long offset, VDKFilePattern pattern) {
		
		byte[] buffer = new byte[pattern.getLength()];
		byte[] resultBuffer = new byte[pattern.getLength()];
		int bytesRead;
		
		try {

			seek(offset + pattern.getOffset());
			bytesRead = read(buffer);
			
			if (bytesRead != pattern.getLength()) {
				close();
			    throw new IOException("Unexpected End of Stream");
			}
			
			if(pattern.isLittleEndian()) {
				for(int i = 0; i < buffer.length; i++)
					resultBuffer[(buffer.length - 1) - i] = buffer[i];
			}			
			// Data are naturally red as big endian bit sequence.
			else resultBuffer = buffer;				
			
		} catch (IOException e) {
			
			try {
				close();
			} catch (IOException e1) {
				e1.printStackTrace();
			}
			e.printStackTrace();
		}
		
		return resultBuffer;
	}